diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-04-02 22:20:20 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-02 22:20:20 +0300 |
commit | 402cbb4310059bc37ffc2825b83a1659200bf12c (patch) | |
tree | 56faf21a6f91041fe25b9e6da31b66060e7c4f9c | |
parent | 3a0767592d15288849ad16b6dcd9171af821af33 (diff) | |
download | plugin-402cbb4310059bc37ffc2825b83a1659200bf12c.tar.gz plugin-402cbb4310059bc37ffc2825b83a1659200bf12c.tar.bz2 plugin-402cbb4310059bc37ffc2825b83a1659200bf12c.tar.xz plugin-402cbb4310059bc37ffc2825b83a1659200bf12c.zip |
Add item_db attributes for limit item usage.
Added attributesRequiredStr, RequiredAgi, RequiredVit, RequiredInt,
RequiredDex, RequiredLuk.
Check this attributes before equip item.
-rw-r--r-- | src/map/data/itemd.c | 6 | ||||
-rw-r--r-- | src/map/itemdb.c | 12 | ||||
-rw-r--r-- | src/map/pc.c | 14 | ||||
-rw-r--r-- | src/map/struct/itemdext.h | 6 |
4 files changed, 38 insertions, 0 deletions
diff --git a/src/map/data/itemd.c b/src/map/data/itemd.c index 759bd63..671c8e5 100644 --- a/src/map/data/itemd.c +++ b/src/map/data/itemd.c @@ -47,5 +47,11 @@ struct ItemdExt *itemd_create(void) return NULL; data->floorLifeTime = battle->bc->flooritem_lifetime; data->allowPickup = true; + data->requiredStr = 0; + data->requiredAgi = 0; + data->requiredVit = 0; + data->requiredInt = 0; + data->requiredDex = 0; + data->requiredLuk = 0; return data; } diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 6fb9f02..fcce487 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -52,6 +52,18 @@ void eitemdb_readdb_additional_fields(int *itemid, data->floorLifeTime = i32; if ((t = libconfig->setting_get_member(it, "AllowPickup"))) data->allowPickup = libconfig->setting_get_bool(t) ? 1 : 0; + if (libconfig->setting_lookup_int(it, "RequiredStr", &i32) && i32 >= 0) + data->requiredStr = i32; + if (libconfig->setting_lookup_int(it, "RequiredAgi", &i32) && i32 >= 0) + data->requiredAgi = i32; + if (libconfig->setting_lookup_int(it, "RequiredVit", &i32) && i32 >= 0) + data->requiredVit = i32; + if (libconfig->setting_lookup_int(it, "RequiredInt", &i32) && i32 >= 0) + data->requiredInt = i32; + if (libconfig->setting_lookup_int(it, "RequiredDex", &i32) && i32 >= 0) + data->requiredDex = i32; + if (libconfig->setting_lookup_int(it, "RequiredLuk", &i32) && i32 >= 0) + data->requiredLuk = i32; hookStop(); } diff --git a/src/map/pc.c b/src/map/pc.c index a914653..d51cc2a 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -198,6 +198,20 @@ int epc_isequip_post(int retVal, struct map_session_data *sd, int *nPtr) if (n < 0 || n >= MAX_INVENTORY) return 0; + + struct ItemdExt *data = itemd_get(sd->inventory_data[n]); + if (!data) + return 1; + + if (sd->battle_status.str < data->requiredStr || + sd->battle_status.agi < data->requiredAgi || + sd->battle_status.vit < data->requiredVit || + sd->battle_status.int_ < data->requiredInt || + sd->battle_status.dex < data->requiredDex || + sd->battle_status.luk < data->requiredLuk) + { + return 0; + } } return retVal; } diff --git a/src/map/struct/itemdext.h b/src/map/struct/itemdext.h index 4dce554..bf60e8b 100644 --- a/src/map/struct/itemdext.h +++ b/src/map/struct/itemdext.h @@ -7,6 +7,12 @@ struct ItemdExt { int floorLifeTime; + int requiredStr; + int requiredAgi; + int requiredVit; + int requiredInt; + int requiredDex; + int requiredLuk; bool allowPickup; }; |