From 0fbe8c3ecded45dd069002c505d1c5fa6f86cb5b Mon Sep 17 00:00:00 2001 From: Atemo Date: Wed, 12 Apr 2023 01:50:03 +0200 Subject: [PATCH] Fixed an issue with npc_enable_target (#7695) Fixed #7694 Thanks to @eppc0330 --- src/map/npc.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 61f0506168..f4634a8ec8 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -1035,8 +1035,9 @@ bool npc_enable_target(npc_data& nd, uint32 char_id, e_npcv_status flag) } else { if (flag & NPCVIEW_ENABLE) { - nd.sc.option &= ~OPTION_HIDE; nd.is_invisible = false; + clif_spawn(&nd.bl); + nd.sc.option &= ~OPTION_HIDE; } else if (flag & NPCVIEW_HIDEOFF) nd.sc.option &= ~OPTION_HIDE; @@ -1050,8 +1051,11 @@ bool npc_enable_target(npc_data& nd, uint32 char_id, e_npcv_status flag) nd.sc.option |= OPTION_HIDE; nd.is_invisible = true; } - if (nd.class_ != JT_WARPNPC && nd.class_ != JT_GUILD_FLAG) //Client won't display option changes for these classes [Toms] + if (nd.class_ != JT_WARPNPC && nd.class_ != JT_GUILD_FLAG) { //Client won't display option changes for these classes [Toms] clif_changeoption(&nd.bl); + if (nd.is_invisible) + clif_clearunit_area(&nd.bl,CLR_OUTSIGHT); // Hack to trick maya purple card [Xazax] + } else { if (nd.sc.option&(OPTION_HIDE|OPTION_CLOAK)) clif_clearunit_area(&nd.bl,CLR_OUTSIGHT); @@ -4621,14 +4625,14 @@ const char* npc_parse_duplicate( char* w1, char* w2, char* w3, char* w4, const c } strdb_put(npcname_db, nd->exname, nd); - if( type != NPCTYPE_SCRIPT ) - return end; - // copy the original npc state if (dnd->state != NPCVIEW_ENABLE) npc_enable_target(*nd, 0, dnd->state); nd->state = dnd->state; + if( type != NPCTYPE_SCRIPT ) + return end; + //----------------------------------------- // Loop through labels to export them as necessary for (i = 0; i < nd->u.scr.label_list_num; i++) {