summaryrefslogtreecommitdiff
path: root/src/emap/itemdb.c
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-08-17 17:55:24 +0300
committerAndrei Karas <akaras@inbox.ru>2015-08-17 17:55:24 +0300
commit45e89b39985270e12d5f8eb19c666c8fd0562661 (patch)
treeac6489310ab4e6e5804f8930a6346472d1cfee32 /src/emap/itemdb.c
parent38efe26b9982a176f89910f9b6b3650558175360 (diff)
downloadplugin-45e89b39985270e12d5f8eb19c666c8fd0562661.tar.gz
plugin-45e89b39985270e12d5f8eb19c666c8fd0562661.tar.bz2
plugin-45e89b39985270e12d5f8eb19c666c8fd0562661.tar.xz
plugin-45e89b39985270e12d5f8eb19c666c8fd0562661.zip
Read card limits from item db.
Diffstat (limited to 'src/emap/itemdb.c')
-rw-r--r--src/emap/itemdb.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/emap/itemdb.c b/src/emap/itemdb.c
index 522e405..4408c34 100644
--- a/src/emap/itemdb.c
+++ b/src/emap/itemdb.c
@@ -91,5 +91,32 @@ void eitemdb_readdb_additional_fields(int *itemid,
data->unequipEffect = i32;
if (itemdb->lookup_const(it, "UnequipFailEffect", &i32))
data->unequipFailEffect = i32;
+
+ config_setting_t *group = libconfig->setting_get_member(it, "AllowCards");
+ if (group)
+ {
+ int idx = 0;
+ config_setting_t *it2 = NULL;
+ int cnt = 0;
+ 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;
+ const int val = libconfig->setting_get_int(it2);
+ if (name)
+ {
+ data->allowedCards[cnt].id = atoi(name + 2);
+ data->allowedCards[cnt].amount = val;
+ }
+ else
+ {
+ data->allowedCards[cnt].id = val;
+ data->allowedCards[cnt].amount = 1;
+ }
+ cnt ++;
+ }
+ }
+
hookStop();
}