mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Instances: Spawn defeated bosses in instances using loot based locks if their preceding bosses are not killed
This commit is contained in:
@@ -477,6 +477,12 @@ void InstanceScript::Load(char const* data)
|
||||
InstanceScriptDataReader reader(*this);
|
||||
if (reader.Load(data) == InstanceScriptDataReader::Result::Ok)
|
||||
{
|
||||
// in loot-based lockouts instance can be loaded with later boss marked as killed without preceding bosses
|
||||
// but we still need to have them alive
|
||||
for (uint32 i = 0; i < bosses.size(); ++i)
|
||||
if (bosses[i].state == DONE && !CheckRequiredBosses(i))
|
||||
bosses[i].state = NOT_STARTED;
|
||||
|
||||
UpdateSpawnGroups();
|
||||
AfterDataLoad();
|
||||
}
|
||||
@@ -740,6 +746,15 @@ bool InstanceScript::IsEncounterCompleted(uint32 dungeonEncounterId) const
|
||||
return false;
|
||||
}
|
||||
|
||||
bool InstanceScript::IsEncounterCompletedInMaskByBossId(uint32 completedEncountersMask, uint32 bossId) const
|
||||
{
|
||||
if (DungeonEncounterEntry const* dungeonEncounter = GetBossDungeonEncounter(bossId))
|
||||
if (completedEncountersMask & (1 << dungeonEncounter->Bit))
|
||||
return bosses[bossId].state == DONE;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void InstanceScript::SetEntranceLocation(uint32 worldSafeLocationId)
|
||||
{
|
||||
_entranceId = worldSafeLocationId;
|
||||
|
||||
@@ -287,6 +287,7 @@ class TC_GAME_API InstanceScript : public ZoneScript
|
||||
uint32 GetCompletedEncounterMask() const { return completedEncounters; }
|
||||
|
||||
bool IsEncounterCompleted(uint32 dungeonEncounterId) const;
|
||||
bool IsEncounterCompletedInMaskByBossId(uint32 completedEncountersMask, uint32 bossId) const;
|
||||
|
||||
uint32 GetEncounterCount() const { return uint32(bosses.size()); }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user