diff options
author | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-12-27 11:30:37 +0000 |
---|---|---|
committer | ai4rei <ai4rei@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2010-12-27 11:30:37 +0000 |
commit | c82d8121d5c52e42242d9f3f8be36f0aed569701 (patch) | |
tree | 9e22f1dec5282717cf32fe6fe7e1697a2289d181 /src/map/itemdb.c | |
parent | d10cf69aff5fdc4894535e62705de9f6bdfe2672 (diff) | |
download | hercules-c82d8121d5c52e42242d9f3f8be36f0aed569701.tar.gz hercules-c82d8121d5c52e42242d9f3f8be36f0aed569701.tar.bz2 hercules-c82d8121d5c52e42242d9f3f8be36f0aed569701.tar.xz hercules-c82d8121d5c52e42242d9f3f8be36f0aed569701.zip |
* Added item stacking limit database (item_stack.txt) required for runes and other 3rd class related skill items.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/renewal@14635 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r-- | src/map/itemdb.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index ce10f4f39..6455d10b6 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -724,6 +724,46 @@ static int itemdb_read_itemdelay(void) return 0; } +/*================================================================== + * Reads item stacking restrictions + *----------------------------------------------------------------*/ +static bool itemdb_read_stack(char* fields[], int columns, int current) +{// <item id>,<stack limit amount>,<type> + unsigned short nameid, amount; + unsigned int type; + struct item_data* id; + + nameid = (unsigned short)strtoul(fields[0], NULL, 10); + + if( ( id = itemdb_exists(nameid) ) == NULL ) + { + ShowWarning("itemdb_read_stack: Unknown item id '%hu'.\n", nameid); + return false; + } + + if( !itemdb_isstackable2(id) ) + { + ShowWarning("itemdb_read_stack: Item id '%hu' is not stackable.\n", nameid); + return false; + } + + amount = (unsigned short)strtoul(fields[1], NULL, 10); + type = strtoul(fields[2], NULL, 10); + + if( !amount ) + {// ignore + return true; + } + + id->stack.amount = amount; + id->stack.inventory = (type&1)!=0; + id->stack.cart = (type&2)!=0; + id->stack.storage = (type&4)!=0; + id->stack.guildstorage = (type&8)!=0; + + return true; +} + /*====================================== * Applies gender restrictions according to settings. [Skotlex] *======================================*/ @@ -1040,6 +1080,7 @@ static void itemdb_read(void) itemdb_read_noequip(); itemdb_read_itemtrade(); itemdb_read_itemdelay(); + sv_readdb(db_path, "item_stack.txt", ',', 3, 3, -1, &itemdb_read_stack); } /*========================================== |