Core/Spell: fix LoS checks for GameObject spells
Port From (https://github.com/TrinityCore/TrinityCore/commit/50fe2dc7e305fa32d30bac6ad0ced2e5647ac02b)
This commit is contained in:
@@ -1464,7 +1464,7 @@ namespace Framework.Constants
|
|||||||
All = (Normal | Magic),
|
All = (Normal | Magic),
|
||||||
}
|
}
|
||||||
|
|
||||||
[System.Flags]
|
[Flags]
|
||||||
public enum SpellCastFlags : uint
|
public enum SpellCastFlags : uint
|
||||||
{
|
{
|
||||||
None = 0x0,
|
None = 0x0,
|
||||||
|
|||||||
@@ -275,6 +275,19 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public uint GetRequireLOS() => type switch
|
||||||
|
{
|
||||||
|
GameObjectTypes.Button => Button.requireLOS,
|
||||||
|
GameObjectTypes.QuestGiver => QuestGiver.requireLOS,
|
||||||
|
GameObjectTypes.Chest => Chest.requireLOS,
|
||||||
|
GameObjectTypes.Trap => Trap.requireLOS,
|
||||||
|
GameObjectTypes.Goober => Goober.requireLOS,
|
||||||
|
GameObjectTypes.FlagStand => FlagStand.requireLOS,
|
||||||
|
GameObjectTypes.NewFlag => NewFlag.requireLOS,
|
||||||
|
GameObjectTypes.GatheringNode => GatheringNode.requireLOS,
|
||||||
|
_ => 0,
|
||||||
|
};
|
||||||
|
|
||||||
public uint GetLockId()
|
public uint GetLockId()
|
||||||
{
|
{
|
||||||
switch (type)
|
switch (type)
|
||||||
|
|||||||
@@ -6557,6 +6557,12 @@ namespace Game.Spells
|
|||||||
if (m_spellInfo.HasAttribute(SpellAttr2.CanTargetNotInLos) || Global.DisableMgr.IsDisabledFor(DisableType.Spell, m_spellInfo.Id, null, (byte)DisableFlags.SpellLOS))
|
if (m_spellInfo.HasAttribute(SpellAttr2.CanTargetNotInLos) || Global.DisableMgr.IsDisabledFor(DisableType.Spell, m_spellInfo.Id, null, (byte)DisableFlags.SpellLOS))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
// check if gameobject ignores LOS
|
||||||
|
GameObject gobCaster = m_caster.ToGameObject();
|
||||||
|
if (gobCaster != null)
|
||||||
|
if (!gobCaster.GetGoInfo().GetRequireLOS())
|
||||||
|
return true;
|
||||||
|
|
||||||
// if spell is triggered, need to check for LOS disable on the aura triggering it and inherit that behaviour
|
// if spell is triggered, need to check for LOS disable on the aura triggering it and inherit that behaviour
|
||||||
if (IsTriggered() && m_triggeredByAuraSpell != null && (m_triggeredByAuraSpell.HasAttribute(SpellAttr2.CanTargetNotInLos) || Global.DisableMgr.IsDisabledFor(DisableType.Spell, m_triggeredByAuraSpell.Id, null, (byte)DisableFlags.SpellLOS)))
|
if (IsTriggered() && m_triggeredByAuraSpell != null && (m_triggeredByAuraSpell.HasAttribute(SpellAttr2.CanTargetNotInLos) || Global.DisableMgr.IsDisabledFor(DisableType.Spell, m_triggeredByAuraSpell.Id, null, (byte)DisableFlags.SpellLOS)))
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Reference in New Issue
Block a user