diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-12-18 11:18:07 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-12-18 11:18:07 +0300 |
commit | da93a53f7630a62f342f51743d63914f3ea5f266 (patch) | |
tree | a38650a74cb03e6a3ee66180e91af3dbf2c3a3a7 /src/map | |
parent | 4537814684bc50d1154d9f54500c0602303ca862 (diff) | |
download | plugin-da93a53f7630a62f342f51743d63914f3ea5f266.tar.gz plugin-da93a53f7630a62f342f51743d63914f3ea5f266.tar.bz2 plugin-da93a53f7630a62f342f51743d63914f3ea5f266.tar.xz plugin-da93a53f7630a62f342f51743d63914f3ea5f266.zip |
Read paramater FloorLifeTime from item_db.
Diffstat (limited to 'src/map')
-rw-r--r-- | src/map/init.c | 1 | ||||
-rw-r--r-- | src/map/itemdb.c | 24 | ||||
-rw-r--r-- | src/map/itemdb.h | 2 |
3 files changed, 23 insertions, 4 deletions
diff --git a/src/map/init.c b/src/map/init.c index d84ed66..a3a7556 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -110,6 +110,7 @@ HPExport void plugin_init (void) addHookPre("clif->set_unit_idle", eclif_set_unit_idle); addHookPre("clif->send_actual", eclif_send_actual); addHookPre("itemdb->is_item_usable", eitemdb_is_item_usable); + addHookPre("itemdb->readdb_additional_fields", eitemdb_readdb_additional_fields); addHookPost("clif->getareachar_unit", eclif_getareachar_unit_post); addHookPost("clif->authok", eclif_authok_post); diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 0057a75..5d1f51b 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -15,10 +15,8 @@ #include "../../../map/npc.h" #include "../../../map/pc.h" -#include "map/data/mapd.h" -#include "map/data/npcd.h" -#include "map/struct/mapdext.h" -#include "map/struct/npcdext.h" +#include "map/data/itemd.h" +#include "map/struct/itemdext.h" #include "map/npc.h" bool eitemdb_is_item_usable(struct item_data *item) @@ -26,3 +24,21 @@ bool eitemdb_is_item_usable(struct item_data *item) hookStop(); return item->type == IT_HEALING || item->type == IT_USABLE || item->type == IT_CASH || item->type == IT_PETEGG; } + +void eitemdb_readdb_additional_fields(int *itemid, + config_setting_t *it, + int *n __attribute__ ((unused)), + const char *source __attribute__ ((unused))) +{ + hookStop(); + struct item_data *item = itemdb->exists(*itemid); + int i32 = 0; + if (!item) + return; + struct ItemdExt *data = itemd_get(item); + if (!data) + return; + + if (libconfig->setting_lookup_int(it, "FloorLifeTime", &i32) && i32 >= 0) + data->floorLifeTime = i32; +} diff --git a/src/map/itemdb.h b/src/map/itemdb.h index 5e1faac..5e35d57 100644 --- a/src/map/itemdb.h +++ b/src/map/itemdb.h @@ -6,4 +6,6 @@ bool eitemdb_is_item_usable(struct item_data *item); +void eitemdb_readdb_additional_fields(int *itemid, config_setting_t *it, int *n, const char *source); + #endif // EVOL_MAP_ITEMDB |