summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2019-07-28 19:15:07 +0200
committerGitHub <noreply@github.com>2019-07-28 19:15:07 +0200
commitbc827a10f838c78a051c064d41c27f4c478e7d69 (patch)
tree555b118a8f5ba67bc44881070ae3990359f667e2 /src
parentfa1dd260730ccc0b49d17ded96ee298cd514ba05 (diff)
parentb2720eebfb21f9334137749cdbac19f4bfc4bc3d (diff)
downloadhercules-bc827a10f838c78a051c064d41c27f4c478e7d69.tar.gz
hercules-bc827a10f838c78a051c064d41c27f4c478e7d69.tar.bz2
hercules-bc827a10f838c78a051c064d41c27f4c478e7d69.tar.xz
hercules-bc827a10f838c78a051c064d41c27f4c478e7d69.zip
Merge pull request #2500 from Emistry/atcommand_reloadmobdb
Update @reloadmobdb to update living mobs
Diffstat (limited to 'src')
-rw-r--r--src/map/mob.c25
-rw-r--r--src/map/mob.h1
2 files changed, 26 insertions, 0 deletions
diff --git a/src/map/mob.c b/src/map/mob.c
index 8511f8523..404a240c9 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -5547,6 +5547,29 @@ static int mob_final_ratio_sub(union DBKey key, struct DBData *data, va_list ap)
return 0;
}
+static int mob_reload_sub_mob(struct mob_data *md, va_list args)
+{
+ nullpo_ret(md);
+ md->db = mob_db(md->class_);
+
+ status_calc_mob(md, SCO_FIRST);
+
+ // If the view data was not overwritten manually
+ if (md->vd != NULL) {
+ // Get the new view data from the mob database
+ md->vd = mob_get_viewdata(md->class_);
+
+ // If they are spawned right now
+ if (md->bl.prev != NULL) {
+ // Respawn all mobs on client side so that they are displayed correctly(if their view id changed)
+ clif->clearunit_area(&md->bl, CLR_OUTSIGHT);
+ clif->spawn(&md->bl);
+ }
+ }
+
+ return 0;
+}
+
static void mob_reload(void)
{
int i;
@@ -5570,6 +5593,7 @@ static void mob_reload(void)
mob->destroy_drop_groups();
mob->load(false);
+ map->foreachmob(mob->reload_sub_mob);
}
/**
@@ -5726,6 +5750,7 @@ void mob_defaults(void)
/* */
mob->reload = mob_reload;
+ mob->reload_sub_mob = mob_reload_sub_mob;
mob->init = do_init_mob;
mob->final = do_final_mob;
/* */
diff --git a/src/map/mob.h b/src/map/mob.h
index b63efd272..0a7489c47 100644
--- a/src/map/mob.h
+++ b/src/map/mob.h
@@ -488,6 +488,7 @@ struct mob_interface {
int (*init) (bool mimimal);
int (*final) (void);
void (*reload) (void);
+ int (*reload_sub_mob) (struct mob_data *md, va_list args);
/* */
struct mob_db* (*db) (int index);
struct mob_chat* (*chat) (short id);