From 7fbb6aef7eef2f5439bbeed19d884aa7dca6b5c3 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 11 Aug 2015 15:22:33 +0300 Subject: Fix issue #634. Delay actual item deletion after running item script. --- src/map/pc.c | 7 +++++-- 1 file 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; } -- cgit v1.2.3-70-g09d2