summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Makefile.am3
-rw-r--r--src/map/data/npcd.c9
-rw-r--r--src/map/data/npcd.h2
-rw-r--r--src/map/init.c4
-rw-r--r--src/map/status.c33
-rw-r--r--src/map/status.h9
-rw-r--r--src/map/struct/npcdext.h1
7 files changed, 55 insertions, 6 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index a4956e2..7ed1330 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -32,8 +32,11 @@ MAP_SRC = map/clif.c \
map/scriptdefines.h \
map/send.c \
map/send.h \
+ map/status.c \
+ map/status.h \
map/data/mapd.c \
map/data/mapd.h \
+ map/data/npcd.c \
map/data/npcd.h \
map/data/session.c \
map/data/session.h \
diff --git a/src/map/data/npcd.c b/src/map/data/npcd.c
index 8d770e7..29e48a7 100644
--- a/src/map/data/npcd.c
+++ b/src/map/data/npcd.c
@@ -10,27 +10,28 @@
#include "../../../common/mmo.h"
#include "../../../common/socket.h"
#include "../../../common/strlib.h"
+#include "../../../map/npc.h"
#include "map/data/npcd.h"
#include "map/struct/npcdext.h"
-struct NpcdExt *mapd_get(npc_data *nd)
+struct NpcdExt *npcd_get(struct npc_data *nd)
{
struct NpcdExt *data = getFromNPCD(nd, 0);
if (!data)
{
- data = mapd_create();
+ data = npcd_create();
addToNPCD(nd, data, 0, true);
}
return data;
}
-struct NpcdExt *mapd_create(void)
+struct NpcdExt *npcd_create(void)
{
struct NpcdExt *data = NULL;
CREATE(data, struct NpcdExt, 1);
if (!data)
return NULL;
-// data->x = y;
+ data->init = false;
return data;
}
diff --git a/src/map/data/npcd.h b/src/map/data/npcd.h
index dacd861..986e793 100644
--- a/src/map/data/npcd.h
+++ b/src/map/data/npcd.h
@@ -6,7 +6,7 @@
struct NpcdExt;
-struct NpcdExt *npcd_get(int fd);
+struct NpcdExt *npcd_get(struct npc_data *nd);
struct NpcdExt *npcd_create(void);
#endif // EVOL_MAP_NPCD
diff --git a/src/map/init.c b/src/map/init.c
index 361f019..bb3d80a 100644
--- a/src/map/init.c
+++ b/src/map/init.c
@@ -38,9 +38,10 @@
#include "map/lang.h"
#include "map/npc.h"
#include "map/parse.h"
-#include "map/script.h"
#include "map/pc.h"
#include "map/quest.h"
+#include "map/script.h"
+#include "map/status.h"
#include "../../../common/HPMDataCheck.h" /* should always be the last file included! (if you don't make it last, it'll intentionally break compile time) */
@@ -101,6 +102,7 @@ HPExport void plugin_init (void)
addHookPost("clif->getareachar_unit", eclif_getareachar_unit_post);
addHookPost("clif->authok", eclif_authok_post);
addHookPost("clif->changemap", eclif_changemap_post);
+ addHookPost("status->set_viewdata", estatus_set_viewdata_post);
langScriptId = script->add_str("Lang");
}
diff --git a/src/map/status.c b/src/map/status.c
new file mode 100644
index 0000000..8bb6ead
--- /dev/null
+++ b/src/map/status.c
@@ -0,0 +1,33 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#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/map.h"
+#include "../../../map/npc.h"
+#include "../../../map/status.h"
+
+#include "map/data/npcd.h"
+#include "map/struct/npcdext.h"
+
+void estatus_set_viewdata_post(struct block_list *bl, int *class_)
+{
+ if (!bl)
+ return;
+ if (bl->type != BL_NPC)
+ return;
+ TBL_NPC *const npc = (TBL_NPC*)bl;
+ struct NpcdExt *data = npcd_get(npc);
+ if (data && data->init == false && npc->vd)
+ {
+ data->init = true;
+ npc->vd->sex = 3;
+ }
+}
diff --git a/src/map/status.h b/src/map/status.h
new file mode 100644
index 0000000..ed22d4d
--- /dev/null
+++ b/src/map/status.h
@@ -0,0 +1,9 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 Evol developers
+
+#ifndef EVOL_MAP_STATUS
+#define EVOL_MAP_STATUS
+
+void estatus_set_viewdata_post(struct block_list *bl, int *class_);
+
+#endif // EVOL_MAP_STATUS
diff --git a/src/map/struct/npcdext.h b/src/map/struct/npcdext.h
index 11f9752..2158f2c 100644
--- a/src/map/struct/npcdext.h
+++ b/src/map/struct/npcdext.h
@@ -6,6 +6,7 @@
struct NpcdExt
{
+ bool init;
};
#endif // EVOL_MAP_NPCDEXT