Core/Entities: Phasing rewrite
This commit is contained in:
@@ -1283,28 +1283,17 @@ namespace Game.Spells
|
||||
|
||||
Unit target = aurApp.GetTarget();
|
||||
|
||||
var oldPhases = target.GetPhases();
|
||||
target.SetInPhase((uint)GetMiscValueB(), false, apply);
|
||||
|
||||
// call functions which may have additional effects after chainging state of unit
|
||||
// phase auras normally not expected at BG but anyway better check
|
||||
if (apply)
|
||||
{
|
||||
PhasingHandler.AddPhase(target, (uint)GetMiscValueB(), true);
|
||||
|
||||
// call functions which may have additional effects after chainging state of unit
|
||||
// phase auras normally not expected at BG but anyway better check
|
||||
// drop flag at invisibiliy in bg
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ImmuneOrLostSelection);
|
||||
}
|
||||
|
||||
Player player = target.ToPlayer();
|
||||
if (player)
|
||||
{
|
||||
if (player.IsInWorld)
|
||||
player.GetMap().SendUpdateTransportVisibility(player, oldPhases);
|
||||
player.SendUpdatePhasing();
|
||||
}
|
||||
|
||||
// need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
|
||||
if (target.IsVisible())
|
||||
target.UpdateObjectVisibility();
|
||||
else
|
||||
PhasingHandler.RemovePhase(target, (uint)GetMiscValueB(), true);
|
||||
}
|
||||
|
||||
[AuraEffectHandler(AuraType.PhaseGroup)]
|
||||
@@ -1314,29 +1303,18 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
Unit target = aurApp.GetTarget();
|
||||
var oldPhases = target.GetPhases();
|
||||
var phases = Global.DB2Mgr.GetPhasesForGroup((uint)GetMiscValueB());
|
||||
foreach (var phase in phases)
|
||||
target.SetInPhase(phase, false, apply);
|
||||
// call functions which may have additional effects after chainging state of unit
|
||||
// phase auras normally not expected at BG but anyway better check
|
||||
|
||||
if (apply)
|
||||
{
|
||||
PhasingHandler.AddPhaseGroup(target, (uint)GetMiscValueB(), true);
|
||||
|
||||
// call functions which may have additional effects after chainging state of unit
|
||||
// phase auras normally not expected at BG but anyway better check
|
||||
// drop flag at invisibiliy in bg
|
||||
target.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.ImmuneOrLostSelection);
|
||||
}
|
||||
|
||||
Player player = target.ToPlayer();
|
||||
if (player)
|
||||
{
|
||||
if (player.IsInWorld)
|
||||
player.GetMap().SendUpdateTransportVisibility(player, oldPhases);
|
||||
player.SendUpdatePhasing();
|
||||
}
|
||||
|
||||
// need triggering visibility update base at phase update of not GM invisible (other GMs anyway see in any phases)
|
||||
if (target.IsVisible())
|
||||
target.UpdateObjectVisibility();
|
||||
else
|
||||
PhasingHandler.RemovePhaseGroup(target, (uint)GetMiscValueB(), true);
|
||||
}
|
||||
|
||||
/**********************/
|
||||
|
||||
@@ -794,15 +794,19 @@ namespace Game.Spells
|
||||
break;
|
||||
case Targets.DestCasterFishing:
|
||||
{
|
||||
float min_dis = m_spellInfo.GetMinRange(true);
|
||||
float max_dis = m_spellInfo.GetMaxRange(true);
|
||||
float dis = (float)RandomHelper.NextDouble() * (max_dis - min_dis) + min_dis;
|
||||
float minDist = m_spellInfo.GetMinRange(true);
|
||||
float maxDist = m_spellInfo.GetMaxRange(true);
|
||||
float dis = (float)RandomHelper.NextDouble() * (maxDist - minDist) + minDist;
|
||||
float x, y, z;
|
||||
float angle = (float)RandomHelper.NextDouble() * (MathFunctions.PI * 35.0f / 180.0f) - (float)(Math.PI * 17.5f / 180.0f);
|
||||
m_caster.GetClosePoint(out x, out y, out z, SharedConst.DefaultWorldObjectSize, dis, angle);
|
||||
|
||||
float ground = z;
|
||||
float liquidLevel = m_caster.GetMap().GetWaterOrGroundLevel(m_caster.GetPhases(), x, y, z, ref ground);
|
||||
float ground = m_caster.GetMap().GetHeight(m_caster.GetPhaseShift(), x, y, z, true, 50.0f);
|
||||
float liquidLevel = MapConst.VMAPInvalidHeightValue;
|
||||
LiquidData liquidData;
|
||||
if (m_caster.GetMap().getLiquidStatus(m_caster.GetPhaseShift(), x, y, z, MapConst.MapAllLiquidTypes, out liquidData) != 0)
|
||||
liquidLevel = liquidData.level;
|
||||
|
||||
if (liquidLevel <= ground) // When there is no liquid Map.GetWaterOrGroundLevel returns ground level
|
||||
{
|
||||
SendCastResult(SpellCastResult.NotHere);
|
||||
@@ -4458,11 +4462,11 @@ namespace Game.Spells
|
||||
if (m_caster.IsTypeId(TypeId.Player) && Global.VMapMgr.isLineOfSightCalcEnabled())
|
||||
{
|
||||
if (m_spellInfo.HasAttribute(SpellAttr0.OutdoorsOnly) &&
|
||||
!m_caster.GetMap().IsOutdoors(m_caster.posX, m_caster.posY, m_caster.posZ))
|
||||
!m_caster.GetMap().IsOutdoors(m_caster.GetPhaseShift(), m_caster.posX, m_caster.posY, m_caster.posZ))
|
||||
return SpellCastResult.OnlyOutdoors;
|
||||
|
||||
if (m_spellInfo.HasAttribute(SpellAttr0.IndoorsOnly) &&
|
||||
m_caster.GetMap().IsOutdoors(m_caster.posX, m_caster.posY, m_caster.posZ))
|
||||
m_caster.GetMap().IsOutdoors(m_caster.GetPhaseShift(), m_caster.posX, m_caster.posY, m_caster.posZ))
|
||||
return SpellCastResult.OnlyIndoors;
|
||||
}
|
||||
|
||||
|
||||
@@ -2857,7 +2857,7 @@ namespace Game.Spells
|
||||
if (!go)
|
||||
return;
|
||||
|
||||
go.CopyPhaseFrom(m_caster);
|
||||
PhasingHandler.InheritPhaseShift(go, m_caster);
|
||||
|
||||
int duration = m_spellInfo.CalcDuration(m_caster);
|
||||
|
||||
@@ -2883,7 +2883,7 @@ namespace Game.Spells
|
||||
GameObject linkedTrap = go.GetLinkedTrap();
|
||||
if (linkedTrap)
|
||||
{
|
||||
linkedTrap.CopyPhaseFrom(m_caster);
|
||||
PhasingHandler.InheritPhaseShift(linkedTrap, m_caster);
|
||||
linkedTrap.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
|
||||
linkedTrap.SetSpellId(m_spellInfo.Id);
|
||||
|
||||
@@ -3518,7 +3518,7 @@ namespace Game.Spells
|
||||
if (!go)
|
||||
return;
|
||||
|
||||
go.CopyPhaseFrom(m_caster);
|
||||
PhasingHandler.InheritPhaseShift(go, m_caster);
|
||||
|
||||
go.SetUInt32Value(GameObjectFields.Faction, m_caster.getFaction());
|
||||
go.SetUInt32Value(GameObjectFields.Level, m_caster.getLevel() + 1);
|
||||
@@ -3858,7 +3858,7 @@ namespace Game.Spells
|
||||
if (!go)
|
||||
return;
|
||||
|
||||
go.CopyPhaseFrom(m_caster);
|
||||
PhasingHandler.InheritPhaseShift(go, m_caster);
|
||||
|
||||
int duration = m_spellInfo.CalcDuration(m_caster);
|
||||
go.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
|
||||
@@ -4545,7 +4545,7 @@ namespace Game.Spells
|
||||
if (!go)
|
||||
return;
|
||||
|
||||
go.CopyPhaseFrom(m_caster);
|
||||
PhasingHandler.InheritPhaseShift(go, m_caster);
|
||||
|
||||
int duration = m_spellInfo.CalcDuration(m_caster);
|
||||
|
||||
@@ -4603,7 +4603,7 @@ namespace Game.Spells
|
||||
GameObject linkedTrap = go.GetLinkedTrap();
|
||||
if (linkedTrap != null)
|
||||
{
|
||||
linkedTrap.CopyPhaseFrom(m_caster);
|
||||
PhasingHandler.InheritPhaseShift(linkedTrap, m_caster);
|
||||
linkedTrap.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
|
||||
linkedTrap.SetSpellId(m_spellInfo.Id);
|
||||
linkedTrap.SetOwnerGUID(m_caster.GetGUID());
|
||||
@@ -5656,7 +5656,7 @@ namespace Game.Spells
|
||||
if (!unitTarget || !unitTarget.IsTypeId(TypeId.Player))
|
||||
return;
|
||||
|
||||
unitTarget.UpdateAreaAndZonePhase();
|
||||
PhasingHandler.OnConditionChange(unitTarget);
|
||||
}
|
||||
|
||||
[SpellEffectHandler(SpellEffectName.UpdateZoneAurasPhases)]
|
||||
|
||||
Reference in New Issue
Block a user