summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-11-29 01:07:45 +0300
committerAndrei Karas <akaras@inbox.ru>2014-11-29 01:07:45 +0300
commit2fbf69ebe75abceb55a66b62bfd4220d3833108d (patch)
tree831447a229257b7a04b62e905d535d38dee2027d /src/map
parent99875f9bf3b221ff507e507eeb9f50f4313c32b7 (diff)
downloadevol-hercules-2fbf69ebe75abceb55a66b62bfd4220d3833108d.tar.gz
evol-hercules-2fbf69ebe75abceb55a66b62bfd4220d3833108d.tar.bz2
evol-hercules-2fbf69ebe75abceb55a66b62bfd4220d3833108d.tar.xz
evol-hercules-2fbf69ebe75abceb55a66b62bfd4220d3833108d.zip
Set default npc gender to 3 (no gender).
Diffstat (limited to 'src/map')
-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
6 files changed, 52 insertions, 6 deletions
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