summaryrefslogtreecommitdiff
path: root/src/map/storage.c
diff options
context:
space:
mode:
authorbrianluau <brianluau@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-06-12 16:22:33 +0000
committerbrianluau <brianluau@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-06-12 16:22:33 +0000
commita8fe46e2e80ea5b7d998d3e92717153cc3315129 (patch)
treef023f80fd298226e974c34cf595e4e05e4462a9d /src/map/storage.c
parent22ea2706f0a9767d9910522868cc90f121cfc6fa (diff)
downloadhercules-a8fe46e2e80ea5b7d998d3e92717153cc3315129.tar.gz
hercules-a8fe46e2e80ea5b7d998d3e92717153cc3315129.tar.bz2
hercules-a8fe46e2e80ea5b7d998d3e92717153cc3315129.tar.xz
hercules-a8fe46e2e80ea5b7d998d3e92717153cc3315129.zip
* Merged /branches/renewal/ r14635 Item Stacking System to /trunk (follow up to r15060) pid:106973
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16279 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/storage.c')
-rw-r--r--src/map/storage.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/map/storage.c b/src/map/storage.c
index d9ab0312f..0bf575c84 100644
--- a/src/map/storage.c
+++ b/src/map/storage.c
@@ -140,6 +140,11 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
data = itemdb_search(item_data->nameid);
+ if( data->stack.storage && amount > data->stack.amount )
+ {// item stack limitation
+ return 1;
+ }
+
if( !itemdb_canstore(item_data, pc_get_group_level(sd)) )
{ //Check if item is storable. [Skotlex]
clif_displaymessage (sd->fd, msg_txt(264));
@@ -152,7 +157,7 @@ static int storage_additem(struct map_session_data* sd, struct item* item_data,
{
if( compare_item(&stor->items[i], item_data) )
{// existing items found, stack them
- if( amount > MAX_AMOUNT - stor->items[i].amount )
+ if( amount > MAX_AMOUNT - stor->items[i].amount || ( data->stack.storage && amount > data->stack.amount - stor->items[i].amount ) )
return 1;
stor->items[i].amount += amount;
clif_storageitemadded(sd,&stor->items[i],i,amount);
@@ -396,6 +401,11 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
data = itemdb_search(item_data->nameid);
+ if( data->stack.guildstorage && amount > data->stack.amount )
+ {// item stack limitation
+ return 1;
+ }
+
if( !itemdb_canguildstore(item_data, pc_get_group_level(sd)) || item_data->expire_time )
{ //Check if item is storable. [Skotlex]
clif_displaymessage (sd->fd, msg_txt(264));
@@ -405,7 +415,7 @@ int guild_storage_additem(struct map_session_data* sd, struct guild_storage* sto
if(itemdb_isstackable2(data)){ //Stackable
for(i=0;i<MAX_GUILD_STORAGE;i++){
if(compare_item(&stor->items[i], item_data)) {
- if(stor->items[i].amount+amount > MAX_AMOUNT)
+ if( amount > MAX_AMOUNT - stor->items[i].amount || ( data->stack.guildstorage && amount > data->stack.amount - stor->items[i].amount ) )
return 1;
stor->items[i].amount+=amount;
clif_storageitemadded(sd,&stor->items[i],i,amount);