feat(Scripts/Commands): Show boss name in instance boss state (#24698)
This commit is contained in:
@@ -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);
|
||||||
@@ -17,11 +17,13 @@
|
|||||||
|
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "CommandScript.h"
|
#include "CommandScript.h"
|
||||||
|
#include "DBCStores.h"
|
||||||
#include "GameTime.h"
|
#include "GameTime.h"
|
||||||
#include "InstanceSaveMgr.h"
|
#include "InstanceSaveMgr.h"
|
||||||
#include "InstanceScript.h"
|
#include "InstanceScript.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "MapMgr.h"
|
#include "MapMgr.h"
|
||||||
|
#include "ObjectMgr.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
|
|
||||||
using namespace Acore::ChatCommands;
|
using namespace Acore::ChatCommands;
|
||||||
@@ -230,11 +232,51 @@ public:
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build a map of encounterIndex -> encounterName from DBC data
|
||||||
|
std::unordered_map<uint32, char const*> 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)
|
for (uint8 i = 0; i < map->GetInstanceScript()->GetEncounterCount(); ++i)
|
||||||
{
|
{
|
||||||
uint32 state = map->GetInstanceScript()->GetBossState(i);
|
uint32 state = map->GetInstanceScript()->GetBossState(i);
|
||||||
std::string stateName = InstanceScript::GetBossStateName(state);
|
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;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user