From f7bc3bca66bb4999b9d26d5f4e8c02a724157f25 Mon Sep 17 00:00:00 2001 From: Lemongrass3110 Date: Sat, 2 Dec 2017 12:18:07 +0100 Subject: [PATCH] Fixed an issue with invisible item shops Thanks to @Everade --- src/map/npc.cpp | 12 +++++++----- src/map/npc.hpp | 2 +- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/map/npc.cpp b/src/map/npc.cpp index be579386c6..e4fb32103f 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -2824,12 +2824,14 @@ static const char* npc_parse_shop(char* w1, char* w2, char* w3, char* w4, const map_addnpc(m,nd); if(map_addblock(&nd->bl)) return strchr(start,'\n'); - status_set_viewdata(&nd->bl, nd->class_); status_change_init(&nd->bl); unit_dataset(&nd->bl); nd->ud.dir = (uint8)dir; - if( map[nd->bl.m].users ) - clif_spawn(&nd->bl); + if( nd->class_ != JT_FAKENPC ){ + status_set_viewdata(&nd->bl, nd->class_); + if( map[nd->bl.m].users ) + clif_spawn(&nd->bl); + } } else {// 'floating' shop? map_addiddb(&nd->bl); @@ -3059,7 +3061,7 @@ static const char* npc_parse_script(char* w1, char* w2, char* w3, char* w4, cons npc_setcells(nd); if(map_addblock(&nd->bl)) return NULL; - if( nd->class_ >= 0 ) + if( nd->class_ != JT_FAKENPC ) { status_set_viewdata(&nd->bl, nd->class_); if( map[nd->bl.m].users ) @@ -3217,7 +3219,7 @@ const char* npc_parse_duplicate(char* w1, char* w2, char* w3, char* w4, const ch npc_setcells(nd); if(map_addblock(&nd->bl)) return end; - if( nd->class_ >= 0 ) { + if( nd->class_ != JT_FAKENPC ) { status_set_viewdata(&nd->bl, nd->class_); if( map[nd->bl.m].users ) clif_spawn(&nd->bl); diff --git a/src/map/npc.hpp b/src/map/npc.hpp index e266b68920..a57653a025 100644 --- a/src/map/npc.hpp +++ b/src/map/npc.hpp @@ -1097,7 +1097,7 @@ enum e_job_types //Checks if a given id is a valid npc id. [Skotlex] //Since new npcs are added all the time, the max valid value is the one before the first mob (Scorpion = 1001) -#define npcdb_checkid(id) ( ( (id) > NPC_RANGE1_START && (id) < NPC_RANGE1_END ) || (id) == JT_HIDDEN_WARP_NPC || ( (id) > NPC_RANGE2_START && (id) < NPC_RANGE2_END ) || (id) == JT_INVISIBLE || ( id > NPC_RANGE3_START && id < NPC_RANGE3_END ) ) +#define npcdb_checkid(id) ( ( (id) > NPC_RANGE1_START && (id) < NPC_RANGE1_END ) || (id) == JT_HIDDEN_WARP_NPC || ( (id) > NPC_RANGE2_START && (id) < NPC_RANGE2_END ) || (id) == JT_INVISIBLE || ( (id) > NPC_RANGE3_START && (id) < NPC_RANGE3_END ) ) #ifdef PCRE_SUPPORT void npc_chat_finalize(struct npc_data* nd);