diff options
author | Haruna <haru@dotalux.com> | 2015-08-11 14:50:40 +0200 |
---|---|---|
committer | Haruna <haru@dotalux.com> | 2015-08-11 14:50:40 +0200 |
commit | a8e54e5688bd3d7b8e9073274ff611040c3178ab (patch) | |
tree | 9e82989e5eb68bb2ee3548ca5fe76e62ed250b89 | |
parent | 909bb005837aba3017870a529b106135e3b84b5b (diff) | |
parent | 7fbb6aef7eef2f5439bbeed19d884aa7dca6b5c3 (diff) | |
download | hercules-a8e54e5688bd3d7b8e9073274ff611040c3178ab.tar.gz hercules-a8e54e5688bd3d7b8e9073274ff611040c3178ab.tar.bz2 hercules-a8e54e5688bd3d7b8e9073274ff611040c3178ab.tar.xz hercules-a8e54e5688bd3d7b8e9073274ff611040c3178ab.zip |
Merge pull request #635 from 4144/fixscripts
Fix issue #634. Delay actual item deletion after running item script.
-rw-r--r-- | src/map/pc.c | 7 |
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; } |