summaryrefslogtreecommitdiff
path: root/src/emap/mob.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/emap/mob.c')
-rw-r--r--src/emap/mob.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/emap/mob.c b/src/emap/mob.c
index 534e858..f12a936 100644
--- a/src/emap/mob.c
+++ b/src/emap/mob.c
@@ -18,6 +18,7 @@
#include "map/battle.h"
#include "map/itemdb.h"
#include "map/mob.h"
+#include "map/script.h"
#include "plugins/HPMHooking.h"
@@ -199,6 +200,23 @@ static void emob_load_weaponattacks(const char *type,
data->weaponAttacks[key] = val;
}
+static void emob_load_skillattacks(const char *type,
+ int val,
+ struct MobdExt *data,
+ struct mob_db *entry)
+{
+ int skill_id = 0;
+ if (script->get_constant(type, &skill_id))
+ {
+ const int idx = skill->get_index(skill_id);
+ data->skillAttacks[idx] = val;
+ }
+ else
+ {
+ ShowError("Mob %d. Unknown skill name %s\n", entry->mob_id, type);
+ }
+}
+
void emob_read_db_additional_fields_pre(struct mob_db **entryPtr,
struct config_setting_t **itPtr,
int *nPtr __attribute__ ((unused)),
@@ -227,6 +245,18 @@ void emob_read_db_additional_fields_pre(struct mob_db **entryPtr,
emob_load_weaponattacks(config_setting_name(wpt), libconfig->setting_get_int(wpt), data, *entryPtr);
}
}
+
+ tt = libconfig->setting_get_member(*itPtr, "SkillAttacks");
+
+ if (tt && config_setting_is_group(tt))
+ {
+ int j = 0;
+ struct config_setting_t *wpt = NULL;
+ while ((wpt = libconfig->setting_get_elem(tt, j++)) != NULL)
+ {
+ emob_load_skillattacks(config_setting_name(wpt), libconfig->setting_get_int(wpt), data, *entryPtr);
+ }
+ }
}
uint32 emob_read_db_mode_sub_post(uint32 retVal,