diff options
-rw-r--r-- | Changelog-Trunk.txt | 3 | ||||
-rw-r--r-- | src/map/clif.c | 46 | ||||
-rw-r--r-- | src/map/pc.c | 25 |
3 files changed, 41 insertions, 33 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index bf50b5730..139e095b7 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -4,6 +4,9 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/06/02
+ * Corrected clif_parse_takeitem to ALWAYS return a NAK packet when it
+ fails. Fixes cases where the client gets "stuck" and refuses to let you
+ pick any items. [Skotlex]
* Removed the walk delay from firewall and changed its knockback [MasterOfMuppets]
to 1 tile to make it act more like in the official servers.
* Some cleaning of the mob slave ai. [Skotlex]
diff --git a/src/map/clif.c b/src/map/clif.c index b6a9f38f5..fee72a26c 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -9125,29 +9125,35 @@ void clif_parse_TakeItem(int fd, struct map_session_data *sd) { fitem = (struct flooritem_data*)map_id2bl(map_object_id);
- if (pc_isdead(sd)) {
- clif_clearchar_area(&sd->bl, 1);
- return;
- }
+ do {
+ if (pc_isdead(sd)) {
+ clif_clearchar_area(&sd->bl, 1);
+ break;
+ }
- if (fitem == NULL || fitem->bl.type != BL_ITEM || fitem->bl.m != sd->bl.m)
- return;
-
- if (clif_cant_act(sd))
- return;
+ if (fitem == NULL || fitem->bl.type != BL_ITEM || fitem->bl.m != sd->bl.m)
+ break;
- if(pc_iscloaking(sd) || pc_ischasewalk(sd)) //Disable cloaking/chasewalking characters from looting [Skotlex]
- return;
- if(sd->sc.count && (
- sd->sc.data[SC_TRICKDEAD].timer != -1 || //死んだふり
- sd->sc.data[SC_BLADESTOP].timer != -1 || //白刃取り
- sd->sc.data[SC_NOCHAT].timer!=-1 ) //会話禁止
- ) {
- clif_additem(sd,0,0,6); // send fail packet! [Valaris]
- return;
- }
+ if (clif_cant_act(sd))
+ break;
- pc_takeitem(sd, fitem);
+ //Disable cloaking/chasewalking characters from looting [Skotlex]
+ if(pc_iscloaking(sd) || pc_ischasewalk(sd))
+ break;
+
+ if(sd->sc.count && (
+ sd->sc.data[SC_TRICKDEAD].timer != -1 ||
+ sd->sc.data[SC_BLADESTOP].timer != -1 ||
+ sd->sc.data[SC_NOCHAT].timer!=-1 )
+ )
+ break;
+
+ if (!pc_takeitem(sd, fitem))
+ break;
+ return;
+ } while (0);
+ // Client REQUIRES a fail packet or you can no longer pick items.
+ clif_additem(sd,0,0,6);
}
/*==========================================
diff --git a/src/map/pc.c b/src/map/pc.c index cca92aff5..89e4a523b 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2609,38 +2609,37 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) if (sd->status.party_id)
p = party_search(sd->status.party_id);
- if(fitem->first_get_id > 0 && fitem->first_get_id != sd->bl.id) {
+ if(fitem->first_get_id > 0 && fitem->first_get_id != sd->bl.id)
+ {
first_sd = map_id2sd(fitem->first_get_id);
if(DIFF_TICK(tick,fitem->first_get_tick) < 0) {
if (!(p && p->item&1 &&
first_sd && first_sd->status.party_id == sd->status.party_id
- )) {
- clif_additem(sd,0,0,6);
+ ))
return 0;
- }
}
- else if(fitem->second_get_id > 0 && fitem->second_get_id != sd->bl.id) {
+ else
+ if(fitem->second_get_id > 0 && fitem->second_get_id != sd->bl.id)
+ {
second_sd = map_id2sd(fitem->second_get_id);
if(DIFF_TICK(tick, fitem->second_get_tick) < 0) {
if(!(p && p->item&1 &&
((first_sd && first_sd->status.party_id == sd->status.party_id) ||
(second_sd && second_sd->status.party_id == sd->status.party_id))
- )) {
- clif_additem(sd,0,0,6);
+ ))
return 0;
- }
}
- else if(fitem->third_get_id > 0 && fitem->third_get_id != sd->bl.id) {
+ else
+ if(fitem->third_get_id > 0 && fitem->third_get_id != sd->bl.id)
+ {
third_sd = map_id2sd(fitem->third_get_id);
if(DIFF_TICK(tick,fitem->third_get_tick) < 0) {
if(!(p && p->item&1 &&
((first_sd && first_sd->status.party_id == sd->status.party_id) ||
(second_sd && second_sd->status.party_id == sd->status.party_id) ||
(third_sd && third_sd->status.party_id == sd->status.party_id))
- )) {
- clif_additem(sd,0,0,6);
+ ))
return 0;
- }
}
}
}
@@ -2660,7 +2659,7 @@ int pc_takeitem(struct map_session_data *sd,struct flooritem_data *fitem) pc_equipitem(sd, fitem->item_data.nameid, fitem->item_data.equip);
}
map_clearflooritem(fitem->bl.id);
- return 0;
+ return 1;
}
int pc_isUseitem(struct map_session_data *sd,int n)
|