From 5a02643ceb1d8b866d5b683e312397084894a673 Mon Sep 17 00:00:00 2001
From: Asheraf <acheraf1998@gmail.com>
Date: Tue, 29 Oct 2019 14:25:10 +0100
Subject: Add support for overriding default view data in mob database

---
 db/pre-re/mob_db.conf | 15 ++++++++++++
 db/re/mob_db.conf     | 15 ++++++++++++
 doc/mob_db.txt        | 23 ++++++++++++++++++
 src/map/mob.c         | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++
 src/map/mob.h         |  1 +
 5 files changed, 121 insertions(+)

diff --git a/db/pre-re/mob_db.conf b/db/pre-re/mob_db.conf
index 565167e95..70edd12e9 100644
--- a/db/pre-re/mob_db.conf
+++ b/db/pre-re/mob_db.conf
@@ -94,6 +94,21 @@ mob_db: (
 		// ...
 	}
 	DamageTakenRate: damage taken rate    (int, defaults to 100)
+	ViewData: {
+		SpriteId: sprite id              (int, defaults to Id)
+		WeaponId: weapon id              (int, defaults to 0)
+		ShieldId: shield id              (int, defaults to 0)
+		RobeId: garment id               (int, defaults to 0)
+		HeadTopId: top headgear id       (int, defaults to 0)
+		HeadMidId: middle headgear id    (int, defaults to 0)
+		HeadLowId: lower headgear id     (int, defaults to 0)
+		HairStyleId: hair style id       (int, defaults to 0)
+		BodyStyleId: clothes id          (int, defaults to 0)
+		HairColorId: hair color id       (int, defaults to 0)
+		BodyColorId: clothes color id    (int, defaults to 0)
+		Gender: gender                   (string, defaults to "SEX_FEMALE")
+		Options: options                 (int, defaults to 0)
+	}
 },
 **************************************************************************/
 
diff --git a/db/re/mob_db.conf b/db/re/mob_db.conf
index 95645abe6..89bcffb3e 100644
--- a/db/re/mob_db.conf
+++ b/db/re/mob_db.conf
@@ -94,6 +94,21 @@ mob_db: (
 		// ...
 	}
 	DamageTakenRate: damage taken rate    (int, defaults to 100)
+	ViewData: {
+		SpriteId: sprite id              (int, defaults to Id)
+		WeaponId: weapon id              (int, defaults to 0)
+		ShieldId: shield id              (int, defaults to 0)
+		RobeId: garment id               (int, defaults to 0)
+		HeadTopId: top headgear id       (int, defaults to 0)
+		HeadMidId: middle headgear id    (int, defaults to 0)
+		HeadLowId: lower headgear id     (int, defaults to 0)
+		HairStyleId: hair style id       (int, defaults to 0)
+		BodyStyleId: clothes id          (int, defaults to 0)
+		HairColorId: hair color id       (int, defaults to 0)
+		BodyColorId: clothes color id    (int, defaults to 0)
+		Gender: gender                   (string, defaults to "SEX_FEMALE")
+		Options: options                 (int, defaults to 0)
+	}
 },
 **************************************************************************/
 
diff --git a/doc/mob_db.txt b/doc/mob_db.txt
index d62181048..53d345255 100644
--- a/doc/mob_db.txt
+++ b/doc/mob_db.txt
@@ -73,6 +73,22 @@ mob_db: (
 		AegisName: (chance, "Option Drop Group")
 		// ...
 	}
+  DamageTakenRate: damage taken rate    (int, defaults to 100)
+  ViewData: {
+    SpriteId: sprite id              (int, defaults to Id)
+    WeaponId: weapon id              (int, defaults to 0)
+    ShieldId: shield id              (int, defaults to 0)
+    RobeId: garment id               (int, defaults to 0)
+    HeadTopId: top headgear id       (int, defaults to 0)
+    HeadMidId: middle headgear id    (int, defaults to 0)
+    HeadLowId: lower headgear id     (int, defaults to 0)
+    HairStyleId: hair style id       (int, defaults to 0)
+    BodyStyleId: clothes id          (int, defaults to 0)
+    HairColorId: hair color id       (int, defaults to 0)
+    BodyColorId: clothes color id    (int, defaults to 0)
+    Gender: gender                   (string, defaults to "SEX_FEMALE")
+    Options: options                 (int, defaults to 0)
+  }
 },
 ...
 )
@@ -255,3 +271,10 @@ Drops: Sets monster drops list.
 	   }
 
 	   When not specified, becomes false (no drops).
+
+DamageTakenRate:
+  Limit the total damage received by the monster to the given rate
+
+ViewData:
+  Overrides the default view data sent to the client with the given values for:
+    Sprite, Weapon, Shield, Robe, HeadTop, HeadMid, HeadLow, HairStyle, BodyStyle, HairColor, BodyColor, Gender, Options
diff --git a/src/map/mob.c b/src/map/mob.c
index 2ea189c23..54c83964f 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -4170,6 +4170,50 @@ static void mob_read_db_stats_sub(struct mob_db *entry, struct config_setting_t
 	}
 }
 
+/**
+ * Processes the view data for a mob_db entry.
+ *
+ * @param[in,out] entry The destination mob_db entry, already initialized
+ *                      (mob_id, status.mode are expected to be already set).
+ * @param[in]     t     The libconfig entry.
+ */
+static void mob_read_db_viewdata_sub(struct mob_db *entry, struct config_setting_t *t)
+{
+	nullpo_retv(entry);
+	nullpo_retv(t);
+
+	struct config_setting_t *it;
+	int i32;
+
+	if ((it = libconfig->setting_get_member(t, "SpriteId")) != NULL)
+		entry->vd.class = libconfig->setting_get_int(it);
+	if ((it = libconfig->setting_get_member(t, "WeaponId")) != NULL)
+		entry->vd.weapon = libconfig->setting_get_int(it);
+	if ((it = libconfig->setting_get_member(t, "ShieldId")) != NULL)
+		entry->vd.shield = libconfig->setting_get_int(it);
+	if ((it = libconfig->setting_get_member(t, "RobeId")) != NULL)
+		entry->vd.robe = libconfig->setting_get_int(it);
+	if ((it = libconfig->setting_get_member(t, "HeadTopId")) != NULL)
+		entry->vd.head_top = libconfig->setting_get_int(it);
+	if ((it = libconfig->setting_get_member(t, "HeadMidId")) != NULL)
+		entry->vd.head_mid = libconfig->setting_get_int(it);
+	if ((it = libconfig->setting_get_member(t, "HeadLowId")) != NULL)
+		entry->vd.head_bottom = libconfig->setting_get_int(it);
+	if ((it = libconfig->setting_get_member(t, "HairStyleId")) != NULL)
+		entry->vd.hair_style = libconfig->setting_get_int(it);
+	if ((it = libconfig->setting_get_member(t, "BodyStyleId")) != NULL)
+		entry->vd.body_style = libconfig->setting_get_int(it);
+	if ((it = libconfig->setting_get_member(t, "HairColorId")) != NULL)
+		entry->vd.hair_color = libconfig->setting_get_uint16(it);
+	if ((it = libconfig->setting_get_member(t, "BodyColorId")) != NULL)
+		entry->vd.cloth_color = libconfig->setting_get_uint16(it);
+	if (mob->lookup_const(t, "Gender", &i32) && i32 >= 0) {
+		entry->vd.sex = (char)i32;
+	}
+	if ((it = libconfig->setting_get_member(t, "Options")) != NULL)
+		entry->option = libconfig->setting_get_int(it) &~ (OPTION_HIDE | OPTION_CLOAK | OPTION_INVISIBLE);
+}
+
 /**
  * Processes the mode for a mob_db entry.
  *
@@ -4650,6 +4694,22 @@ static int mob_read_db_sub(struct config_setting_t *mobt, int n, const char *sou
 	 *     AegisName: (chance, "Option Drop Group")
 	 *     ...
 	 * }
+	 * DamageTakenRate: damage taken rate
+	 * ViewData: {
+	 *     SpriteId: sprite id
+	 *     WeaponId: weapon id
+	 *     ShieldId: shield id
+	 *     RobeId: garment id
+	 *     HeadTopId: top headgear id
+	 *     HeadMidId: middle headgear id
+	 *     HeadLowId: lower headgear id
+	 *     HairStyleId: hair style id
+	 *     BodyStyleId: clothes id
+	 *     HairColorId: hair color id
+	 *     BodyColorId: clothes color id
+	 *     Gender: gender
+	 *     Options: options
+	 * }
 	 */
 
 	if (!libconfig->setting_lookup_int(mobt, "Id", &i32)) {
@@ -4879,6 +4939,12 @@ static int mob_read_db_sub(struct config_setting_t *mobt, int n, const char *sou
 		md.dmg_taken_rate = 100;
 	}
 
+	if ((t = libconfig->setting_get_member(mobt, "ViewData"))) {
+		if (config_setting_is_group(t)) {
+			mob->read_db_viewdata_sub(&md, t);
+		}
+	}
+
 	mob->read_db_additional_fields(&md, mobt, n, source);
 
 	return mob->db_validate_entry(&md, n, source);
@@ -5893,6 +5959,7 @@ void mob_defaults(void)
 	mob->read_db_mode_sub = mob_read_db_mode_sub;
 	mob->read_db_drops_option = mob_read_db_drops_option;
 	mob->read_db_stats_sub = mob_read_db_stats_sub;
+	mob->read_db_viewdata_sub = mob_read_db_viewdata_sub;
 	mob->name_constants = mob_name_constants;
 	mob->readdb_mobavail = mob_readdb_mobavail;
 	mob->read_randommonster = mob_read_randommonster;
diff --git a/src/map/mob.h b/src/map/mob.h
index 9b0f6ffe0..5830bf888 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -590,6 +590,7 @@ struct mob_interface {
 	uint32 (*read_db_mode_sub) (struct mob_db *entry, struct config_setting_t *t);
 	struct optdrop_group *(*read_db_drops_option) (struct mob_db *entry, const char *item_name, struct config_setting_t *drop, int *drop_rate);
 	void (*read_db_stats_sub) (struct mob_db *entry, struct config_setting_t *t);
+	void (*read_db_viewdata_sub) (struct mob_db *entry, struct config_setting_t *t);
 	void (*name_constants) (void);
 	bool (*readdb_mobavail) (char *str[], int columns, int current);
 	int (*read_randommonster) (void);
-- 
cgit v1.2.3-70-g09d2


From 8dc577f32d78808083e0d214e626f97413511e0f Mon Sep 17 00:00:00 2001
From: Asheraf <acheraf1998@gmail.com>
Date: Tue, 29 Oct 2019 16:16:25 +0100
Subject: Drop the usage of mob_avail

---
 db/mob_avail.txt           | 43 ---------------------
 src/map/mob.c              | 45 ++++------------------
 src/map/mob.h              |  2 +-
 tools/mobavailconverter.py | 94 ++++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 102 insertions(+), 82 deletions(-)
 delete mode 100644 db/mob_avail.txt
 create mode 100644 tools/mobavailconverter.py

diff --git a/db/mob_avail.txt b/db/mob_avail.txt
deleted file mode 100644
index 2df4ddedc..000000000
--- a/db/mob_avail.txt
+++ /dev/null
@@ -1,43 +0,0 @@
-// Mob Availability and Alias Database
-//
-// Structure of Database:
-// MobID,SpriteID{,Equipment}
-//
-// 01. MobID        Mob ID to change.
-// 02. SpriteID     Mob ID which will be sent to the client instead of MobID.
-//                  If 0, the mob becomes unavailable for use.
-// 03. Equipment    Item ID of pet equipment (must be available for pet counterpart, or this will cause problems).
-//
-// To disguise a mob as a player:
-// MobID,SpriteID,Sex,Hair_Style,Hair_Color,Weapon,Shield,Head_Top,Head_Middle,Head_Bottom,Option,Dye_Color
-//
-// SpriteID is a job class value.
-// Weapon and Shield uses Item ID, while Head uses View ID.
-
-//1002,1039		// Poring - Baphomet
-//1970,1002,10013	// Displays a Poring with a backpack
-
-// Easter Event Monsters
-//1920,1047,0
-//1921,1093,0
-
-// eA Dev Team
-// Valaris
-//1900,4013,1,1,1,1254,0,67,12,54,16,1
-// Valaris Worshiper
-//1901,6,1,1,1,1219,2101,67,12,54,0,1
-// MC Cameri
-//1902,14,1,6,6,1101,2105,0,0,0,32,3
-// Poki#3
-//1903,4012,1,21,0,1720,0,102,184,57,16,0
-// Sentry
-//1904,1286,0
-
-// iRO Halloween Event 2008
-//3000,1015,0
-//3001,1036,0
-//3002,1298,0
-
-// iRO Halloween Event 2009
-//3014,1179,0
-//3015,1272,0
diff --git a/src/map/mob.c b/src/map/mob.c
index 54c83964f..48cbbf6f2 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -5080,46 +5080,15 @@ static void mob_name_constants(void)
 #endif // ENABLE_CASE_CHECK
 }
 
-/*==========================================
- * MOB display graphic change data reading
- *------------------------------------------*/
-static bool mob_readdb_mobavail(char *str[], int columns, int current)
+static void mob_mobavail_removal_notice(void)
 {
-	int class_, view_class;
-
-	nullpo_retr(false, str);
-	class_=atoi(str[0]);
-
-	if(mob->db(class_) == mob->dummy) {
-		// invalid class (probably undefined in db)
-		ShowWarning("mob_readdb_mobavail: Unknown mob id %d.\n", class_);
-		return false;
-	}
-
-	view_class = atoi(str[1]);
+	char filepath[256];
 
-	memset(&mob->db_data[class_]->vd, 0, sizeof(struct view_data));
-	mob->db_data[class_]->vd.class = view_class;
+	safesnprintf(filepath, sizeof(filepath), "%s/mob_avail.txt", map->db_path);
 
-	//Player sprites
-	if (pc->db_checkid(view_class) && columns == 12) {
-		mob->db_data[class_]->vd.sex=atoi(str[2]);
-		mob->db_data[class_]->vd.hair_style=atoi(str[3]);
-		mob->db_data[class_]->vd.hair_color=atoi(str[4]);
-		mob->db_data[class_]->vd.weapon=atoi(str[5]);
-		mob->db_data[class_]->vd.shield=atoi(str[6]);
-		mob->db_data[class_]->vd.head_top=atoi(str[7]);
-		mob->db_data[class_]->vd.head_mid=atoi(str[8]);
-		mob->db_data[class_]->vd.head_bottom=atoi(str[9]);
-		mob->db_data[class_]->option=atoi(str[10])&~(OPTION_HIDE|OPTION_CLOAK|OPTION_INVISIBLE);
-		mob->db_data[class_]->vd.cloth_color=atoi(str[11]); // Monster player dye option - Valaris
+	if (exists(filepath)) {
+		ShowError("mob_mobavail_removal_notice: the usage of mob_avail.txt is no longer supported, move your data using tools/mobavailconverter.py and delete the database file to suspend this message.\n");
 	}
-	else if(columns==3)
-		mob->db_data[class_]->vd.head_bottom=atoi(str[2]); // mob equipment [Valaris]
-	else if( columns != 2 )
-		return false;
-
-	return true;
 }
 
 /*==========================================
@@ -5637,7 +5606,7 @@ static void mob_load(bool minimal)
 	mob->readchatdb();
 	mob->readdb();
 	mob->readskilldb();
-	sv->readdb(map->db_path, "mob_avail.txt", ',', 2, 12, -1, mob->readdb_mobavail);
+	mob->mobavail_removal_notice();
 	mob->read_randommonster();
 	sv->readdb(map->db_path, DBPATH"mob_race2_db.txt", ',', 2, 20, -1, mob->readdb_race2);
 }
@@ -5961,7 +5930,7 @@ void mob_defaults(void)
 	mob->read_db_stats_sub = mob_read_db_stats_sub;
 	mob->read_db_viewdata_sub = mob_read_db_viewdata_sub;
 	mob->name_constants = mob_name_constants;
-	mob->readdb_mobavail = mob_readdb_mobavail;
+	mob->mobavail_removal_notice = mob_mobavail_removal_notice;
 	mob->read_randommonster = mob_read_randommonster;
 	mob->parse_row_chatdb = mob_parse_row_chatdb;
 	mob->readchatdb = mob_readchatdb;
diff --git a/src/map/mob.h b/src/map/mob.h
index 5830bf888..6a4744ca5 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -592,7 +592,7 @@ struct mob_interface {
 	void (*read_db_stats_sub) (struct mob_db *entry, struct config_setting_t *t);
 	void (*read_db_viewdata_sub) (struct mob_db *entry, struct config_setting_t *t);
 	void (*name_constants) (void);
-	bool (*readdb_mobavail) (char *str[], int columns, int current);
+	void (*mobavail_removal_notice) (void);
 	int (*read_randommonster) (void);
 	bool (*parse_row_chatdb) (char **str, const char *source, int line, int *last_msg_id);
 	void (*readchatdb) (void);
diff --git a/tools/mobavailconverter.py b/tools/mobavailconverter.py
new file mode 100644
index 000000000..44a3cd2eb
--- /dev/null
+++ b/tools/mobavailconverter.py
@@ -0,0 +1,94 @@
+#!/usr/bin/env python
+# -*- coding: utf8 -*-
+#
+# This file is part of Hercules.
+# http://herc.ws - http://github.com/HerculesWS/Hercules
+#
+# Copyright (C) 2019 Hercules Dev Team
+# Copyright (C) 2019 Asheraf
+#
+# Hercules is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+import re
+import csv
+
+f = open('../db/re/mob_db.conf')
+mob_db = f.read()
+
+with open('../db/mob_avail.txt') as dbfile:
+	mob_avail = csv.reader(dbfile, delimiter=',')
+
+	for mob in mob_avail:
+		if len(mob) == 0 or mob[0].startswith('//'):
+			continue
+
+		mob = [re.sub(r'//.*', '', i).strip() for i in mob]
+
+		mob_id = int(mob[0])
+		sprite_id = int(mob[1])
+		weapon = 0
+		shield = 0
+		head_top = 0
+		head_mid = 0
+		head_bottom = 0
+		hair_style = 0
+		hair_color = 0
+		cloth_color = 0
+		gender = 0
+		option = 0
+		if len(mob) == 3:
+			head_bottom = int(mob[2])
+		elif len(mob) == 12:
+			gender = int(mob[2])
+			hair_style = int(mob[3])
+			hair_color = int(mob[4])
+			weapon = int(mob[5])
+			shield = int(mob[6])
+			head_top = int(mob[7])
+			head_mid = int(mob[8])
+			head_bottom = int(mob[9])
+			option = int(mob[10])
+			cloth_color = int(mob[11])
+
+		s = ''
+		s += '\tViewData: {\n'
+		s += '\t\tSpriteId: {}\n'.format(sprite_id)
+		if weapon != 0:
+			s += '\t\tWeaponId: {}\n'.format(weapon)
+		if shield != 0:
+			s += '\t\tShieldId: {}\n'.format(shield)
+		if head_top != 0:
+			s += '\t\tHeadTopId: {}\n'.format(head_top)
+		if head_mid != 0:
+			s += '\t\tHeadMidId: {}\n'.format(head_mid)
+		if head_bottom != 0:
+			s += '\t\tHeadLowId: {}\n'.format(head_bottom)
+		if hair_style != 0:
+			s += '\t\tHairStyleId: {}\n'.format(hair_style)
+		if hair_color != 0:
+			s += '\t\tHairColorId: {}\n'.format(hair_color)
+		if cloth_color != 0:
+			s += '\t\tBodyColorId: {}\n'.format(cloth_color)
+		if gender != 0:
+			s += '\t\tGender: SEX_MALE\n'
+		if option != 0:
+			s += '\t\tOptions: {}\n'.format(option)
+		s += '\t}'
+
+		mob_db = re.sub(
+			r'(\tId: ' + str(mob_id) + r'\n([\S\s]*?)(?=},))},',
+			r'\1' + str(s) + r'\n},',
+			mob_db)
+	print(mob_db)
-- 
cgit v1.2.3-70-g09d2


From 5da4f38b15d6bd6b6dd68ab55a3cedfd8ae6ff25 Mon Sep 17 00:00:00 2001
From: Asheraf <acheraf1998@gmail.com>
Date: Tue, 29 Oct 2019 22:06:50 +0100
Subject: HPM Hooks Update

---
 src/plugins/HPMHooking/HPMHooking.Defs.inc         |  6 ++-
 .../HPMHooking/HPMHooking_map.HPMHooksCore.inc     | 12 +++--
 .../HPMHooking/HPMHooking_map.HookingPoints.inc    |  3 +-
 src/plugins/HPMHooking/HPMHooking_map.Hooks.inc    | 55 ++++++++++++++++------
 4 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index 389d273e3..bdab2bd2c 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -5478,10 +5478,12 @@ typedef struct optdrop_group* (*HPMHOOK_pre_mob_read_db_drops_option) (struct mo
 typedef struct optdrop_group* (*HPMHOOK_post_mob_read_db_drops_option) (struct optdrop_group* retVal___, struct mob_db *entry, const char *item_name, struct config_setting_t *drop, int *drop_rate);
 typedef void (*HPMHOOK_pre_mob_read_db_stats_sub) (struct mob_db **entry, struct config_setting_t **t);
 typedef void (*HPMHOOK_post_mob_read_db_stats_sub) (struct mob_db *entry, struct config_setting_t *t);
+typedef void (*HPMHOOK_pre_mob_read_db_viewdata_sub) (struct mob_db **entry, struct config_setting_t **t);
+typedef void (*HPMHOOK_post_mob_read_db_viewdata_sub) (struct mob_db *entry, struct config_setting_t *t);
 typedef void (*HPMHOOK_pre_mob_name_constants) (void);
 typedef void (*HPMHOOK_post_mob_name_constants) (void);
-typedef bool (*HPMHOOK_pre_mob_readdb_mobavail) (char **str[], int *columns, int *current);
-typedef bool (*HPMHOOK_post_mob_readdb_mobavail) (bool retVal___, char *str[], int columns, int current);
+typedef void (*HPMHOOK_pre_mob_mobavail_removal_notice) (void);
+typedef void (*HPMHOOK_post_mob_mobavail_removal_notice) (void);
 typedef int (*HPMHOOK_pre_mob_read_randommonster) (void);
 typedef int (*HPMHOOK_post_mob_read_randommonster) (int retVal___);
 typedef bool (*HPMHOOK_pre_mob_parse_row_chatdb) (char ***str, const char **source, int *line, int **last_msg_id);
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
index 1196e3a99..d2bb75b74 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -4080,10 +4080,12 @@ struct {
 	struct HPMHookPoint *HP_mob_read_db_drops_option_post;
 	struct HPMHookPoint *HP_mob_read_db_stats_sub_pre;
 	struct HPMHookPoint *HP_mob_read_db_stats_sub_post;
+	struct HPMHookPoint *HP_mob_read_db_viewdata_sub_pre;
+	struct HPMHookPoint *HP_mob_read_db_viewdata_sub_post;
 	struct HPMHookPoint *HP_mob_name_constants_pre;
 	struct HPMHookPoint *HP_mob_name_constants_post;
-	struct HPMHookPoint *HP_mob_readdb_mobavail_pre;
-	struct HPMHookPoint *HP_mob_readdb_mobavail_post;
+	struct HPMHookPoint *HP_mob_mobavail_removal_notice_pre;
+	struct HPMHookPoint *HP_mob_mobavail_removal_notice_post;
 	struct HPMHookPoint *HP_mob_read_randommonster_pre;
 	struct HPMHookPoint *HP_mob_read_randommonster_post;
 	struct HPMHookPoint *HP_mob_parse_row_chatdb_pre;
@@ -10909,10 +10911,12 @@ struct {
 	int HP_mob_read_db_drops_option_post;
 	int HP_mob_read_db_stats_sub_pre;
 	int HP_mob_read_db_stats_sub_post;
+	int HP_mob_read_db_viewdata_sub_pre;
+	int HP_mob_read_db_viewdata_sub_post;
 	int HP_mob_name_constants_pre;
 	int HP_mob_name_constants_post;
-	int HP_mob_readdb_mobavail_pre;
-	int HP_mob_readdb_mobavail_post;
+	int HP_mob_mobavail_removal_notice_pre;
+	int HP_mob_mobavail_removal_notice_post;
 	int HP_mob_read_randommonster_pre;
 	int HP_mob_read_randommonster_post;
 	int HP_mob_parse_row_chatdb_pre;
diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
index da72b688a..16b8b4f54 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2089,8 +2089,9 @@ struct HookingPointData HookingPoints[] = {
 	{ HP_POP(mob->read_db_mode_sub, HP_mob_read_db_mode_sub) },
 	{ HP_POP(mob->read_db_drops_option, HP_mob_read_db_drops_option) },
 	{ HP_POP(mob->read_db_stats_sub, HP_mob_read_db_stats_sub) },
+	{ HP_POP(mob->read_db_viewdata_sub, HP_mob_read_db_viewdata_sub) },
 	{ HP_POP(mob->name_constants, HP_mob_name_constants) },
-	{ HP_POP(mob->readdb_mobavail, HP_mob_readdb_mobavail) },
+	{ HP_POP(mob->mobavail_removal_notice, HP_mob_mobavail_removal_notice) },
 	{ HP_POP(mob->read_randommonster, HP_mob_read_randommonster) },
 	{ HP_POP(mob->parse_row_chatdb, HP_mob_parse_row_chatdb) },
 	{ HP_POP(mob->readchatdb, HP_mob_readchatdb) },
diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
index c331d66a9..eaf37b719 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -54111,6 +54111,32 @@ void HP_mob_read_db_stats_sub(struct mob_db *entry, struct config_setting_t *t)
 	}
 	return;
 }
+void HP_mob_read_db_viewdata_sub(struct mob_db *entry, struct config_setting_t *t) {
+	int hIndex = 0;
+	if (HPMHooks.count.HP_mob_read_db_viewdata_sub_pre > 0) {
+		void (*preHookFunc) (struct mob_db **entry, struct config_setting_t **t);
+		*HPMforce_return = false;
+		for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_viewdata_sub_pre; hIndex++) {
+			preHookFunc = HPMHooks.list.HP_mob_read_db_viewdata_sub_pre[hIndex].func;
+			preHookFunc(&entry, &t);
+		}
+		if (*HPMforce_return) {
+			*HPMforce_return = false;
+			return;
+		}
+	}
+	{
+		HPMHooks.source.mob.read_db_viewdata_sub(entry, t);
+	}
+	if (HPMHooks.count.HP_mob_read_db_viewdata_sub_post > 0) {
+		void (*postHookFunc) (struct mob_db *entry, struct config_setting_t *t);
+		for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_read_db_viewdata_sub_post; hIndex++) {
+			postHookFunc = HPMHooks.list.HP_mob_read_db_viewdata_sub_post[hIndex].func;
+			postHookFunc(entry, t);
+		}
+	}
+	return;
+}
 void HP_mob_name_constants(void) {
 	int hIndex = 0;
 	if (HPMHooks.count.HP_mob_name_constants_pre > 0) {
@@ -54137,32 +54163,31 @@ void HP_mob_name_constants(void) {
 	}
 	return;
 }
-bool HP_mob_readdb_mobavail(char *str[], int columns, int current) {
+void HP_mob_mobavail_removal_notice(void) {
 	int hIndex = 0;
-	bool retVal___ = false;
-	if (HPMHooks.count.HP_mob_readdb_mobavail_pre > 0) {
-		bool (*preHookFunc) (char **str[], int *columns, int *current);
+	if (HPMHooks.count.HP_mob_mobavail_removal_notice_pre > 0) {
+		void (*preHookFunc) (void);
 		*HPMforce_return = false;
-		for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_readdb_mobavail_pre; hIndex++) {
-			preHookFunc = HPMHooks.list.HP_mob_readdb_mobavail_pre[hIndex].func;
-			retVal___ = preHookFunc(&str, &columns, &current);
+		for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_mobavail_removal_notice_pre; hIndex++) {
+			preHookFunc = HPMHooks.list.HP_mob_mobavail_removal_notice_pre[hIndex].func;
+			preHookFunc();
 		}
 		if (*HPMforce_return) {
 			*HPMforce_return = false;
-			return retVal___;
+			return;
 		}
 	}
 	{
-		retVal___ = HPMHooks.source.mob.readdb_mobavail(str, columns, current);
+		HPMHooks.source.mob.mobavail_removal_notice();
 	}
-	if (HPMHooks.count.HP_mob_readdb_mobavail_post > 0) {
-		bool (*postHookFunc) (bool retVal___, char *str[], int columns, int current);
-		for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_readdb_mobavail_post; hIndex++) {
-			postHookFunc = HPMHooks.list.HP_mob_readdb_mobavail_post[hIndex].func;
-			retVal___ = postHookFunc(retVal___, str, columns, current);
+	if (HPMHooks.count.HP_mob_mobavail_removal_notice_post > 0) {
+		void (*postHookFunc) (void);
+		for (hIndex = 0; hIndex < HPMHooks.count.HP_mob_mobavail_removal_notice_post; hIndex++) {
+			postHookFunc = HPMHooks.list.HP_mob_mobavail_removal_notice_post[hIndex].func;
+			postHookFunc();
 		}
 	}
-	return retVal___;
+	return;
 }
 int HP_mob_read_randommonster(void) {
 	int hIndex = 0;
-- 
cgit v1.2.3-70-g09d2