Core/Spawn: Move spawn group state management from sObjectMgr to the Map object, which makes it actually function as intended with instances.
Port From (https://github.com/TrinityCore/TrinityCore/commit/27806eeac9d2588d2f7a3b8a0852d45b15a6a241)
This commit is contained in:
@@ -243,13 +243,13 @@ namespace Game.Maps
|
||||
{
|
||||
uint groupId = pair.Key;
|
||||
bool doSpawn = pair.Value == states.Spawn;
|
||||
if (Global.ObjectMgr.IsSpawnGroupActive(groupId) == doSpawn)
|
||||
if (instance.IsSpawnGroupActive(groupId) == doSpawn)
|
||||
continue; // nothing to do here
|
||||
// if we should spawn group, then spawn it...
|
||||
if (doSpawn)
|
||||
Global.ObjectMgr.SpawnGroupSpawn(groupId, instance);
|
||||
instance.SpawnGroupSpawn(groupId, instance);
|
||||
else // otherwise, set it as inactive so it no longer respawns (but don't despawn it)
|
||||
Global.ObjectMgr.SetSpawnGroupActive(groupId, false);
|
||||
instance.SetSpawnGroupActive(groupId, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -331,7 +331,7 @@ namespace Game.Maps
|
||||
if (bossInfo.state == EncounterState.ToBeDecided) // loading
|
||||
{
|
||||
bossInfo.state = state;
|
||||
Log.outDebug(LogFilter.Scripts, $"InstanceScript: Inialize boss {id} state as {state}.");
|
||||
Log.outDebug(LogFilter.Scripts, $"InstanceScript: Initialize boss {id} state as {state} (map {instance.GetId()}, {instance.GetInstanceId()}).");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
@@ -339,6 +339,12 @@ namespace Game.Maps
|
||||
if (bossInfo.state == state)
|
||||
return false;
|
||||
|
||||
if (bossInfo.state == EncounterState.Done)
|
||||
{
|
||||
Log.outError(LogFilter.Maps, $"InstanceScript: Tried to set instance state from {bossInfo.state} back to {state} for map {instance.GetId()}, instance id {instance.GetInstanceId()}. Blocked!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (state == EncounterState.Done)
|
||||
{
|
||||
foreach (var guid in bossInfo.minion)
|
||||
|
||||
Reference in New Issue
Block a user