mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Merge pull request #15692 from ShinDarth/instance
Scripts/Commands: enhanced .instance get/setbossstate commands
This commit is contained in:
@@ -652,3 +652,25 @@ void InstanceScript::UpdateEncounterState(EncounterCreditType type, uint32 credi
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::string InstanceScript::GetBossStateName(uint8 state)
|
||||
{
|
||||
// See enum EncounterState in InstanceScript.h
|
||||
switch (state)
|
||||
{
|
||||
case NOT_STARTED:
|
||||
return "NOT_STARTED";
|
||||
case IN_PROGRESS:
|
||||
return "IN_PROGRESS";
|
||||
case FAIL:
|
||||
return "FAIL";
|
||||
case DONE:
|
||||
return "DONE";
|
||||
case SPECIAL:
|
||||
return "SPECIAL";
|
||||
case TO_BE_DECIDED:
|
||||
return "TO_BE_DECIDED";
|
||||
default:
|
||||
return "INVALID";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,6 +220,7 @@ class InstanceScript : public ZoneScript
|
||||
|
||||
virtual bool SetBossState(uint32 id, EncounterState state);
|
||||
EncounterState GetBossState(uint32 id) const { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; }
|
||||
static std::string GetBossStateName(uint8 state);
|
||||
BossBoundaryMap const* GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : NULL; }
|
||||
|
||||
// Achievement criteria additional requirements check
|
||||
|
||||
@@ -254,7 +254,8 @@ public:
|
||||
}
|
||||
|
||||
map->ToInstanceMap()->GetInstanceScript()->SetBossState(encounterId, (EncounterState)state);
|
||||
handler->PSendSysMessage(LANG_COMMAND_INST_SET_BOSS_STATE, encounterId, state);
|
||||
std::string stateName = InstanceScript::GetBossStateName(state);
|
||||
handler->PSendSysMessage(LANG_COMMAND_INST_SET_BOSS_STATE, encounterId, state, stateName);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -318,7 +319,8 @@ public:
|
||||
}
|
||||
|
||||
uint8 state = map->ToInstanceMap()->GetInstanceScript()->GetBossState(encounterId);
|
||||
handler->PSendSysMessage(LANG_COMMAND_INST_GET_BOSS_STATE, encounterId, state);
|
||||
std::string stateName = InstanceScript::GetBossStateName(state);
|
||||
handler->PSendSysMessage(LANG_COMMAND_INST_GET_BOSS_STATE, encounterId, state, stateName);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user