Core/Spells: Allow implicit targeting of serverside WorldObjects
Port From (https://github.com/TrinityCore/TrinityCore/commit/5d5ca30b232586ad378671bf0ac8407495dea188)
This commit is contained in:
@@ -1044,9 +1044,9 @@ namespace Game.Entities
|
||||
|
||||
public bool IsServerSide() { return _areaTriggerTemplate.Id.IsServerSide; }
|
||||
|
||||
public override bool IsNeverVisibleFor(WorldObject seer)
|
||||
public override bool IsNeverVisibleFor(WorldObject seer, bool allowServersideObjects = false)
|
||||
{
|
||||
return base.IsNeverVisibleFor(seer) || IsServerSide();
|
||||
return base.IsNeverVisibleFor(seer) || (IsServerSide() && !allowServersideObjects);
|
||||
}
|
||||
|
||||
[System.Diagnostics.Conditional("DEBUG")]
|
||||
|
||||
@@ -1279,12 +1279,12 @@ namespace Game.Entities
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsNeverVisibleFor(WorldObject seer)
|
||||
public override bool IsNeverVisibleFor(WorldObject seer, bool allowServersideObjects = false)
|
||||
{
|
||||
if (base.IsNeverVisibleFor(seer))
|
||||
return true;
|
||||
|
||||
if (GetGoInfo().GetServerOnly() != 0)
|
||||
if (GetGoInfo().GetServerOnly() != 0 && !allowServersideObjects)
|
||||
return true;
|
||||
|
||||
if (GetDisplayId() == 0)
|
||||
|
||||
@@ -1159,12 +1159,12 @@ namespace Game.Entities
|
||||
|
||||
public SmoothPhasing GetSmoothPhasing() { return _smoothPhasing; }
|
||||
|
||||
public bool CanSeeOrDetect(WorldObject obj, bool ignoreStealth = false, bool distanceCheck = false, bool checkAlert = false)
|
||||
public bool CanSeeOrDetect(WorldObject obj, bool implicitDetect = false, bool distanceCheck = false, bool checkAlert = false)
|
||||
{
|
||||
if (this == obj)
|
||||
return true;
|
||||
|
||||
if (obj.IsNeverVisibleFor(this) || CanNeverSee(obj))
|
||||
if (obj.IsNeverVisibleFor(this, implicitDetect) || CanNeverSee(obj))
|
||||
return false;
|
||||
|
||||
if (obj.IsAlwaysVisibleFor(this) || CanAlwaysSee(obj))
|
||||
@@ -1256,7 +1256,7 @@ namespace Game.Entities
|
||||
if (obj.IsInvisibleDueToDespawn(this))
|
||||
return false;
|
||||
|
||||
if (!CanDetect(obj, ignoreStealth, checkAlert))
|
||||
if (!CanDetect(obj, implicitDetect, checkAlert))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -1269,7 +1269,7 @@ namespace Game.Entities
|
||||
|
||||
public virtual bool CanAlwaysSee(WorldObject obj) { return false; }
|
||||
|
||||
bool CanDetect(WorldObject obj, bool ignoreStealth, bool checkAlert = false)
|
||||
bool CanDetect(WorldObject obj, bool implicitDetect, bool checkAlert = false)
|
||||
{
|
||||
WorldObject seer = this;
|
||||
|
||||
@@ -1295,10 +1295,10 @@ namespace Game.Entities
|
||||
if (obj.IsAlwaysDetectableFor(seer))
|
||||
return true;
|
||||
|
||||
if (!ignoreStealth && !seer.CanDetectInvisibilityOf(obj))
|
||||
if (!implicitDetect && !seer.CanDetectInvisibilityOf(obj))
|
||||
return false;
|
||||
|
||||
if (!ignoreStealth && !seer.CanDetectStealthOf(obj, checkAlert))
|
||||
if (!implicitDetect && !seer.CanDetectStealthOf(obj, checkAlert))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@@ -3076,7 +3076,7 @@ namespace Game.Entities
|
||||
public virtual float GetCollisionHeight() { return 0.0f; }
|
||||
public float GetMidsectionHeight() { return GetCollisionHeight() / 2.0f; }
|
||||
|
||||
public virtual bool IsNeverVisibleFor(WorldObject seer) { return !IsInWorld || IsDestroyedObject(); }
|
||||
public virtual bool IsNeverVisibleFor(WorldObject seer, bool allowServersideObjects = false) { return !IsInWorld || IsDestroyedObject(); }
|
||||
public virtual bool IsAlwaysVisibleFor(WorldObject seer) { return false; }
|
||||
public virtual bool IsInvisibleDueToDespawn(WorldObject seer) { return false; }
|
||||
public virtual bool IsAlwaysDetectableFor(WorldObject seer) { return false; }
|
||||
|
||||
@@ -3648,9 +3648,9 @@ namespace Game.Entities
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool IsNeverVisibleFor(WorldObject seer)
|
||||
public override bool IsNeverVisibleFor(WorldObject seer, bool allowServersideObjects = false)
|
||||
{
|
||||
if (base.IsNeverVisibleFor(seer))
|
||||
if (base.IsNeverVisibleFor(seer, allowServersideObjects))
|
||||
return true;
|
||||
|
||||
if (GetSession().PlayerLogout() || GetSession().PlayerLoading())
|
||||
|
||||
@@ -993,7 +993,7 @@ namespace Game.Spells
|
||||
if (HasAttribute(SpellAttr1.ExcludeCaster) && caster == target)
|
||||
return SpellCastResult.BadTargets;
|
||||
|
||||
// check visibility - ignore stealth for implicit (area) targets
|
||||
// check visibility - ignore invisibility/stealth for implicit (area) targets
|
||||
if (!HasAttribute(SpellAttr6.IgnorePhaseShift) && !caster.CanSeeOrDetect(target, Implicit))
|
||||
return SpellCastResult.BadTargets;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user