summaryrefslogtreecommitdiff
path: root/src/emap/itemdb.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-13 20:08:55 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-13 20:30:34 +0300
commitf7cce6ac2d1c010af4865212dc6ddc2a7aea66a4 (patch)
tree7d65ea2e1bd9fb9379157dce324c1d601d0518e9 /src/emap/itemdb.c
parent5b49e94e000d31299e9e97e339e7ad273cdfa032 (diff)
downloadevol-hercules-f7cce6ac2d1c010af4865212dc6ddc2a7aea66a4.tar.gz
evol-hercules-f7cce6ac2d1c010af4865212dc6ddc2a7aea66a4.tar.bz2
evol-hercules-f7cce6ac2d1c010af4865212dc6ddc2a7aea66a4.tar.xz
evol-hercules-f7cce6ac2d1c010af4865212dc6ddc2a7aea66a4.zip
Add support for drop script for items dropped by player.
Diffstat (limited to 'src/emap/itemdb.c')
-rw-r--r--src/emap/itemdb.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/emap/itemdb.c b/src/emap/itemdb.c
index a64f857..478d88c 100644
--- a/src/emap/itemdb.c
+++ b/src/emap/itemdb.c
@@ -32,10 +32,12 @@ bool eitemdb_is_item_usable(struct item_data *item)
void eitemdb_readdb_additional_fields(int *itemid,
config_setting_t *it,
int *n __attribute__ ((unused)),
- const char *source __attribute__ ((unused)))
+ const char *source)
{
struct item_data *item = itemdb->exists(*itemid);
int i32 = 0;
+ const char *str = NULL;
+
if (!item)
{
hookStop();
@@ -92,6 +94,9 @@ void eitemdb_readdb_additional_fields(int *itemid,
if (itemdb->lookup_const(it, "UnequipFailEffect", &i32))
data->unequipFailEffect = i32;
+ if (libconfig->setting_lookup_string(it, "OnDropScript", &str))
+ data->dropScript = *str ? script->parse(str, source, -item->nameid, SCRIPT_IGNORE_EXTERNAL_BRACKETS, NULL) : NULL;
+
config_setting_t *group = libconfig->setting_get_member(it, "AllowCards");
if (group)
{
@@ -120,3 +125,13 @@ void eitemdb_readdb_additional_fields(int *itemid,
hookStop();
}
+
+void edestroy_item_data(struct item_data* self, int *free_selfPtr)
+{
+ struct ItemdExt *data = itemd_get(self);
+ if (!data)
+ return;
+
+ if (data->dropScript)
+ script->free_code(data->dropScript);
+}