summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-01 12:29:38 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-07-01 12:29:38 +0000
commit9b89cabf520e19557b7b003ab8160f76027c9242 (patch)
treec3fc2937e71c5256379ed8dee75aff1850c49805 /src/map/pc.c
parent2fd87c062a72a6a17fccdaa822086221baae0e15 (diff)
downloadhercules-9b89cabf520e19557b7b003ab8160f76027c9242.tar.gz
hercules-9b89cabf520e19557b7b003ab8160f76027c9242.tar.bz2
hercules-9b89cabf520e19557b7b003ab8160f76027c9242.tar.xz
hercules-9b89cabf520e19557b7b003ab8160f76027c9242.zip
Fixed bugreport:5984 rental items exploit which allowed a rental item from never being deleted when used alongside storage has been fixed, blame on r14958
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16361 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 64b835c1b..7da3a7459 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -3761,11 +3761,25 @@ int pc_additem(struct map_session_data *sd,struct item *item_data,int amount,e_l
clif_additem(sd,i,amount,0);
}
log_pick_pc(sd, log_type, amount, &sd->status.inventory[i]);
-
+
sd->weight += w;
clif_updatestatus(sd,SP_WEIGHT);
//Auto-equip
- if(data->flag.autoequip) pc_equipitem(sd, i, data->equip);
+ if(data->flag.autoequip)
+ pc_equipitem(sd, i, data->equip);
+
+ /* rental item check */
+ if( item_data->expire_time ) {
+ if( time(NULL) > item_data->expire_time ) {
+ clif_rental_expired(sd->fd, i, sd->status.inventory[i].nameid);
+ pc_delitem(sd, i, sd->status.inventory[i].amount, 1, 0, LOG_TYPE_OTHER);
+ } else {
+ int seconds = (int)( item_data->expire_time - time(NULL) );
+ clif_rental_time(sd->fd, sd->status.inventory[i].nameid, seconds);
+ pc_inventory_rental_add(sd, seconds);
+ }
+ }
+
return 0;
}