Core/Entities: Phasing rewrite

This commit is contained in:
hondacrx
2018-03-28 11:09:30 -04:00
parent caad52f636
commit fa35d60f60
72 changed files with 2254 additions and 1146 deletions
+1 -1
View File
@@ -3550,7 +3550,7 @@ namespace Game.Entities
if (!CliDB.MapStorage.ContainsKey(map))
return 0;
zone = Global.MapMgr.GetZoneId(map, posx, posy, posz);
zone = Global.MapMgr.GetZoneId(PhasingHandler.EmptyPhaseShift, map, posx, posy, posz);
if (zone > 0)
{
@@ -191,6 +191,7 @@ namespace Game.Entities
SpecializationInfo _specializationInfo;
public List<ObjectGuid> m_clientGUIDs = new List<ObjectGuid>();
public List<ObjectGuid> m_visibleTransports = new List<ObjectGuid>();
public WorldObject seerView;
// only changed for direct client control (possess, vehicle etc.), not stuff you control using pet commands
public Unit m_unitMovedByMe;
+2 -4
View File
@@ -120,7 +120,7 @@ namespace Game.Entities
UpdatePvPState(true);
UpdateAreaDependentAuras(newArea);
UpdateAreaAndZonePhase();
PhasingHandler.OnAreaChange(this);
if (IsAreaThatActivatesPvpTalents(newArea))
EnablePvpRules();
@@ -232,8 +232,6 @@ namespace Game.Entities
UpdateLocalChannels(newZone);
UpdateZoneDependentAuras(newZone);
UpdateAreaAndZonePhase();
}
public InstanceBind GetBoundInstance(uint mapid, Difficulty difficulty, bool withExpired = false)
@@ -721,7 +719,7 @@ namespace Game.Entities
public override void UpdateUnderwaterState(Map m, float x, float y, float z)
{
LiquidData liquid_status;
ZLiquidStatus res = m.getLiquidStatus(x, y, z, MapConst.MapAllLiquidTypes, out liquid_status);
ZLiquidStatus res = m.getLiquidStatus(GetPhaseShift(), x, y, z, MapConst.MapAllLiquidTypes, out liquid_status);
if (res == 0)
{
m_MirrorTimerFlags &= ~(PlayerUnderwaterState.InWater | PlayerUnderwaterState.InLava | PlayerUnderwaterState.InSlime | PlayerUnderwaterState.InDarkWater);
+1 -1
View File
@@ -1817,7 +1817,7 @@ namespace Game.Entities
}
UpdateForQuestWorldObjects();
SendUpdatePhasing();
PhasingHandler.OnConditionChange(this);
}
public QuestGiverStatus GetQuestDialogStatus(WorldObject questgiver)
+16 -14
View File
@@ -1937,7 +1937,7 @@ namespace Game.Entities
public override bool IsUnderWater()
{
return IsInWater() &&
GetPositionZ() < (GetMap().GetWaterLevel(GetPositionX(), GetPositionY()) - 2);
GetPositionZ() < (GetMap().GetWaterLevel(GetPhaseShift(), GetPositionX(), GetPositionY()) - 2);
}
public override bool IsInWater()
{
@@ -2117,9 +2117,16 @@ namespace Game.Entities
}
public bool IsInAreaTriggerRadius(AreaTriggerRecord trigger)
{
if (trigger == null || GetMapId() != trigger.ContinentID)
if (trigger == null)
return false;
if (GetMapId() != trigger.ContinentID && !GetPhaseShift().HasVisibleMapId(trigger.ContinentID))
return false;
if (trigger.PhaseID != 0 || trigger.PhaseGroupID != 0 || trigger.PhaseUseFlags != 0)
if (!PhasingHandler.InDbPhaseShift(this, (PhaseUseFlagsValues)trigger.PhaseUseFlags, trigger.PhaseID, trigger.PhaseGroupID))
return false;
if (trigger.Radius > 0.0f)
{
// if we have radius check it
@@ -2203,10 +2210,13 @@ namespace Game.Entities
getHostileRefManager().setOnlineOfflineState(false);
CombatStopWithPets();
PhasingHandler.SetAlwaysVisible(GetPhaseShift(), true);
m_serverSideVisibilityDetect.SetValue(ServerSideVisibilityType.GM, GetSession().GetSecurity());
}
else
{
PhasingHandler.SetAlwaysVisible(GetPhaseShift(), false);
m_ExtraFlags &= ~PlayerExtraFlags.GMOn;
SetFactionForRace(GetRace());
RemoveFlag(PlayerFields.Flags, PlayerFlags.GM);
@@ -4820,7 +4830,7 @@ namespace Game.Entities
return null;
}
pet.CopyPhaseFrom(this);
PhasingHandler.InheritPhaseShift(pet, this);
pet.SetCreatorGUID(GetGUID());
pet.SetUInt32Value(UnitFields.FactionTemplate, getFaction());
@@ -5691,6 +5701,8 @@ namespace Game.Entities
SendRaidDifficulty(difficulty.Flags.HasAnyFlag(DifficultyFlags.Legacy));
}
PhasingHandler.OnMapChange(this);
if (_garrison != null)
_garrison.SendRemoteInfo();
@@ -6202,7 +6214,7 @@ namespace Game.Entities
return;
bool isOutdoor;
uint areaId = GetMap().GetAreaId(GetPositionX(), GetPositionY(), GetPositionZ(), out isOutdoor);
uint areaId = GetMap().GetAreaId(GetPhaseShift(), GetPositionX(), GetPositionY(), GetPositionZ(), out isOutdoor);
AreaTableRecord areaEntry = CliDB.AreaTableStorage.LookupByKey(areaId);
if (WorldConfig.GetBoolValue(WorldCfg.VmapIndoorCheck) && !isOutdoor)
@@ -7307,16 +7319,6 @@ namespace Game.Entities
SendMessageToSet(cancelAutoRepeat, false);
}
public void SendUpdatePhasing()
{
if (!IsInWorld)
return;
RebuildTerrainSwaps(); // to set default map swaps
GetSession().SendSetPhaseShift(GetPhases(), GetTerrainSwaps(), GetWorldMapAreaSwaps());
}
public override void BuildCreateUpdateBlockForPlayer(UpdateData data, Player target)
{
if (target == this)