diff options
author | shennetsind <ind@henn.et> | 2013-10-18 17:52:51 -0300 |
---|---|---|
committer | shennetsind <ind@henn.et> | 2013-10-18 17:52:51 -0300 |
commit | cd780e51999c6efa1084e6b41ba0efcaaa347b9e (patch) | |
tree | 9dff5abb461621d2176272767fb2a95ffeb72d7d /src | |
parent | 6053c8d3d8f8fe27e4ab53a29ef20688e2ca62b0 (diff) | |
download | hercules-cd780e51999c6efa1084e6b41ba0efcaaa347b9e.tar.gz hercules-cd780e51999c6efa1084e6b41ba0efcaaa347b9e.tar.bz2 hercules-cd780e51999c6efa1084e6b41ba0efcaaa347b9e.tar.xz hercules-cd780e51999c6efa1084e6b41ba0efcaaa347b9e.zip |
Minor HPM Update
Attempting to hook to a unknown hooking point will now display a message.
Added support for item bonuses
Check https://github.com/HerculesWS/StaffPlugins/tree/master/shennetsind/bCoolDownRate for a demonstration.
Signed-off-by: shennetsind <ind@henn.et>
Diffstat (limited to 'src')
-rw-r--r-- | src/common/HPM.c | 3 | ||||
-rw-r--r-- | src/map/map.c | 8 | ||||
-rw-r--r-- | src/map/map.h | 9 |
3 files changed, 19 insertions, 1 deletions
diff --git a/src/common/HPM.c b/src/common/HPM.c index 8be9298f9..e7ab94687 100644 --- a/src/common/HPM.c +++ b/src/common/HPM.c @@ -471,6 +471,9 @@ bool HPM_AddHook(enum HPluginHookType type, const char *target, void *hook, unsi /* if not check if a sub-hooking list is available (from the server) and run it by */ if( HPM->addhook_sub && HPM->addhook_sub(type,target,hook,pID) ) return true; + + ShowError("HPM:AddHook: unknown Hooking Point '%s'!\n",target); + return false; } void HPM_HookStop (const char *func, unsigned int pID) { diff --git a/src/map/map.c b/src/map/map.c index 14a9b4908..91871e58f 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -4954,6 +4954,10 @@ void read_map_zone_db(void) { } } +int map_get_new_bonus_id (void) { + return map->bonus_id++; +} + /** * @see DBApply */ @@ -5648,6 +5652,8 @@ void map_defaults(void) { map->cache_buffer = NULL; map->flooritem_ers = NULL; + /* */ + map->bonus_id = SP_LAST_KNOWN; /* funcs */ map->zone_init = map_zone_init; map->zone_remove = map_zone_remove; @@ -5814,6 +5820,8 @@ void map_defaults(void) { map->addblcell = map_addblcell; map->delblcell = map_delblcell; + + map->get_new_bonus_id = map_get_new_bonus_id; /** * mapit interface diff --git a/src/map/map.h b/src/map/map.h index 97c7a9d7d..83d5aa5a8 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -406,7 +406,11 @@ enum _sp { SP_ADD_SKILL_BLOW, SP_SP_VANISH_RATE, SP_MAGIC_SP_GAIN_VALUE, SP_MAGIC_HP_GAIN_VALUE, SP_ADD_CLASS_DROP_ITEM, //2041-2045 SP_EMATK, SP_SP_GAIN_RACE_ATTACK, SP_HP_GAIN_RACE_ATTACK, SP_SKILL_USE_SP_RATE, //2046-2049 SP_SKILL_COOLDOWN,SP_SKILL_FIXEDCAST, SP_SKILL_VARIABLECAST, SP_FIXCASTRATE, SP_VARCASTRATE, //2050-2054 - SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE, SP_ADD_FIXEDCAST, SP_ADD_VARIABLECAST //2055-2058 + SP_SKILL_USE_SP,SP_MAGIC_ATK_ELE, SP_ADD_FIXEDCAST, SP_ADD_VARIABLECAST, //2055-2058 + + + /* must be the last, plugins add bonuses from this value onwards */ + SP_LAST_KNOWN, }; enum _look { @@ -856,6 +860,8 @@ struct map_interface { char *cache_buffer; // Has the uncompressed gat data of all maps, so just one allocation has to be made /* */ struct eri *flooritem_ers; + /* */ + int bonus_id; /* funcs */ void (*zone_init) (void); void (*zone_remove) (int m); @@ -1022,6 +1028,7 @@ struct map_interface { bool (*arg_next_value) (const char *option, int i, int argc); void (*addblcell) (struct block_list *bl); void (*delblcell) (struct block_list *bl); + int (*get_new_bonus_id) (void); }; struct map_interface *map; |