summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-02 18:24:29 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-06-02 18:24:29 +0000
commit42c15ccde5ce27e721243afe43e3784f35c63695 (patch)
tree371349426458e5807185fd58e148739cb2af4e57 /src/map
parent5459510af1250f4ce2032314cb970f116b84a395 (diff)
downloadhercules-42c15ccde5ce27e721243afe43e3784f35c63695.tar.gz
hercules-42c15ccde5ce27e721243afe43e3784f35c63695.tar.bz2
hercules-42c15ccde5ce27e721243afe43e3784f35c63695.tar.xz
hercules-42c15ccde5ce27e721243afe43e3784f35c63695.zip
- Corrected clif_parse_takeitem to ALWAYS return a NAK packet when it fails
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6943 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/clif.c46
-rw-r--r--src/map/pc.c25
2 files changed, 38 insertions, 33 deletions
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)