summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--db/mob_avail.txt43
-rw-r--r--db/pre-re/mob_db.conf15
-rw-r--r--db/re/mob_db.conf15
-rw-r--r--doc/mob_db.txt23
-rw-r--r--src/map/mob.c112
-rw-r--r--src/map/mob.h3
-rw-r--r--src/plugins/HPMHooking/HPMHooking.Defs.inc6
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc12
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc3
-rw-r--r--src/plugins/HPMHooking/HPMHooking_map.Hooks.inc55
-rw-r--r--tools/mobavailconverter.py94
11 files changed, 277 insertions, 104 deletions
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/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 dce084a23..60b6977bb 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -4178,6 +4178,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.
*
* @param[in] entry The destination mob_db entry, already initialized.
@@ -4657,6 +4701,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)) {
@@ -4886,6 +4946,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);
@@ -5021,46 +5087,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;
}
/*==========================================
@@ -5578,7 +5613,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);
}
@@ -5900,8 +5935,9 @@ 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->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 6c3aa938b..6693c3671 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -589,8 +589,9 @@ 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);
+ 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/src/plugins/HPMHooking/HPMHooking.Defs.inc b/src/plugins/HPMHooking/HPMHooking.Defs.inc
index f878f36b8..89c9024cc 100644
--- a/src/plugins/HPMHooking/HPMHooking.Defs.inc
+++ b/src/plugins/HPMHooking/HPMHooking.Defs.inc
@@ -5482,10 +5482,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 ce716729a..9c4fe9b6f 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc
@@ -4084,10 +4084,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;
@@ -10919,10 +10921,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 f29820952..99e3fd5a1 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc
@@ -2091,8 +2091,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 bcbfb7c3e..147458d09 100644
--- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
+++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc
@@ -54163,6 +54163,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) {
@@ -54189,32 +54215,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;
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)