Fixed rebinding of mob view data for killed mobs

Fixes #2351

Thanks to @TesLA-Git
This commit is contained in:
Lemongrass3110 2017-08-18 11:47:40 +02:00
parent 2d31bc3c43
commit 5fdebec3af

View File

@ -5254,18 +5254,17 @@ static int mob_reload_sub( struct mob_data *md, va_list args ){
// Relink the mob to the new database entry // Relink the mob to the new database entry
md->db = mob_db(md->mob_id); md->db = mob_db(md->mob_id);
if( md->bl.prev == NULL ){
return 0;
}
// If the view data was not overwritten manually // If the view data was not overwritten manually
if( !md->vd_changed ){ if( !md->vd_changed ){
// Get the new view data from the mob database // Get the new view data from the mob database
md->vd = mob_get_viewdata(md->mob_id); md->vd = mob_get_viewdata(md->mob_id);
// Respawn all mobs on client side so that they are displayed correctly(if their view id changed) // If they are spawned right now
clif_clearunit_area(&md->bl, CLR_OUTSIGHT); if( md->bl.prev != NULL ){
clif_spawn(&md->bl); // 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; return 0;
@ -5278,18 +5277,17 @@ static int mob_reload_sub( struct mob_data *md, va_list args ){
* @return 0 * @return 0
*/ */
static int mob_reload_sub_npc( struct npc_data *nd, va_list args ){ static int mob_reload_sub_npc( struct npc_data *nd, va_list args ){
if( nd->bl.prev == NULL ){
return 0;
}
// If the view data points to a mob // If the view data points to a mob
if( mobdb_checkid(nd->class_) ){ if( mobdb_checkid(nd->class_) ){
// Get the new view data from the mob database // Get the new view data from the mob database
nd->vd = mob_get_viewdata(nd->class_); nd->vd = mob_get_viewdata(nd->class_);
// Respawn all NPCs on client side so that they are displayed correctly(if their view id changed) // If they are spawned right now
clif_clearunit_area(&nd->bl, CLR_OUTSIGHT); if( nd->bl.prev == NULL ){
clif_spawn(&nd->bl); // Respawn all NPCs on client side so that they are displayed correctly(if their view id changed)
clif_clearunit_area(&nd->bl, CLR_OUTSIGHT);
clif_spawn(&nd->bl);
}
} }
return 0; return 0;