diff options
author | Andrei Karas <akaras@inbox.ru> | 2015-04-02 21:13:09 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2015-04-02 21:13:09 +0300 |
commit | 3a0767592d15288849ad16b6dcd9171af821af33 (patch) | |
tree | b3e1d9f85d05628dd81c10e9692a95674ba2725a /src | |
parent | 373c174b60944567677a9df8d16d845ea0c5ec10 (diff) | |
download | plugin-3a0767592d15288849ad16b6dcd9171af821af33.tar.gz plugin-3a0767592d15288849ad16b6dcd9171af821af33.tar.bz2 plugin-3a0767592d15288849ad16b6dcd9171af821af33.tar.xz plugin-3a0767592d15288849ad16b6dcd9171af821af33.zip |
map: add post hook for checking is possible equip item.
Diffstat (limited to 'src')
-rw-r--r-- | src/map/init.c | 1 | ||||
-rw-r--r-- | src/map/pc.c | 14 | ||||
-rw-r--r-- | src/map/pc.h | 2 |
3 files changed, 17 insertions, 0 deletions
diff --git a/src/map/init.c b/src/map/init.c index a9cc312..4ea0622 100644 --- a/src/map/init.c +++ b/src/map/init.c @@ -156,6 +156,7 @@ HPExport void plugin_init (void) addHookPost("clif->move", eclif_move); addHookPost("map->addflooritem", emap_addflooritem_post); addHookPost("skill->check_condition_castend", eskill_check_condition_castend_post); + addHookPost("pc->isequip", epc_isequip_post); langScriptId = script->add_str("Lang"); } diff --git a/src/map/pc.c b/src/map/pc.c index 594b1c0..a914653 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -187,3 +187,17 @@ void epc_validate_levels(void) } hookStop(); } + +int epc_isequip_post(int retVal, struct map_session_data *sd, int *nPtr) +{ + const int n = *nPtr; + if (retVal) + { + if (!sd) + return 0; + + if (n < 0 || n >= MAX_INVENTORY) + return 0; + } + return retVal; +} diff --git a/src/map/pc.h b/src/map/pc.h index 8b1bd7e..dd6572c 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -23,4 +23,6 @@ int epc_takeitem(TBL_PC *sd, TBL_ITEM *fitem); void epc_validate_levels(void); +int epc_isequip_post(int retVal, struct map_session_data *sd, int *nPtr); + #endif // EVOL_MAP_PC |