From 1e49a9dd41900d045c94ebfe34909fa9e4dba32f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 31 Jul 2016 21:26:22 +0300 Subject: Add into item_db.conf support for attribute AllowAmmo for bows. This allow limit any arrow/ammo for any bows/guns. --- src/emap/itemdb.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/emap/itemdb.c') diff --git a/src/emap/itemdb.c b/src/emap/itemdb.c index 3a90eab..63daca0 100644 --- a/src/emap/itemdb.c +++ b/src/emap/itemdb.c @@ -167,6 +167,23 @@ void eitemdb_readdb_additional_fields_pre(int *itemid, } } + group = libconfig->setting_get_member(it, "AllowAmmo"); + if (group) + { + int idx = 0; + struct config_setting_t *it2 = NULL; + int cnt = VECTOR_LENGTH(data->allowedAmmo); + while ((it2 = libconfig->setting_get_elem(group, idx ++))) + { + const char *name = config_setting_name(it2); + if (name && strncmp(name, "id", 2) && strncmp(name, "Id", 2)) + continue; + VECTOR_ENSURE(data->allowedAmmo, cnt + 1, 1); + VECTOR_PUSH(data->allowedAmmo, atoi(name + 2)); + cnt ++; + } + } + hookStop(); } -- cgit v1.2.3-60-g2f50