summaryrefslogtreecommitdiff
path: root/src/emap
diff options
context:
space:
mode:
Diffstat (limited to 'src/emap')
-rw-r--r--src/emap/data/mobd.c40
-rw-r--r--src/emap/data/mobd.h12
-rw-r--r--src/emap/init.c1
-rw-r--r--src/emap/mob.c21
-rw-r--r--src/emap/mob.h4
-rw-r--r--src/emap/struct/mobdext.h12
6 files changed, 90 insertions, 0 deletions
diff --git a/src/emap/data/mobd.c b/src/emap/data/mobd.c
new file mode 100644
index 0000000..c0dc9ca
--- /dev/null
+++ b/src/emap/data/mobd.c
@@ -0,0 +1,40 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#include "common/hercules.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common/HPMi.h"
+#include "common/malloc.h"
+#include "common/mmo.h"
+#include "common/socket.h"
+#include "common/strlib.h"
+#include "map/battle.h"
+#include "map/mob.h"
+
+#include "emap/data/mobd.h"
+#include "emap/struct/mobdext.h"
+
+struct MobdExt *mobd_get(struct mob_db *md)
+{
+ struct MobdExt *data = getFromMOBDB(md, 0);
+ if (!data)
+ {
+ data = mobd_create();
+ addToMOBDB(md, data, 0, true);
+ }
+ return data;
+}
+
+struct MobdExt *mobd_create(void)
+{
+ struct MobdExt *data = NULL;
+ CREATE(data, struct MobdExt, 1);
+ if (!data)
+ return NULL;
+ data->walkMask = 0;
+ return data;
+}
diff --git a/src/emap/data/mobd.h b/src/emap/data/mobd.h
new file mode 100644
index 0000000..0e93890
--- /dev/null
+++ b/src/emap/data/mobd.h
@@ -0,0 +1,12 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#ifndef EVOL_MAP_MOBD
+#define EVOL_MAP_MOBD
+
+struct MobdExt;
+
+struct MobdExt *mobd_get(struct mob_db *md);
+struct MobdExt *mobd_create(void);
+
+#endif // EVOL_MAP_MOBD
diff --git a/src/emap/init.c b/src/emap/init.c
index 3ec6eab..c19dc07 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -157,6 +157,7 @@ HPExport void plugin_init (void)
addHookPre("pc->check_job_name", epc_check_job_name);
addHookPre("pc->delitem", epc_delitem_pre);
addHookPre("mob->deleteslave_sub", emob_deleteslave_sub);
+ addHookPre("mob->read_db_additional_fields", emob_read_db_additional_fields);
addHookPre("npc->parse_unknown_mapflag", enpc_parse_unknown_mapflag);
addHookPre("npc->buysellsel", enpc_buysellsel);
addHookPre("npc->db_checkid", enpc_db_checkid);
diff --git a/src/emap/mob.c b/src/emap/mob.c
index 7e0a560..eae7901 100644
--- a/src/emap/mob.c
+++ b/src/emap/mob.c
@@ -17,6 +17,9 @@
#include "map/itemdb.h"
#include "map/mob.h"
+#include "emap/data/mobd.h"
+#include "emap/struct/mobdext.h"
+
int emob_deleteslave_sub(struct block_list *bl, va_list ap)
{
if (!bl)
@@ -48,3 +51,21 @@ int emob_deleteslave_sub(struct block_list *bl, va_list ap)
hookStop();
return 0;
}
+
+void emob_read_db_additional_fields(struct mob_db *entry,
+ int *classPtr,
+ config_setting_t *it,
+ int *nPtr, const char *source)
+{
+ int i32 = 0;
+
+ struct MobdExt *data = mobd_get(entry);
+ if (!data)
+ {
+ hookStop();
+ return;
+ }
+
+ if (mob->lookup_const(it, "WalkMask", &i32))
+ data->walkMask = i32;
+}
diff --git a/src/emap/mob.h b/src/emap/mob.h
index b6fc44f..028195f 100644
--- a/src/emap/mob.h
+++ b/src/emap/mob.h
@@ -5,5 +5,9 @@
#define EVOL_MAP_MOB
int emob_deleteslave_sub(struct block_list *bl, va_list ap);
+void emob_read_db_additional_fields(struct mob_db *entry,
+ int *classPtr,
+ config_setting_t *it,
+ int *nPtr, const char *source);
#endif // EVOL_MAP_MOB
diff --git a/src/emap/struct/mobdext.h b/src/emap/struct/mobdext.h
new file mode 100644
index 0000000..ed49e6c
--- /dev/null
+++ b/src/emap/struct/mobdext.h
@@ -0,0 +1,12 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#ifndef EVOL_MAP_MOBDEXT
+#define EVOL_MAP_MOBDEXT
+
+struct MobdExt
+{
+ int walkMask;
+};
+
+#endif // EVOL_MAP_MOBDEXT