From fd90aa5bbfa75f4d995e92b10a93ce7ac11e05ba Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Sun, 26 Apr 2020 12:11:18 -0300 Subject: Prototype --- src/emap/init.c | 1 + src/emap/skill.c | 20 ++++++++++++++++++++ src/emap/skill.h | 4 ++++ 3 files changed, 25 insertions(+) diff --git a/src/emap/init.c b/src/emap/init.c index 6bfdfa7..45a44cb 100644 --- a/src/emap/init.c +++ b/src/emap/init.c @@ -341,6 +341,7 @@ HPExport void plugin_init (void) addHookPre(script, load_parameters, escript_load_parameters_pre); addHookPre(script, hardcoded_constants, escript_hardcoded_constants_pre); addHookPre(script, run_use_script, escript_run_use_script_pre); + addHookPre(skill, check_condition_castbegin, eskill_check_condition_castbegin_pre); addHookPre(status, calc_pc_additional, estatus_calc_pc_additional_pre); addHookPre(status, calc_pc_recover_hp, estatus_calc_pc_recover_hp_pre); addHookPre(homun, gainexp, ehomunculus_gainexp_pre); diff --git a/src/emap/skill.c b/src/emap/skill.c index 20e4a82..57319ea 100644 --- a/src/emap/skill.c +++ b/src/emap/skill.c @@ -259,3 +259,23 @@ void eskill_validate_additional_fields(struct config_setting_t *conf, skilld->miscEffects[1] = i32; } } +int eskill_check_condition_castbegin_pre(struct map_session_data **sd, + uint16 *skill_id, + uint16 *skill_lv __attribute__ ((unused))) +{ + ShowWarning("calling skill"); + if( pc_is90overweight(*sd) ) { + clif->skill_fail(*sd, *skill_id, USESKILL_FAIL_WEIGHTOVER, 0, 0); + return 0; + } + switch( *skill_id ) { + case GD_BATTLEORDER: + case GD_REGENERATION: + case GD_RESTORE: + ShowWarning("STOP"); + hookStop(); + return 1; + } + ShowWarning("continue"); + return 0; +} diff --git a/src/emap/skill.h b/src/emap/skill.h index 51d7224..2c924b7 100644 --- a/src/emap/skill.h +++ b/src/emap/skill.h @@ -98,4 +98,8 @@ bool eskill_lookup_const(const struct config_setting_t *it, const char *name, int *value); +int eskill_check_condition_castbegin_pre(struct map_session_data **sd, + uint16 *skill_id, + uint16 *skill_lv __attribute__ ((unused))); + #endif // EVOL_MAP_SKILL -- cgit v1.2.3-70-g09d2