From 2fbf69ebe75abceb55a66b62bfd4220d3833108d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 29 Nov 2014 01:07:45 +0300 Subject: Set default npc gender to 3 (no gender). --- src/map/data/npcd.c | 9 +++++---- src/map/data/npcd.h | 2 +- src/map/init.c | 4 +++- src/map/status.c | 33 +++++++++++++++++++++++++++++++++ src/map/status.h | 9 +++++++++ src/map/struct/npcdext.h | 1 + 6 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 src/map/status.c create mode 100644 src/map/status.h (limited to 'src/map') 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 +#include +#include + +#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 -- cgit v1.2.3-60-g2f50