From e39a129ee298c01638913e518f8fa23fa4bbe855 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 7 Apr 2015 22:17:41 +0300 Subject: Return from pc_equipitem/pc_unequipitem 0 if cant equip item and 1 if item equipped/unequipped --- src/map/pc.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/map/pc.c b/src/map/pc.c index f28a4cfdd..ffc9b77ec 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -8958,6 +8958,9 @@ void pc_equipitem_pos(struct map_session_data *sd, struct item_data *id, int pos /*========================================== * Equip item on player sd at req_pos from inventory index n + * Return: + * 0 = fail + * 1 = success *------------------------------------------*/ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) { @@ -9089,7 +9092,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos) } sd->npc_item_flag = iflag; - return 0; + return 1; } void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos) @@ -9155,6 +9158,9 @@ void pc_unequipitem_pos(struct map_session_data *sd, int n, int pos) * 0 - only unequip * 1 - calculate status after unequipping * 2 - force unequip + * Return: + * 0 = fail + * 1 = success *------------------------------------------*/ int pc_unequipitem(struct map_session_data *sd,int n,int flag) { int i,iflag; @@ -9280,7 +9286,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) { } sd->npc_item_flag = iflag; - return 0; + return 1; } /*========================================== -- cgit v1.2.3-60-g2f50 From 4ca6649bec3b632076d66ef7c1a449e63137c333 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 7 Apr 2015 22:56:06 +0300 Subject: Done show error message in client if was used item with flag KeepAfterUse. --- src/map/pc.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/map/pc.c b/src/map/pc.c index ffc9b77ec..29baf0c84 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -4558,14 +4558,15 @@ int pc_useitem(struct map_session_data *sd,int n) { amount = sd->status.inventory[n].amount; item_script = sd->inventory_data[n]->script; //Check if the item is to be consumed immediately [Skotlex] - if( sd->inventory_data[n]->flag.delay_consume ) + if (sd->inventory_data[n]->flag.delay_consume || sd->inventory_data[n]->flag.keepafteruse) clif->useitemack(sd,n,amount,true); else { - if (sd->status.inventory[n].expire_time == 0 && !(sd->inventory_data[n]->flag.keepafteruse)) { - clif->useitemack(sd,n,amount-1,true); - pc->delitem(sd,n,1,1,0,LOG_TYPE_CONSUME); // Rental Usable Items are not deleted until expiration - } else - clif->useitemack(sd,n,0,false); + if (sd->status.inventory[n].expire_time == 0) { + clif->useitemack(sd, n, amount - 1, true); + pc->delitem(sd, n, 1, 1, 0, LOG_TYPE_CONSUME); // Rental Usable Items are not deleted until expiration + } else { + clif->useitemack(sd, n, 0, false); + } } if(sd->status.inventory[n].card[0]==CARD0_CREATE && pc->famerank(MakeDWord(sd->status.inventory[n].card[2],sd->status.inventory[n].card[3]), MAPID_ALCHEMIST)) -- cgit v1.2.3-60-g2f50