Core/Phasing: Implemented setting personal guid on PhaseShift
Port From (https://github.com/TrinityCore/TrinityCore/commit/ec9f5be6a657003a94f95b4e4067a37a9f113c7c)
This commit is contained in:
@@ -2165,7 +2165,7 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PhasingHandler.SetAlwaysVisible(this, !HasAuraType(AuraType.PhaseAlwaysVisible), false);
|
PhasingHandler.SetAlwaysVisible(this, HasAuraType(AuraType.PhaseAlwaysVisible), false);
|
||||||
|
|
||||||
m_ExtraFlags &= ~PlayerExtraFlags.GMOn;
|
m_ExtraFlags &= ~PlayerExtraFlags.GMOn;
|
||||||
SetFactionForRace(GetRace());
|
SetFactionForRace(GetRace());
|
||||||
|
|||||||
@@ -128,7 +128,6 @@ namespace Game
|
|||||||
public void Clear()
|
public void Clear()
|
||||||
{
|
{
|
||||||
ClearPhases();
|
ClearPhases();
|
||||||
PersonalGuid.Clear();
|
|
||||||
VisibleMapIds.Clear();
|
VisibleMapIds.Clear();
|
||||||
UiMapPhaseIds.Clear();
|
UiMapPhaseIds.Clear();
|
||||||
}
|
}
|
||||||
@@ -136,9 +135,11 @@ namespace Game
|
|||||||
public void ClearPhases()
|
public void ClearPhases()
|
||||||
{
|
{
|
||||||
Flags &= PhaseShiftFlags.AlwaysVisible | PhaseShiftFlags.Inverse;
|
Flags &= PhaseShiftFlags.AlwaysVisible | PhaseShiftFlags.Inverse;
|
||||||
|
PersonalGuid.Clear();
|
||||||
Phases.Clear();
|
Phases.Clear();
|
||||||
NonCosmeticReferences = 0;
|
NonCosmeticReferences = 0;
|
||||||
CosmeticReferences = 0;
|
CosmeticReferences = 0;
|
||||||
|
PersonalReferences = 0;
|
||||||
DefaultReferences = 0;
|
DefaultReferences = 0;
|
||||||
UpdateUnphasedFlag();
|
UpdateUnphasedFlag();
|
||||||
}
|
}
|
||||||
@@ -168,7 +169,6 @@ namespace Game
|
|||||||
if (phaseShift.Flags.HasFlag(PhaseShiftFlags.Unphased) && !excludedPhaseShift.Flags.HasFlag(PhaseShiftFlags.InverseUnphased))
|
if (phaseShift.Flags.HasFlag(PhaseShiftFlags.Unphased) && !excludedPhaseShift.Flags.HasFlag(PhaseShiftFlags.InverseUnphased))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
var list = excludedPhaseShift.Phases.ToList();
|
|
||||||
foreach (var pair in phaseShift.Phases)
|
foreach (var pair in phaseShift.Phases)
|
||||||
{
|
{
|
||||||
if (pair.Value.Flags.HasAnyFlag(excludePhasesWithFlag))
|
if (pair.Value.Flags.HasAnyFlag(excludePhasesWithFlag))
|
||||||
@@ -201,12 +201,16 @@ namespace Game
|
|||||||
else
|
else
|
||||||
DefaultReferences += references;
|
DefaultReferences += references;
|
||||||
|
|
||||||
|
if (phaseRef.Flags.HasFlag(PhaseFlags.Personal))
|
||||||
|
PersonalReferences += references;
|
||||||
|
|
||||||
if (CosmeticReferences != 0)
|
if (CosmeticReferences != 0)
|
||||||
Flags |= PhaseShiftFlags.NoCosmetic;
|
Flags |= PhaseShiftFlags.NoCosmetic;
|
||||||
else
|
else
|
||||||
Flags &= ~PhaseShiftFlags.NoCosmetic;
|
Flags &= ~PhaseShiftFlags.NoCosmetic;
|
||||||
|
|
||||||
UpdateUnphasedFlag();
|
UpdateUnphasedFlag();
|
||||||
|
UpdatePersonalGuid();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,6 +224,12 @@ namespace Game
|
|||||||
Flags |= unphasedFlag;
|
Flags |= unphasedFlag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UpdatePersonalGuid()
|
||||||
|
{
|
||||||
|
if (PersonalReferences == 0)
|
||||||
|
PersonalGuid.Clear();
|
||||||
|
}
|
||||||
|
|
||||||
public bool HasPhase(uint phaseId) { return Phases.ContainsKey(phaseId); }
|
public bool HasPhase(uint phaseId) { return Phases.ContainsKey(phaseId); }
|
||||||
public Dictionary<uint, PhaseRef> GetPhases() { return Phases; }
|
public Dictionary<uint, PhaseRef> GetPhases() { return Phases; }
|
||||||
|
|
||||||
@@ -227,9 +237,9 @@ namespace Game
|
|||||||
public Dictionary<uint, VisibleMapIdRef> GetVisibleMapIds() { return VisibleMapIds; }
|
public Dictionary<uint, VisibleMapIdRef> GetVisibleMapIds() { return VisibleMapIds; }
|
||||||
|
|
||||||
public bool HasUiWorldMapAreaIdSwap(uint uiWorldMapAreaId) { return UiMapPhaseIds.ContainsKey(uiWorldMapAreaId); }
|
public bool HasUiWorldMapAreaIdSwap(uint uiWorldMapAreaId) { return UiMapPhaseIds.ContainsKey(uiWorldMapAreaId); }
|
||||||
public Dictionary<uint, UiMapPhaseIdRef> GetUiWorldMapAreaIdSwaps() { return UiMapPhaseIds; }
|
public Dictionary<uint, UiMapPhaseIdRef> GetUiMapPhaseIds() { return UiMapPhaseIds; }
|
||||||
|
|
||||||
public PhaseShiftFlags Flags;
|
public PhaseShiftFlags Flags = PhaseShiftFlags.Unphased;
|
||||||
public ObjectGuid PersonalGuid;
|
public ObjectGuid PersonalGuid;
|
||||||
public Dictionary<uint, PhaseRef> Phases = new Dictionary<uint, PhaseRef>();
|
public Dictionary<uint, PhaseRef> Phases = new Dictionary<uint, PhaseRef>();
|
||||||
public Dictionary<uint, VisibleMapIdRef> VisibleMapIds = new Dictionary<uint, VisibleMapIdRef>();
|
public Dictionary<uint, VisibleMapIdRef> VisibleMapIds = new Dictionary<uint, VisibleMapIdRef>();
|
||||||
@@ -237,6 +247,7 @@ namespace Game
|
|||||||
|
|
||||||
int NonCosmeticReferences;
|
int NonCosmeticReferences;
|
||||||
int CosmeticReferences;
|
int CosmeticReferences;
|
||||||
|
public int PersonalReferences;
|
||||||
int DefaultReferences;
|
int DefaultReferences;
|
||||||
public bool IsDbPhaseShift;
|
public bool IsDbPhaseShift;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,16 +53,24 @@ namespace Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void AddPhase(WorldObject obj, uint phaseId, bool updateVisibility)
|
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);
|
bool changed = obj.GetPhaseShift().AddPhase(phaseId, GetPhaseFlags(phaseId), null);
|
||||||
|
|
||||||
|
if (obj.GetPhaseShift().PersonalReferences != 0)
|
||||||
|
obj.GetPhaseShift().PersonalGuid = personalGuid;
|
||||||
|
|
||||||
Unit unit = obj.ToUnit();
|
Unit unit = obj.ToUnit();
|
||||||
if (unit)
|
if (unit)
|
||||||
{
|
{
|
||||||
unit.OnPhaseChange();
|
unit.OnPhaseChange();
|
||||||
ForAllControlled(unit, controlled =>
|
ForAllControlled(unit, controlled =>
|
||||||
{
|
{
|
||||||
AddPhase(controlled, phaseId, updateVisibility);
|
AddPhase(controlled, phaseId, personalGuid, updateVisibility);
|
||||||
});
|
});
|
||||||
unit.RemoveNotOwnSingleTargetAuras(true);
|
unit.RemoveNotOwnSingleTargetAuras(true);
|
||||||
}
|
}
|
||||||
@@ -89,6 +97,11 @@ namespace Game
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void AddPhaseGroup(WorldObject obj, uint phaseGroupId, bool updateVisibility)
|
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);
|
var phasesInGroup = Global.DB2Mgr.GetPhasesForGroup(phaseGroupId);
|
||||||
if (phasesInGroup.Empty())
|
if (phasesInGroup.Empty())
|
||||||
@@ -98,13 +111,16 @@ namespace Game
|
|||||||
foreach (uint phaseId in phasesInGroup)
|
foreach (uint phaseId in phasesInGroup)
|
||||||
changed = obj.GetPhaseShift().AddPhase(phaseId, GetPhaseFlags(phaseId), null) || changed;
|
changed = obj.GetPhaseShift().AddPhase(phaseId, GetPhaseFlags(phaseId), null) || changed;
|
||||||
|
|
||||||
|
if (obj.GetPhaseShift().PersonalReferences != 0)
|
||||||
|
obj.GetPhaseShift().PersonalGuid = personalGuid;
|
||||||
|
|
||||||
Unit unit = obj.ToUnit();
|
Unit unit = obj.ToUnit();
|
||||||
if (unit)
|
if (unit)
|
||||||
{
|
{
|
||||||
unit.OnPhaseChange();
|
unit.OnPhaseChange();
|
||||||
ForAllControlled(unit, controlled =>
|
ForAllControlled(unit, controlled =>
|
||||||
{
|
{
|
||||||
AddPhaseGroup(controlled, phaseGroupId, updateVisibility);
|
AddPhaseGroup(controlled, phaseGroupId, personalGuid, updateVisibility);
|
||||||
});
|
});
|
||||||
unit.RemoveNotOwnSingleTargetAuras(true);
|
unit.RemoveNotOwnSingleTargetAuras(true);
|
||||||
}
|
}
|
||||||
@@ -266,6 +282,9 @@ namespace Game
|
|||||||
changed = phaseShift.AddPhase(phaseId, GetPhaseFlags(phaseId), null) || changed;
|
changed = phaseShift.AddPhase(phaseId, GetPhaseFlags(phaseId), null) || changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (phaseShift.PersonalReferences != 0)
|
||||||
|
phaseShift.PersonalGuid = unit.GetGUID();
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
unit.OnPhaseChange();
|
unit.OnPhaseChange();
|
||||||
|
|
||||||
@@ -277,6 +296,11 @@ namespace Game
|
|||||||
if (changed)
|
if (changed)
|
||||||
unit.RemoveNotOwnSingleTargetAuras(true);
|
unit.RemoveNotOwnSingleTargetAuras(true);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (phaseShift.PersonalReferences != 0)
|
||||||
|
phaseShift.PersonalGuid = obj.GetGUID();
|
||||||
|
}
|
||||||
|
|
||||||
UpdateVisibilityIfNeeded(obj, true, changed);
|
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();
|
changed = changed || !newSuppressions.Phases.Empty() || !newSuppressions.VisibleMapIds.Empty();
|
||||||
foreach (var pair in newSuppressions.Phases)
|
foreach (var pair in newSuppressions.Phases)
|
||||||
suppressedPhaseShift.AddPhase(pair.Key, pair.Value.Flags, pair.Value.AreaConditions, pair.Value.References);
|
suppressedPhaseShift.AddPhase(pair.Key, pair.Value.Flags, pair.Value.AreaConditions, pair.Value.References);
|
||||||
|
|||||||
Reference in New Issue
Block a user