From c3262df069c597bd3c56e167cadc077c077d0096 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 8 Mar 2018 00:13:58 +0300 Subject: Add support for identified attribute in item_db.conf. This attribute set on dropped equipment by mobs. Default value true. --- src/emap/data/itemd.c | 1 + src/emap/init.c | 2 ++ src/emap/itemdb.c | 24 ++++++++++++++++++++++++ src/emap/itemdb.h | 4 ++++ src/emap/struct/itemdext.h | 1 + 5 files changed, 32 insertions(+) (limited to 'src/emap') diff --git a/src/emap/data/itemd.c b/src/emap/data/itemd.c index 146557e..a97903c 100644 --- a/src/emap/data/itemd.c +++ b/src/emap/data/itemd.c @@ -49,6 +49,7 @@ struct ItemdExt *itemd_create(void) return NULL; data->floorLifeTime = battle->bc->flooritem_lifetime; data->allowPickup = true; + data->identified = true; data->requiredStr = 0; data->requiredAgi = 0; data->requiredVit = 0; diff --git a/src/emap/init.c b/src/emap/init.c index ecd0de9..fefbc6c 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -347,6 +347,8 @@ HPExport void plugin_init (void) clif->pWalkToXY = eclif_parse_WalkToXY; clif->pNpcStringInput = eclif_parse_NpcStringInput; pc->jobchange = epc_jobchange; + itemdb->isidentified = eitemdb_isidentified; + itemdb->isidentified2 = eitemdb_isidentified2; langScriptId = script->add_str("Lang"); mountScriptId = script->add_str("mount"); diff --git a/src/emap/itemdb.c b/src/emap/itemdb.c index eefb4b1..d9ff7d8 100644 --- a/src/emap/itemdb.c +++ b/src/emap/itemdb.c @@ -12,6 +12,7 @@ #include "common/db.h" #include "common/memmgr.h" #include "common/mmo.h" +#include "common/nullpo.h" #include "common/socket.h" #include "common/strlib.h" #include "map/itemdb.h" @@ -93,6 +94,8 @@ void eitemdb_readdb_additional_fields_pre(int *itemid, data->requiredSkill = i32; if (libconfig->setting_lookup_bool(it, "Charm", &i32) && i32 >= 0) data->charmItem = i32 ? true : false; + if (libconfig->setting_lookup_bool(it, "Identified", &i32) && i32 >= 0) + data->identified = i32 ? true : false; if ((t = libconfig->setting_get_member(it, "MaxFloorOffset"))) { if (config_setting_is_aggregate(t)) @@ -213,3 +216,24 @@ void edestroy_item_data_pre(struct item_data **selfPtr, VECTOR_CLEAR(data->allowedCards); VECTOR_CLEAR(data->allowedAmmo); } + +int eitemdb_isidentified(int nameid) +{ + struct item_data *item = itemdb->exists(nameid); + nullpo_ret(item); + + struct ItemdExt *data = itemd_get(item); + if (!data) + return 0; + return data->identified; +} + +int eitemdb_isidentified2(struct item_data *item) +{ + nullpo_ret(item); + + struct ItemdExt *data = itemd_get(item); + if (!data) + return 0; + return data->identified; +} diff --git a/src/emap/itemdb.h b/src/emap/itemdb.h index 02fbb45..ce6279a 100644 --- a/src/emap/itemdb.h +++ b/src/emap/itemdb.h @@ -12,4 +12,8 @@ void eitemdb_readdb_additional_fields_pre(int *itemid, void edestroy_item_data_pre(struct item_data **selfPtr, int *free_selfPtr); +int eitemdb_isidentified(int nameid); + +int eitemdb_isidentified2(struct item_data *item); + #endif // EVOL_MAP_ITEMDB diff --git a/src/emap/struct/itemdext.h b/src/emap/struct/itemdext.h index 65f0729..ccc4773 100644 --- a/src/emap/struct/itemdext.h +++ b/src/emap/struct/itemdext.h @@ -48,6 +48,7 @@ struct ItemdExt int16_t subY; bool allowPickup; bool charmItem; + bool identified; }; #endif // EVOL_MAP_ITEMDEXT -- cgit v1.2.3-70-g09d2