summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormalufett <malufett.eat.my.binaries@gmail.com>2015-04-09 11:29:52 +0800
committermalufett <malufett.eat.my.binaries@gmail.com>2015-04-09 11:29:52 +0800
commitdf1bcac8ef95885019adc1ee03cb2ed9c663c0df (patch)
tree5cebc755bf227ab315f5e5931f8640de52497db6
parenta823dedd45238a623ab9b950f7408e59ab2c961f (diff)
parent4ca6649bec3b632076d66ef7c1a449e63137c333 (diff)
downloadhercules-df1bcac8ef95885019adc1ee03cb2ed9c663c0df.tar.gz
hercules-df1bcac8ef95885019adc1ee03cb2ed9c663c0df.tar.bz2
hercules-df1bcac8ef95885019adc1ee03cb2ed9c663c0df.tar.xz
hercules-df1bcac8ef95885019adc1ee03cb2ed9c663c0df.zip
Merge pull request #490 from 4144/pcfix
Small fixed for pc.c -Dont show use error if item with KeepAfterUse attribute -From pc_equipitem/pc_unequipitem return actual state is action was success or not.
-rw-r--r--src/map/pc.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index f28a4cfdd..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))
@@ -8958,6 +8959,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 +9093,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 +9159,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 +9287,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag) {
}
sd->npc_item_flag = iflag;
- return 0;
+ return 1;
}
/*==========================================