summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-10-20 17:53:46 +0300
committerAndrei Karas <akaras@inbox.ru>2015-10-20 17:53:46 +0300
commit0ee555e83376310a07f086df46a277c21f6aa37d (patch)
treedbddc2b3f2cc2de42a58c3023ac4ad461160c898 /src
parent9c4e88cfd0687a2e01522c58f932d3f40d468d6b (diff)
downloadplugin-0ee555e83376310a07f086df46a277c21f6aa37d.tar.gz
plugin-0ee555e83376310a07f086df46a277c21f6aa37d.tar.bz2
plugin-0ee555e83376310a07f086df46a277c21f6aa37d.tar.xz
plugin-0ee555e83376310a07f086df46a277c21f6aa37d.zip
Add support for item attribute RequiredSkill.
Diffstat (limited to 'src')
-rw-r--r--src/emap/data/itemd.c1
-rw-r--r--src/emap/itemdb.c2
-rw-r--r--src/emap/pc.c3
-rw-r--r--src/emap/struct/itemdext.h1
4 files changed, 6 insertions, 1 deletions
diff --git a/src/emap/data/itemd.c b/src/emap/data/itemd.c
index 5e02dea..d5bb26b 100644
--- a/src/emap/data/itemd.c
+++ b/src/emap/data/itemd.c
@@ -62,6 +62,7 @@ struct ItemdExt *itemd_create(void)
data->requiredMAtkMax = 0;
data->requiredDef = 0;
data->requiredMDef = 0;
+ data->requiredSkill = 0;
data->useEffect = -1;
data->useFailEffect = -1;
data->unequipEffect = -1;
diff --git a/src/emap/itemdb.c b/src/emap/itemdb.c
index f79cc7e..63434bf 100644
--- a/src/emap/itemdb.c
+++ b/src/emap/itemdb.c
@@ -82,6 +82,8 @@ void eitemdb_readdb_additional_fields(int *itemid,
data->requiredDef = i32;
if (libconfig->setting_lookup_int(it, "RequiredMDef", &i32) && i32 >= 0)
data->requiredMDef = i32;
+ if (itemdb->lookup_const(it, "RequiredSkill", &i32))
+ data->requiredSkill = i32;
if (libconfig->setting_lookup_bool(it, "Charm", &i32) && i32 >= 0)
data->charmItem = i32 ? true : false;
diff --git a/src/emap/pc.c b/src/emap/pc.c
index 152fabe..ae66edd 100644
--- a/src/emap/pc.c
+++ b/src/emap/pc.c
@@ -285,7 +285,8 @@ int epc_isequip_post(int retVal, struct map_session_data *sd, int *nPtr)
sd->battle_status.matk_min < data->requiredMAtkMin ||
sd->battle_status.matk_max < data->requiredMAtkMax ||
sd->battle_status.def < data->requiredDef ||
- sd->battle_status.mdef < data->requiredMDef
+ sd->battle_status.mdef < data->requiredMDef ||
+ (data->requiredSkill && !pc->checkskill(sd, data->requiredSkill))
)
{
return 0;
diff --git a/src/emap/struct/itemdext.h b/src/emap/struct/itemdext.h
index 5fd7159..6ce3017 100644
--- a/src/emap/struct/itemdext.h
+++ b/src/emap/struct/itemdext.h
@@ -27,6 +27,7 @@ struct ItemdExt
int requiredMAtkMax;
int requiredDef;
int requiredMDef;
+ int requiredSkill;
int useEffect;
int useFailEffect;