summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-11 15:22:33 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-11 15:22:33 +0300
commit7fbb6aef7eef2f5439bbeed19d884aa7dca6b5c3 (patch)
tree9e82989e5eb68bb2ee3548ca5fe76e62ed250b89 /src/map
parent909bb005837aba3017870a529b106135e3b84b5b (diff)
downloadhercules-7fbb6aef7eef2f5439bbeed19d884aa7dca6b5c3.tar.gz
hercules-7fbb6aef7eef2f5439bbeed19d884aa7dca6b5c3.tar.bz2
hercules-7fbb6aef7eef2f5439bbeed19d884aa7dca6b5c3.tar.xz
hercules-7fbb6aef7eef2f5439bbeed19d884aa7dca6b5c3.zip
Fix issue #634. Delay actual item deletion after running item script.
Diffstat (limited to 'src/map')
-rw-r--r--src/map/pc.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index ec74e2da8..bc45f9184 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -4882,6 +4882,7 @@ int pc_isUseitem(struct map_session_data *sd,int n)
int pc_useitem(struct map_session_data *sd,int n) {
int64 tick = timer->gettick();
int amount, nameid, i;
+ bool removeItem = false;
nullpo_ret(sd);
@@ -4999,7 +5000,7 @@ int pc_useitem(struct map_session_data *sd,int n) {
else {
if (sd->status.inventory[n].expire_time == 0) {
clif->useitemack(sd, n, amount - 1, true);
- pc->delitem(sd, n, 1, 1, DELITEM_NORMAL, LOG_TYPE_CONSUME); // Rental Usable Items are not deleted until expiration
+ removeItem = true;
} else {
clif->useitemack(sd, n, 0, false);
}
@@ -5019,8 +5020,10 @@ int pc_useitem(struct map_session_data *sd,int n) {
sd->canusecashfood_tick = tick + battle_config.cashfood_use_interval;
script->run_use_script(sd, sd->inventory_data[n], npc->fake_nd->bl.id);
-
script->potion_flag = 0;
+
+ if (removeItem)
+ pc->delitem(sd, n, 1, 1, DELITEM_NORMAL, LOG_TYPE_CONSUME);
return 1;
}