summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/emap/data/skilld.c22
-rw-r--r--src/emap/data/skilld.h9
-rw-r--r--src/emap/skill.c73
-rw-r--r--src/emap/skill.h7
-rw-r--r--src/emap/skill_const.c4
-rw-r--r--src/emap/skill_ground.c10
6 files changed, 116 insertions, 9 deletions
diff --git a/src/emap/data/skilld.c b/src/emap/data/skilld.c
index ce39993..d2c355b 100644
--- a/src/emap/data/skilld.c
+++ b/src/emap/data/skilld.c
@@ -20,7 +20,7 @@
struct SkilldExt skilld_arr[MAX_SKILL_DB];
-struct SkilldExt *skilld_init(void)
+void skilld_init(void)
{
for (int f = 0; f < MAX_SKILL_DB; f ++)
{
@@ -31,8 +31,22 @@ struct SkilldExt *skilld_init(void)
}
}
-struct SkilldExt *skilld_get(const int skill_idx)
+struct SkilldExt *skilld_get(const int idx)
{
- Assert_retr(NULL, skill_idx >= 0 && skill_idx < MAX_SKILL_DB);
- return &skilld_arr[skill_idx];
+ Assert_retr(NULL, idx >= 0 && idx < MAX_SKILL_DB);
+ return &skilld_arr[idx];
+}
+
+struct SkilldExt *skilld_get_id(const int skill_id)
+{
+ Assert_retr(NULL, skill_id >= 0 && skill_id < MAX_SKILL_ID);
+ return &skilld_arr[skill->get_index(skill_id)];
+}
+
+int skilld_get_misceffect(const int skill_id,
+ const int effect_idx)
+{
+ Assert_retr(-1, skill_id >= 0 && skill_id < MAX_SKILL_ID);
+ Assert_retr(-1, effect_idx >= 0 && effect_idx < SKILLD_MAXMISCEFFECTS);
+ return skilld_arr[skill->get_index(skill_id)].miscEffects[effect_idx];
}
diff --git a/src/emap/data/skilld.h b/src/emap/data/skilld.h
index 0039c47..042f85f 100644
--- a/src/emap/data/skilld.h
+++ b/src/emap/data/skilld.h
@@ -6,8 +6,13 @@
struct SkilldExt;
-struct SkilldExt *skilld_init(void);
+void skilld_init(void);
-struct SkilldExt *skilld_get(const int skill_idx);
+struct SkilldExt *skilld_get(const int idx);
+
+struct SkilldExt *skilld_get_id(const int skill_id);
+
+int skilld_get_misceffect(const int skill_id,
+ const int effect_idx);
#endif // EVOL_MAP_SKILLD
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;
+ }
+}
diff --git a/src/emap/skill.h b/src/emap/skill.h
index edb533b..c016798 100644
--- a/src/emap/skill.h
+++ b/src/emap/skill.h
@@ -91,4 +91,11 @@ bool eskill_castend_pos2_unknown(struct block_list* src,
int64 *tick,
int *flag);
+void eskill_validate_additional_fields(struct config_setting_t *conf,
+ struct s_skill_db *sk);
+
+bool eskill_lookup_const(const struct config_setting_t *it,
+ const char *name,
+ int *value);
+
#endif // EVOL_MAP_SKILL
diff --git a/src/emap/skill_const.c b/src/emap/skill_const.c
index 1572f78..1684ceb 100644
--- a/src/emap/skill_const.c
+++ b/src/emap/skill_const.c
@@ -5,6 +5,7 @@
#include "map/script.h"
+#include "emap/effects.h"
#include "emap/skill_const.h"
void eskill_addskill_conststants(void)
@@ -12,5 +13,8 @@ void eskill_addskill_conststants(void)
script->constdb_comment("Evol skills");
script->set_constant("EVOL_MASS_PROVOKE", EVOL_MASS_PROVOKE, false, false);
script->set_constant("EVOL_PHYSICAL_SHIELD", EVOL_PHYSICAL_SHIELD, false, false);
+ script->set_constant("EFFECT_PROVOKE", EFFECT_PROVOKE, false, false);
+ script->set_constant("EFFECT_MAGIC_SHIELD", EFFECT_MAGIC_SHIELD, false, false);
+ script->set_constant("EFFECT_MAGIC_SHIELD_ENDS", EFFECT_MAGIC_SHIELD_ENDS, false, false);
script->constdb_comment(NULL);
}
diff --git a/src/emap/skill_ground.c b/src/emap/skill_ground.c
index 4422a8d..344c551 100644
--- a/src/emap/skill_ground.c
+++ b/src/emap/skill_ground.c
@@ -12,8 +12,9 @@
#include "map/mob.h"
#include "map/skill.h"
-#include "emap/effects.h"
#include "emap/skill_ground.h"
+#include "emap/data/skilld.h"
+#include "emap/struct/skilldext.h"
static int eskill_massprovoke_sub(struct block_list *bl,
va_list ap)
@@ -26,6 +27,7 @@ static int eskill_massprovoke_sub(struct block_list *bl,
struct block_list* src = va_arg(ap, struct block_list*);
int dist = va_arg(ap, int);
int *cnt = va_arg(ap, int*);
+ int effect = va_arg(ap, int);
struct status_change *tsc = status->get_sc(bl);
struct mob_data *dstmd = BL_UCAST(BL_MOB, bl);
@@ -42,7 +44,8 @@ static int eskill_massprovoke_sub(struct block_list *bl,
{
dstmd->state.provoke_flag = src->id;
mob->target(dstmd, src, dist);
- clif->misceffect(bl, EFFECT_PROVOKE);
+ if (effect >= 0)
+ clif->misceffect(bl, effect);
(*cnt) ++;
}
@@ -61,8 +64,9 @@ bool eskill_massprovoke_castend(struct block_list* src,
const int r = skill->get_splash(*skill_id, *skill_lv);
const int dist = skill->get_range2(src, *skill_id, *skill_lv);
int cnt = 0;
+ int effect = skilld_get_misceffect(*skill_id, 0);
map->foreachinarea(eskill_massprovoke_sub, src->m, *x - r, *y - r, *x + r, *y + r, BL_MOB,
- src, dist, &cnt);
+ src, dist, &cnt, effect);
if (cnt == 0)
{
unit->skillcastcancel(src, 1);