diff options
author | Matheus Macabu <mkbu95@gmail.com> | 2013-05-01 21:00:06 -0300 |
---|---|---|
committer | Matheus Macabu <mkbu95@gmail.com> | 2013-05-01 21:01:54 -0300 |
commit | c347ebacd8116b49e0e839abab1be35432ce0446 (patch) | |
tree | d2ce9350884fe69fdbdb78d8fa6aa133d007c6e5 /src/map/itemdb.c | |
parent | 7a625b95742b780622482dc5d4de2c6622aac9ae (diff) | |
download | hercules-c347ebacd8116b49e0e839abab1be35432ce0446.tar.gz hercules-c347ebacd8116b49e0e839abab1be35432ce0446.tar.bz2 hercules-c347ebacd8116b49e0e839abab1be35432ce0446.tar.xz hercules-c347ebacd8116b49e0e839abab1be35432ce0446.zip |
Implemented "item_nouse.txt" to prevent players from using items under certain flags (which are pre-determined).
Fixes issue:7064. Thanks to Muad_Dib for providing the item list for this db.
Signed-off-by: Matheus Macabu <mkbu95@gmail.com>
Diffstat (limited to 'src/map/itemdb.c')
-rw-r--r-- | src/map/itemdb.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 386f38c5a..0b4419e0c 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -727,6 +727,31 @@ static bool itemdb_read_buyingstore(char* fields[], int columns, int current) return true; } + +/******************************************* +** Item usage restriction (item_nouse.txt) +********************************************/ +static bool itemdb_read_nouse(char* fields[], int columns, int current) +{// <nameid>,<flag>,<override> + int nameid, flag, override; + struct item_data* id; + + nameid = atoi(fields[0]); + + if( ( id = itemdb_exists(nameid) ) == NULL ) { + ShowWarning("itemdb_read_nouse: Invalid item id %d.\n", nameid); + return false; + } + + flag = atoi(fields[1]); + override = atoi(fields[2]); + + id->item_usage.flag = flag; + id->item_usage.override = override; + + return true; +} + /** * @return: amount of retrieved entries. **/ @@ -1304,6 +1329,7 @@ static void itemdb_read(void) { sv_readdb(db_path, "item_delay.txt", ',', 2, 2, -1, &itemdb_read_itemdelay); sv_readdb(db_path, "item_stack.txt", ',', 3, 3, -1, &itemdb_read_stack); sv_readdb(db_path, DBPATH"item_buyingstore.txt", ',', 1, 1, -1, &itemdb_read_buyingstore); + sv_readdb(db_path, "item_nouse.txt", ',', 3, 3, -1, &itemdb_read_nouse); itemdb_uid_load(); } |