summaryrefslogtreecommitdiff
path: root/src/map/storage.c
diff options
context:
space:
mode:
authorzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-11-16 16:14:30 +0000
committerzephyrus <zephyrus@54d463be-8e91-2dee-dedb-b68131a5f0ec>2008-11-16 16:14:30 +0000
commit8d5fe8a2562df4eb5e6eca2fb161514d9f6a7e9d (patch)
tree8d024104aa15ed6c2aa5070bd03ed7790a2afd90 /src/map/storage.c
parent9b1e41499d17bb424414a7821e74a53c6d3e3f74 (diff)
downloadhercules-8d5fe8a2562df4eb5e6eca2fb161514d9f6a7e9d.tar.gz
hercules-8d5fe8a2562df4eb5e6eca2fb161514d9f6a7e9d.tar.bz2
hercules-8d5fe8a2562df4eb5e6eca2fb161514d9f6a7e9d.tar.xz
hercules-8d5fe8a2562df4eb5e6eca2fb161514d9f6a7e9d.zip
- Item Rental System.
Script Usage: - rentitem <itemid>,<seconds>; - rentitem <itemname>,<seconds>; git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@13370 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/storage.c')
-rw-r--r--src/map/storage.c35
1 files changed, 24 insertions, 11 deletions
diff --git a/src/map/storage.c b/src/map/storage.c
index e4bdfe414..33a72d0d7 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -112,10 +112,11 @@ int storage_storageopen(struct map_session_data *sd)
// helper function
int compare_item(struct item *a, struct item *b)
{
- if (a->nameid == b->nameid &&
+ if( a->nameid == b->nameid &&
a->identify == b->identify &&
a->refine == b->refine &&
- a->attribute == b->attribute)
+ a->attribute == b->attribute &&
+ a->expire_time == b->expire_time )
{
int i;
for (i = 0; i < MAX_SLOTS && (a->card[i] == b->card[i]); i++);
@@ -215,7 +216,10 @@ int storage_storageadd(struct map_session_data* sd, int index, int amount)
return 0;
if( sd->status.inventory[index].nameid <= 0 )
- return 0; //No item on that spot
+ return 0; // No item on that spot
+
+ if( sd->status.inventory[index].expire_time )
+ return 0; // Cannot Store Rental Items
if( amount < 1 || amount > sd->status.inventory[index].amount )
return 0;
@@ -266,6 +270,9 @@ int storage_storageaddfromcart(struct map_session_data* sd, int index, int amoun
if( sd->status.cart[index].nameid <= 0 )
return 0; //No item there.
+ if( sd->status.inventory[index].expire_time )
+ return 0; // Cannot Store Rental Items
+
if( amount < 1 || amount > sd->status.cart[index].amount )
return 0;
@@ -462,16 +469,19 @@ int storage_guild_storageadd(struct map_session_data* sd, int index, int amount)
nullpo_retr(0, sd);
nullpo_retr(0, stor=guild2storage2(sd->status.guild_id));
- if (!stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE)
+ if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE )
return 0;
- if(index<0 || index>=MAX_INVENTORY)
+ if( index<0 || index>=MAX_INVENTORY )
return 0;
- if(sd->status.inventory[index].nameid <= 0)
+ if( sd->status.inventory[index].nameid <= 0 )
return 0;
- if(amount < 1 || amount > sd->status.inventory[index].amount)
+ if( amount < 1 || amount > sd->status.inventory[index].amount )
+ return 0;
+
+ if( sd->status.inventory[index].expire_time )
return 0;
// log_tostorage(sd, index, 1);
@@ -517,16 +527,19 @@ int storage_guild_storageaddfromcart(struct map_session_data* sd, int index, int
nullpo_retr(0, sd);
nullpo_retr(0, stor=guild2storage2(sd->status.guild_id));
- if(!stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE)
+ if( !stor->storage_status || stor->storage_amount > MAX_GUILD_STORAGE )
return 0;
- if(index<0 || index>=MAX_CART)
+ if( index < 0 || index >= MAX_CART )
return 0;
- if(sd->status.cart[index].nameid <= 0)
+ if( sd->status.cart[index].nameid <= 0 )
return 0;
- if(amount < 1 || amount > sd->status.cart[index].amount)
+ if( amount < 1 || amount > sd->status.cart[index].amount )
+ return 0;
+
+ if( sd->status.inventory[index].expire_time )
return 0;
if(guild_storage_additem(sd,stor,&sd->status.cart[index],amount)==0)