From 2473f3513d309b6ae3fb92d9aa932bccaabbc890 Mon Sep 17 00:00:00 2001 From: Andrew <47818697+Nyeriah@users.noreply.github.com> Date: Fri, 13 Feb 2026 08:49:24 -0300 Subject: [PATCH] feat(Scripts/Commands): Show boss name in instance boss state (#24698) --- .../updates/pending_db_world/rev_1883243.sql | 3 ++ src/server/scripts/Commands/cs_instance.cpp | 44 ++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 data/sql/updates/pending_db_world/rev_1883243.sql diff --git a/data/sql/updates/pending_db_world/rev_1883243.sql b/data/sql/updates/pending_db_world/rev_1883243.sql new file mode 100644 index 000000000..e0d868cad --- /dev/null +++ b/data/sql/updates/pending_db_world/rev_1883243.sql @@ -0,0 +1,3 @@ +DELETE FROM `acore_string` WHERE `entry` = 5058; +INSERT INTO `acore_string` (`entry`, `content_default`, `locale_koKR`, `locale_frFR`, `locale_deDE`, `locale_zhCN`, `locale_zhTW`, `locale_esES`, `locale_esMX`, `locale_ruRU`) VALUES +(5058,'Boss id {} ({}) state is {} ({}).',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/src/server/scripts/Commands/cs_instance.cpp b/src/server/scripts/Commands/cs_instance.cpp index a6ee3bc5c..078594a8a 100644 --- a/src/server/scripts/Commands/cs_instance.cpp +++ b/src/server/scripts/Commands/cs_instance.cpp @@ -17,11 +17,13 @@ #include "Chat.h" #include "CommandScript.h" +#include "DBCStores.h" #include "GameTime.h" #include "InstanceSaveMgr.h" #include "InstanceScript.h" #include "Language.h" #include "MapMgr.h" +#include "ObjectMgr.h" #include "Player.h" using namespace Acore::ChatCommands; @@ -230,11 +232,51 @@ public: return false; } + // Build a map of encounterIndex -> encounterName from DBC data + std::unordered_map encounterNames; + Difficulty difficulty = map->GetDifficulty(); + + // For heroic ICC/Ruby Sanctum, encounters are only defined + // for normal difficulty in the DBC, use the same fallback + // pattern as Map::UpdateEncounterState + DungeonEncounterList const* encounters = nullptr; + if ((map->GetId() == 631 || map->GetId() == 724) + && map->IsHeroic()) + { + encounters = sObjectMgr->GetDungeonEncounterList( + map->GetId(), + !map->Is25ManRaid() + ? RAID_DIFFICULTY_10MAN_NORMAL + : RAID_DIFFICULTY_25MAN_NORMAL); + } + else + { + Difficulty diffFixed = IsSharedDifficultyMap(map->GetId()) + ? Difficulty(difficulty % 2) + : difficulty; + encounters = sObjectMgr->GetDungeonEncounterList( + map->GetId(), diffFixed); + } + + if (encounters) + { + for (auto const* encounter : *encounters) + encounterNames[encounter->dbcEntry->encounterIndex] + = encounter->dbcEntry->encounterName[0]; + } + for (uint8 i = 0; i < map->GetInstanceScript()->GetEncounterCount(); ++i) { uint32 state = map->GetInstanceScript()->GetBossState(i); std::string stateName = InstanceScript::GetBossStateName(state); - handler->PSendSysMessage(LANG_COMMAND_INST_GET_BOSS_STATE, i, state, stateName); + + auto it = encounterNames.find(i); + std::string bossName = (it != encounterNames.end() + && it->second) ? it->second : "Unknown"; + + handler->PSendSysMessage( + LANG_COMMAND_INST_GET_BOSS_STATE, + i, bossName, state, stateName); } return true;