Ver Fonte

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://svn.code.sf.net/p/rathena/svn/trunk@16361 54d463be-8e91-2dee-dedb-b68131a5f0ec
shennetsind há 13 anos atrás
pai
commit
32b82f75b8
2 ficheiros alterados com 16 adições e 5 exclusões
  1. 16 2
      src/map/pc.c
  2. 0 3
      src/map/script.c

+ 16 - 2
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;
 }
 

+ 0 - 3
src/map/script.c

@@ -6102,9 +6102,6 @@ BUILDIN_FUNC(rentitem)
 		clif_additem(sd, 0, 0, flag);
 		return 1;
 	}
-
-	clif_rental_time(sd->fd, nameid, seconds);
-	pc_inventory_rental_add(sd, seconds);
 	
 	return 0;
 }