feat(Scripts/Commands): Update GetBossState to display all states (#21134)

This commit is contained in:
Andrew
2025-01-10 20:43:11 -03:00
committed by GitHub
parent 5bc20a184d
commit 3e465ddedc
2 changed files with 7 additions and 7 deletions

View File

@@ -0,0 +1,2 @@
--
UPDATE `command` SET `help` = 'Syntax: .instance getbossstate [$Name]\nDisplays the state for every available encounter.\nIf no character name is provided, the current map will be used as target.' WHERE `name` = 'instance getbossstate';

View File

@@ -206,7 +206,7 @@ public:
return true;
}
static bool HandleInstanceGetBossStateCommand(ChatHandler* handler, uint32 encounterId, Optional<PlayerIdentifier> player)
static bool HandleInstanceGetBossStateCommand(ChatHandler* handler, Optional<PlayerIdentifier> player)
{
// Character name must be provided when using this from console.
if (!player && !handler->GetSession())
@@ -237,15 +237,13 @@ public:
return false;
}
if (encounterId > map->GetInstanceScript()->GetEncounterCount())
for (uint8 i = 0; i < map->GetInstanceScript()->GetEncounterCount(); ++i)
{
handler->SendErrorMessage(LANG_BAD_VALUE);
return false;
uint32 state = map->GetInstanceScript()->GetBossState(i);
std::string stateName = InstanceScript::GetBossStateName(state);
handler->PSendSysMessage(LANG_COMMAND_INST_GET_BOSS_STATE, i, state, stateName);
}
uint32 state = map->GetInstanceScript()->GetBossState(encounterId);
std::string stateName = InstanceScript::GetBossStateName(state);
handler->PSendSysMessage(LANG_COMMAND_INST_GET_BOSS_STATE, encounterId, state, stateName);
return true;
}
};