From 0b4d483783e823f9b9de6f47314b804167e73be9 Mon Sep 17 00:00:00 2001 From: "Bogir[rus]" Date: Fri, 4 Feb 2022 21:52:23 +0500 Subject: [PATCH] feat(Core/Conf): handle custom creatures IDs and exclude them from checks (#10367) --- src/server/game/Globals/ObjectMgr.cpp | 16 +++++++++++++--- src/server/worldserver/worldserver.conf.dist | 10 ++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 01687ead2..88c5406bc 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -22,6 +22,7 @@ #include "CharacterCache.h" #include "Chat.h" #include "Common.h" +#include "Config.h" #include "DatabaseEnv.h" #include "DisableMgr.h" #include "GameEventMgr.h" @@ -1173,11 +1174,20 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo) const_cast(cInfo)->DamageModifier *= Creature::_GetDamageMod(cInfo->rank); // Hack for modules - switch (cInfo->Entry) + std::vector CustomCreatures; + std::string stringCreatureIds(sConfigMgr->GetOption("Creatures.CustomIDs", "")); + for (std::string_view id : Acore::Tokenize(stringCreatureIds, ',', false)) { - case 190010: // Transmog Module - return; + uint32 entry = Acore::StringTo(id).value_or(0); + CustomCreatures.emplace_back(entry); } + + for (auto const& itr : CustomCreatures) + { + if (cInfo->Entry == itr) + return; + } + if (cInfo->GossipMenuId && !(cInfo->npcflag & UNIT_NPC_FLAG_GOSSIP)) { LOG_ERROR("sql.sql", "Creature (Entry: {}) has assigned gossip menu {}, but npcflag does not include UNIT_NPC_FLAG_GOSSIP (1).", cInfo->Entry, cInfo->GossipMenuId); diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index 3a199e2c9..35a83c328 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -1796,6 +1796,16 @@ NpcRegenHPIfTargetIsUnreachable = 1 NpcRegenHPTimeIfTargetIsUnreachable = 10 +# Creatures.CustomIDs +# Description: The list of custom creatures with gossip dialogues hardcoded in core, +# divided by "," without spaces. +# It is implied that you do not use for these NPC dialogs data from "gossip_menu" table. +# Server will skip these IDs during the definitions validation process. +# Example: Creatures.CustomIDs = "190010,55005,999991" - Npc for Transmog, Guild-zone and 1v1-arena modules +# Default: "" + +Creatures.CustomIDs = "190010" + # ###################################################################################################