diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/emap/init.c | 1 | ||||
-rw-r--r-- | src/emap/pc.c | 23 | ||||
-rw-r--r-- | src/emap/pc.h | 5 | ||||
-rw-r--r-- | src/emap/script.c | 6 |
4 files changed, 35 insertions, 0 deletions
diff --git a/src/emap/init.c b/src/emap/init.c index 19eaea5..a4902ba 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -270,6 +270,7 @@ HPExport void plugin_init (void) addHookPre(battle, weapon_attack, ebattle_weapon_attack_pre); addHookPre(bg, team_warp, ebg_team_warp_pre); addHookPre(pc, can_Adopt, epc_can_Adopt_pre); + addHookPre(pc, additem, epc_additem_pre); addHookPre(pc, adoption, epc_adoption_pre); addHookPre(pc, readparam, epc_readparam_pre); addHookPre(pc, setparam, epc_setparam_pre); diff --git a/src/emap/pc.c b/src/emap/pc.c index d719173..68b892c 100644 --- a/src/emap/pc.c +++ b/src/emap/pc.c @@ -461,6 +461,29 @@ int epc_setnewpc_post(int retVal, return retVal; } +int epc_additem_pre(struct map_session_data **sdPtr __attribute__ ((unused)), + const struct item **item_dataPtr, + int *amountPtr __attribute__ ((unused)), + e_log_pick_type *log_typePtr __attribute__ ((unused))) +{ +#ifndef IT_VIRTUAL + return 0; +#endif + + const struct item *item_data = *item_dataPtr; + + if (item_data != NULL) { + struct item_data *data = itemdb->search(item_data->nameid); + + if (data != NULL && data->type == IT_VIRTUAL) { + hookStop(); + return 1; + } + } + + return 0; +} + int epc_additem_post(int retVal, struct map_session_data *sd, const struct item *item_data, diff --git a/src/emap/pc.h b/src/emap/pc.h index db1a912..1cbd3c1 100644 --- a/src/emap/pc.h +++ b/src/emap/pc.h @@ -63,6 +63,11 @@ int epc_setnewpc_post(int retVal, int sex, int fd); +int epc_additem_pre(struct map_session_data **sdPtr, + const struct item **item_dataPtr, + int *amountPtr, + e_log_pick_type *log_typePtr); + int epc_additem_post(int retVal, struct map_session_data *sd, const struct item *item_data, diff --git a/src/emap/script.c b/src/emap/script.c index d2a64e4..778ebe0 100644 --- a/src/emap/script.c +++ b/src/emap/script.c @@ -109,6 +109,12 @@ void escript_hardcoded_constants_pre(void) script->set_constant("NPCSUBTYPE_SCRIPT", SCRIPT, false, false); script->set_constant("NPCSUBTYPE_CASHSHOP", CASHSHOP, false, false); script->set_constant("NPCSUBTYPE_TOMB", TOMB, false, false); + + // new item types +#ifdef IT_VIRTUAL + script->set_constant("IT_VIRTUAL", IT_VIRTUAL, false, false); +#endif + script->constdb_comment(NULL); eskill_addskill_conststants(); } |