Core/Maps: Check group that owns instance (first group to enter a given instance id owns it)
Port From (https://github.com/TrinityCore/TrinityCore/commit/a131542855d23022714a97640be1c8d68a741c31)
This commit is contained in:
+10
-1
@@ -4914,7 +4914,7 @@ namespace Game.Maps
|
||||
if (i_instanceLock != null)
|
||||
{
|
||||
MapDb2Entries entries = new(GetEntry(), GetMapDifficulty());
|
||||
if (entries.IsInstanceIdBound() || IsRaid() || entries.MapDifficulty.IsRestoringDungeonState() || !i_owningGroupRef.isValid())
|
||||
if (entries.IsInstanceIdBound() || IsRaid() || entries.MapDifficulty.IsRestoringDungeonState() || !i_owningGroupRef.IsValid())
|
||||
{
|
||||
InstanceLockData lockData = i_instanceLock.GetInstanceInitializationData();
|
||||
i_data.SetCompletedEncountersMask(lockData.CompletedEncountersMask);
|
||||
@@ -4931,6 +4931,14 @@ namespace Game.Maps
|
||||
i_data.Create();
|
||||
}
|
||||
|
||||
public Group GetOwningGroup() { return i_owningGroupRef.GetTarget(); }
|
||||
|
||||
public void TrySetOwningGroup(Group group)
|
||||
{
|
||||
if (!i_owningGroupRef.IsValid())
|
||||
i_owningGroupRef.Link(group, this);
|
||||
}
|
||||
|
||||
public bool Reset(InstanceResetMethod method)
|
||||
{
|
||||
// note: since the map may not be loaded when the instance needs to be reset
|
||||
@@ -5149,6 +5157,7 @@ namespace Game.Maps
|
||||
uint i_script_id;
|
||||
InstanceScenario i_scenario;
|
||||
InstanceLock i_instanceLock;
|
||||
GroupInstanceReference i_owningGroupRef = new();
|
||||
bool m_resetAfterUnload;
|
||||
bool m_unloadWhenEmpty;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user