summaryrefslogtreecommitdiff
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
parent38efe26b9982a176f89910f9b6b3650558175360 (diff)
downloadevol-hercules-45e89b39985270e12d5f8eb19c666c8fd0562661.tar.gz
evol-hercules-45e89b39985270e12d5f8eb19c666c8fd0562661.tar.bz2
evol-hercules-45e89b39985270e12d5f8eb19c666c8fd0562661.tar.xz
evol-hercules-45e89b39985270e12d5f8eb19c666c8fd0562661.zip
Read card limits from item db.
-rw-r--r--src/emap/data/itemd.c1
-rw-r--r--src/emap/itemdb.c27
-rw-r--r--src/emap/struct/itemdext.h8
3 files changed, 36 insertions, 0 deletions
diff --git a/src/emap/data/itemd.c b/src/emap/data/itemd.c
index 6768ad4..b0300fb 100644
--- a/src/emap/data/itemd.c
+++ b/src/emap/data/itemd.c
@@ -67,5 +67,6 @@ struct ItemdExt *itemd_create(void)
data->unequipEffect = -1;
data->unequipFailEffect = -1;
data->charmItem = false;
+ memset(&data->allowedCards, 0, sizeof(data->allowedCards));
return data;
}
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();
}
diff --git a/src/emap/struct/itemdext.h b/src/emap/struct/itemdext.h
index 0144fbe..1581509 100644
--- a/src/emap/struct/itemdext.h
+++ b/src/emap/struct/itemdext.h
@@ -4,6 +4,12 @@
#ifndef EVOL_MAP_ITEMDEXT
#define EVOL_MAP_ITEMDEXT
+struct ItemCardExt
+{
+ unsigned short id;
+ unsigned short amount;
+};
+
struct ItemdExt
{
int floorLifeTime;
@@ -27,6 +33,8 @@ struct ItemdExt
int unequipEffect;
int unequipFailEffect;
+ struct ItemCardExt allowedCards[100];
+
bool allowPickup;
bool charmItem;
};