Core/Phasing: Implemented setting personal guid on PhaseShift
Port From (https://github.com/TrinityCore/TrinityCore/commit/ec9f5be6a657003a94f95b4e4067a37a9f113c7c)
This commit is contained in:
@@ -53,16 +53,24 @@ namespace Game
|
||||
}
|
||||
|
||||
public static void AddPhase(WorldObject obj, uint phaseId, bool updateVisibility)
|
||||
{
|
||||
AddPhase(obj, phaseId, obj.GetGUID(), updateVisibility);
|
||||
}
|
||||
|
||||
static void AddPhase(WorldObject obj, uint phaseId, ObjectGuid personalGuid, bool updateVisibility)
|
||||
{
|
||||
bool changed = obj.GetPhaseShift().AddPhase(phaseId, GetPhaseFlags(phaseId), null);
|
||||
|
||||
if (obj.GetPhaseShift().PersonalReferences != 0)
|
||||
obj.GetPhaseShift().PersonalGuid = personalGuid;
|
||||
|
||||
Unit unit = obj.ToUnit();
|
||||
if (unit)
|
||||
{
|
||||
unit.OnPhaseChange();
|
||||
ForAllControlled(unit, controlled =>
|
||||
{
|
||||
AddPhase(controlled, phaseId, updateVisibility);
|
||||
AddPhase(controlled, phaseId, personalGuid, updateVisibility);
|
||||
});
|
||||
unit.RemoveNotOwnSingleTargetAuras(true);
|
||||
}
|
||||
@@ -89,6 +97,11 @@ namespace Game
|
||||
}
|
||||
|
||||
public static void AddPhaseGroup(WorldObject obj, uint phaseGroupId, bool updateVisibility)
|
||||
{
|
||||
AddPhaseGroup(obj, phaseGroupId, obj.GetGUID(), updateVisibility);
|
||||
}
|
||||
|
||||
static void AddPhaseGroup(WorldObject obj, uint phaseGroupId, ObjectGuid personalGuid, bool updateVisibility)
|
||||
{
|
||||
var phasesInGroup = Global.DB2Mgr.GetPhasesForGroup(phaseGroupId);
|
||||
if (phasesInGroup.Empty())
|
||||
@@ -98,13 +111,16 @@ namespace Game
|
||||
foreach (uint phaseId in phasesInGroup)
|
||||
changed = obj.GetPhaseShift().AddPhase(phaseId, GetPhaseFlags(phaseId), null) || changed;
|
||||
|
||||
if (obj.GetPhaseShift().PersonalReferences != 0)
|
||||
obj.GetPhaseShift().PersonalGuid = personalGuid;
|
||||
|
||||
Unit unit = obj.ToUnit();
|
||||
if (unit)
|
||||
{
|
||||
unit.OnPhaseChange();
|
||||
ForAllControlled(unit, controlled =>
|
||||
{
|
||||
AddPhaseGroup(controlled, phaseGroupId, updateVisibility);
|
||||
AddPhaseGroup(controlled, phaseGroupId, personalGuid, updateVisibility);
|
||||
});
|
||||
unit.RemoveNotOwnSingleTargetAuras(true);
|
||||
}
|
||||
@@ -266,6 +282,9 @@ namespace Game
|
||||
changed = phaseShift.AddPhase(phaseId, GetPhaseFlags(phaseId), null) || changed;
|
||||
}
|
||||
|
||||
if (phaseShift.PersonalReferences != 0)
|
||||
phaseShift.PersonalGuid = unit.GetGUID();
|
||||
|
||||
if (changed)
|
||||
unit.OnPhaseChange();
|
||||
|
||||
@@ -277,6 +296,11 @@ namespace Game
|
||||
if (changed)
|
||||
unit.RemoveNotOwnSingleTargetAuras(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (phaseShift.PersonalReferences != 0)
|
||||
phaseShift.PersonalGuid = obj.GetGUID();
|
||||
}
|
||||
|
||||
UpdateVisibilityIfNeeded(obj, true, changed);
|
||||
}
|
||||
@@ -360,6 +384,9 @@ namespace Game
|
||||
}
|
||||
}
|
||||
|
||||
if (phaseShift.PersonalReferences != 0)
|
||||
phaseShift.PersonalGuid = obj.GetGUID();
|
||||
|
||||
changed = changed || !newSuppressions.Phases.Empty() || !newSuppressions.VisibleMapIds.Empty();
|
||||
foreach (var pair in newSuppressions.Phases)
|
||||
suppressedPhaseShift.AddPhase(pair.Key, pair.Value.Flags, pair.Value.AreaConditions, pair.Value.References);
|
||||
|
||||
Reference in New Issue
Block a user