diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-07-09 23:06:53 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-07-09 23:06:53 +0300 |
commit | 47aa7431432a2d9a41b949af5c2d4d7ab4db3461 (patch) | |
tree | 1e129f1c278413b495d94b811aafa22c61280222 /src/emap/skill.c | |
parent | cdab2778ae73dcad36fbeac8d827732440a321e3 (diff) | |
download | evol-hercules-47aa7431432a2d9a41b949af5c2d4d7ab4db3461.tar.gz evol-hercules-47aa7431432a2d9a41b949af5c2d4d7ab4db3461.tar.bz2 evol-hercules-47aa7431432a2d9a41b949af5c2d4d7ab4db3461.tar.xz evol-hercules-47aa7431432a2d9a41b949af5c2d4d7ab4db3461.zip |
Move misc effect id for mass provoke skill into skills configuration.
Diffstat (limited to 'src/emap/skill.c')
-rw-r--r-- | src/emap/skill.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/emap/skill.c b/src/emap/skill.c index e0040b6..eb177cc 100644 --- a/src/emap/skill.c +++ b/src/emap/skill.c @@ -7,10 +7,12 @@ #include <stdlib.h> #include <string.h> +#include "common/conf.h" #include "common/db.h" #include "common/HPMi.h" #include "common/memmgr.h" #include "common/mmo.h" +#include "common/nullpo.h" #include "common/socket.h" #include "common/strlib.h" #include "common/timer.h" @@ -23,6 +25,8 @@ #include "emap/skill_ground.h" #include "emap/skill_targeted.h" #include "emap/status.h" +#include "emap/data/skilld.h" +#include "emap/struct/skilldext.h" #include "plugins/HPMHooking.h" @@ -185,3 +189,72 @@ bool eskill_castend_pos2_unknown(struct block_list* src, return true; } } + +// probably this function must be implimented in server +bool eskill_lookup_const(const struct config_setting_t *it, + const char *name, + int *value) +{ + nullpo_retr(false, name); + nullpo_retr(false, value); + if (libconfig->setting_lookup_int(it, name, value)) + { + return true; + } + else + { + const char *str = NULL; + if (libconfig->setting_lookup_string(it, name, &str)) + { + if (*str && script->get_constant(str, value)) + return true; + } + } + return false; +} + +void eskill_validate_additional_fields(struct config_setting_t *conf, + struct s_skill_db *sk) +{ + nullpo_retv(conf); + nullpo_retv(sk); + Assert_retv(sk->nameid >= 0 && sk->nameid < MAX_SKILL_ID); + + int i32 = 0; + struct config_setting_t *t = NULL; + struct SkilldExt *skilld = skilld_get_id(sk->nameid); + nullpo_retv(skilld); + + if ((t = libconfig->setting_get_member(conf, "MiscEffects"))) + { + if (config_setting_is_array(t)) + { + for (int i = 0; i < libconfig->setting_length(t) && i < SKILLD_MAXMISCEFFECTS; i++) + { + skilld->miscEffects[i] = libconfig->setting_get_int_elem(t, i); + } + } + else + { + if (eskill_lookup_const(conf, "MiscEffects", &i32) && i32 >= 0) + { + for (int i = 0; i < SKILLD_MAXMISCEFFECTS; i++) + { + skilld->miscEffects[i] = i32; + } + } + } + } + if (eskill_lookup_const(conf, "TargetMiscEffect", &i32) && i32 >= 0) + { + skilld->miscEffects[0] = i32; + } + else if (eskill_lookup_const(conf, "TargetMiscEffect1", &i32) && i32 >= 0) + { + skilld->miscEffects[0] = i32; + } + if (eskill_lookup_const(conf, "TargetMiscEffect2", &i32) && i32 >= 0) + { + skilld->miscEffects[1] = i32; + } +} |