Core/Entities: Remove phasemask
This commit is contained in:
@@ -96,7 +96,6 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
_Create(ObjectGuid.Create(HighGuid.AreaTrigger, GetMapId(), GetTemplate().Id, caster.GetMap().GenerateLowGuid(HighGuid.AreaTrigger)));
|
||||
SetPhaseMask(caster.GetPhaseMask(), false);
|
||||
|
||||
SetEntry(GetTemplate().Id);
|
||||
SetDuration(duration);
|
||||
|
||||
@@ -111,7 +111,6 @@ namespace Game.Entities
|
||||
Relocate(pos);
|
||||
|
||||
base._Create(ObjectGuid.Create(HighGuid.Conversation, GetMapId(), conversationEntry, lowGuid));
|
||||
SetPhaseMask(creator.GetPhaseMask(), false);
|
||||
CopyPhaseFrom(creator);
|
||||
|
||||
SetEntry(conversationEntry);
|
||||
|
||||
@@ -78,7 +78,6 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
_Create(ObjectGuid.Create(HighGuid.Corpse, owner.GetMapId(), 0, guidlow));
|
||||
SetPhaseMask(owner.GetPhaseMask(), false);
|
||||
|
||||
SetObjectScale(1);
|
||||
SetGuidValue(CorpseFields.Owner, owner.GetGUID());
|
||||
|
||||
@@ -720,7 +720,7 @@ namespace Game.Entities
|
||||
GetMotionMaster().Initialize();
|
||||
}
|
||||
|
||||
public bool Create(ulong guidlow, Map map, uint phaseMask, uint entry, float x, float y, float z, float ang, CreatureData data = null, uint vehId = 0)
|
||||
public bool Create(ulong guidlow, Map map, uint entry, float x, float y, float z, float ang, CreatureData data = null, uint vehId = 0)
|
||||
{
|
||||
SetMap(map);
|
||||
|
||||
@@ -1044,8 +1044,8 @@ namespace Game.Entities
|
||||
data.unit_flags3 = unitFlags3;
|
||||
data.dynamicflags = dynamicflags;
|
||||
|
||||
data.phaseId = (uint)(GetDBPhase() > 0 ? GetDBPhase() : 0);
|
||||
data.phaseGroup = (uint)(GetDBPhase() < 0 ? Math.Abs(GetDBPhase()) : 0);
|
||||
data.phaseId = GetDBPhase() > 0 ? (uint)GetDBPhase() : data.phaseId;
|
||||
data.phaseGroup = GetDBPhase() < 0 ? (uint)-GetDBPhase() : data.phaseGroup;
|
||||
|
||||
// update in DB
|
||||
SQLTransaction trans = new SQLTransaction();
|
||||
@@ -1319,7 +1319,7 @@ namespace Game.Entities
|
||||
|
||||
m_spawnId = spawnId;
|
||||
m_creatureData = data;
|
||||
if (!Create(map.GenerateLowGuid(HighGuid.Creature), map, PhaseMasks.Normal, data.id, data.posX, data.posY, data.posZ, data.orientation, data))
|
||||
if (!Create(map.GenerateLowGuid(HighGuid.Creature), map, data.id, data.posX, data.posY, data.posZ, data.orientation, data))
|
||||
return false;
|
||||
|
||||
//We should set first home position, because then AI calls home movement
|
||||
|
||||
@@ -88,7 +88,6 @@ namespace Game.Entities
|
||||
}
|
||||
|
||||
_Create(ObjectGuid.Create(HighGuid.DynamicObject, GetMapId(), spell.Id, guidlow));
|
||||
SetPhaseMask(caster.GetPhaseMask(), false);
|
||||
|
||||
SetEntry(spell.Id);
|
||||
SetObjectScale(1f);
|
||||
|
||||
@@ -158,7 +158,7 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public bool Create(uint name_id, Map map, uint phaseMask, Position pos, Quaternion rotation, uint animprogress, GameObjectState go_state, uint artKit = 0)
|
||||
public bool Create(uint name_id, Map map, Position pos, Quaternion rotation, uint animprogress, GameObjectState go_state, uint artKit = 0)
|
||||
{
|
||||
Contract.Assert(map);
|
||||
SetMap(map);
|
||||
@@ -341,7 +341,7 @@ namespace Game.Entities
|
||||
if (linkedEntry != 0)
|
||||
{
|
||||
GameObject linkedGO = new GameObject();
|
||||
if (linkedGO.Create(linkedEntry, map, phaseMask, pos, rotation, 255, GameObjectState.Ready))
|
||||
if (linkedGO.Create(linkedEntry, map, pos, rotation, 255, GameObjectState.Ready))
|
||||
{
|
||||
SetLinkedTrap(linkedGO);
|
||||
map.AddToMap(linkedGO);
|
||||
@@ -877,8 +877,8 @@ namespace Game.Entities
|
||||
data.artKit = GetGoArtKit();
|
||||
Global.ObjectMgr.NewGOData(m_spawnId, data);
|
||||
|
||||
data.phaseId = (uint)(GetDBPhase() > 0 ? GetDBPhase() : 0);
|
||||
data.phaseGroup = (uint)(GetDBPhase() < 0 ? Math.Abs(GetDBPhase()) : 0);
|
||||
data.phaseId = GetDBPhase() > 0 ? (uint)GetDBPhase() : data.phaseId;
|
||||
data.phaseGroup = GetDBPhase() < 0 ? (uint)-GetDBPhase() : data.phaseGroup;
|
||||
|
||||
// Update in DB
|
||||
byte index = 0;
|
||||
@@ -925,7 +925,7 @@ namespace Game.Entities
|
||||
uint artKit = data.artKit;
|
||||
|
||||
m_spawnId = spawnId;
|
||||
if (!Create(entry, map, PhaseMasks.Normal, pos, data.rotation, animprogress, go_state, artKit))
|
||||
if (!Create(entry, map, pos, data.rotation, animprogress, go_state, artKit))
|
||||
return false;
|
||||
|
||||
if (data.phaseId != 0)
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace Game.Entities
|
||||
{
|
||||
_name = "";
|
||||
m_isWorldObject = isWorldObject;
|
||||
phaseMask = PhaseMasks.Normal;
|
||||
|
||||
m_serverSideVisibility.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive | GhostVisibilityType.Ghost);
|
||||
m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.Ghost, GhostVisibilityType.Alive);
|
||||
@@ -2045,7 +2044,7 @@ namespace Game.Entities
|
||||
|
||||
Map map = GetMap();
|
||||
GameObject go = new GameObject();
|
||||
if (!go.Create(entry, map, GetPhaseMask(), pos, rotation, 255, GameObjectState.Ready))
|
||||
if (!go.Create(entry, map, pos, rotation, 255, GameObjectState.Ready))
|
||||
return null;
|
||||
|
||||
go.CopyPhaseFrom(this);
|
||||
@@ -2155,14 +2154,6 @@ namespace Game.Entities
|
||||
return (valuesCount > (uint)UnitFields.CombatReach) ? GetFloatValue(UnitFields.CombatReach) : SharedConst.DefaultWorldObjectSize;
|
||||
}
|
||||
|
||||
public virtual void SetPhaseMask(uint newPhaseMask, bool update)
|
||||
{
|
||||
phaseMask = newPhaseMask;
|
||||
|
||||
if (update && IsInWorld)
|
||||
UpdateObjectVisibility();
|
||||
}
|
||||
|
||||
bool HasInPhaseList(uint phase)
|
||||
{
|
||||
return _phases.Contains(phase);
|
||||
@@ -2209,20 +2200,14 @@ namespace Game.Entities
|
||||
foreach (var eff in auraPhaseList)
|
||||
{
|
||||
uint phase = (uint)eff.GetMiscValueB();
|
||||
bool up = SetInPhase(phase, false, true);
|
||||
if (!updateNeeded && up)
|
||||
updateNeeded = true;
|
||||
updateNeeded = SetInPhase(phase, false, true) || updateNeeded;
|
||||
}
|
||||
var auraPhaseGroupList = unit.GetAuraEffectsByType(AuraType.PhaseGroup);
|
||||
foreach (var eff in auraPhaseGroupList)
|
||||
{
|
||||
bool up = false;
|
||||
uint phaseGroup = (uint)eff.GetMiscValueB();
|
||||
foreach (uint phase in Global.DB2Mgr.GetPhasesForGroup(phaseGroup))
|
||||
up = SetInPhase(phase, false, true);
|
||||
|
||||
if (!updateNeeded && up)
|
||||
updateNeeded = true;
|
||||
updateNeeded = SetInPhase(phase, false, true) || updateNeeded;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2242,13 +2227,17 @@ namespace Game.Entities
|
||||
{
|
||||
if (apply)
|
||||
{
|
||||
if (HasInPhaseList(id)) // do not run the updates if we are already in this phase
|
||||
// do not run the updates if we are already in this phase
|
||||
if (_phases.Contains(id))
|
||||
return false;
|
||||
|
||||
_phases.Add(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_phases.Contains(id))
|
||||
return false;
|
||||
|
||||
// if area phase passes the condition we should not remove it (ie: if remove called from aura remove)
|
||||
// this however breaks the .mod phase command, you wont be able to remove any area based phases with it
|
||||
var phases = Global.ObjectMgr.GetPhasesForArea(GetAreaId());
|
||||
@@ -2262,8 +2251,6 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
if (!HasInPhaseList(id)) // do not run the updates if we are not in this phase
|
||||
return false;
|
||||
_phases.Remove(id);
|
||||
}
|
||||
}
|
||||
@@ -2400,7 +2387,6 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public uint GetPhaseMask() { return phaseMask; }
|
||||
public List<uint> GetPhases() { return _phases; }
|
||||
public List<uint> GetTerrainSwaps() { return _terrainSwaps; }
|
||||
public List<uint> GetWorldMapAreaSwaps() { return _worldMapAreaSwaps; }
|
||||
@@ -3172,7 +3158,6 @@ namespace Game.Entities
|
||||
Transport m_transport;
|
||||
Map _currMap;
|
||||
uint instanceId;
|
||||
uint phaseMask;
|
||||
List<uint> _phases = new List<uint>();
|
||||
List<uint> _terrainSwaps = new List<uint>();
|
||||
List<uint> _worldMapAreaSwaps = new List<uint>();
|
||||
|
||||
@@ -474,7 +474,7 @@ namespace Game.Entities
|
||||
pos.GetPosition(out x, out y, out z, out o);
|
||||
CalculatePassengerPosition(ref x, ref y, ref z, ref o);
|
||||
|
||||
if (!summon.Create(map.GenerateLowGuid(HighGuid.Creature), map, 0, entry, x, y, z, o, null, vehId))
|
||||
if (!summon.Create(map.GenerateLowGuid(HighGuid.Creature), map, entry, x, y, z, o, null, vehId))
|
||||
return null;
|
||||
|
||||
foreach (var phase in phases)
|
||||
|
||||
Reference in New Issue
Block a user