Core/GameObjects: Skip LoS checks for traps

Port From (https://github.com/TrinityCore/TrinityCore/commit/9bede687ce3d291c8af8f4deb3f1dcebba1a315d)
This commit is contained in:
hondacrx
2022-01-05 17:47:29 -05:00
parent ec83cf5a6d
commit 09ef904fa6
2 changed files with 22 additions and 7 deletions
@@ -2999,6 +2999,21 @@ namespace Game.Entities
if (owner != null) if (owner != null)
return owner.GetLevelForTarget(target); return owner.GetLevelForTarget(target);
if (GetGoType() == GameObjectTypes.Trap)
{
Player player = target.ToPlayer();
if (player != null)
{
var userLevels = Global.DB2Mgr.GetContentTuningData(GetGoInfo().ContentTuningId, player.m_playerData.CtrOptions.GetValue().ContentTuningConditionMask);
if (userLevels.HasValue)
return (byte)Math.Clamp(player.GetLevel(), userLevels.Value.MinLevel, userLevels.Value.MaxLevel);
}
Unit targetUnit = target.ToUnit();
if (targetUnit != null)
return targetUnit.GetLevel();
}
return 1; return 1;
} }
+7 -7
View File
@@ -2503,20 +2503,20 @@ namespace Scripts.Spells.Generic
{ {
PreventDefaultAction(); PreventDefaultAction();
Unit caster = GetCaster(); Unit target = GetTarget();
if (caster == null) if (target == null)
return; return;
uint heal = (uint)caster.CountPctFromMaxHealth(10); uint heal = (uint)target.CountPctFromMaxHealth(10);
HealInfo healInfo = new(caster, GetTarget(), heal, GetSpellInfo(), GetSpellInfo().GetSchoolMask()); HealInfo healInfo = new(target, target, heal, GetSpellInfo(), GetSpellInfo().GetSchoolMask());
caster.HealBySpell(healInfo); target.HealBySpell(healInfo);
/// @todo: should proc other auras? /// @todo: should proc other auras?
int mana = caster.GetMaxPower(PowerType.Mana); int mana = target.GetMaxPower(PowerType.Mana);
if (mana != 0) if (mana != 0)
{ {
mana /= 10; mana /= 10;
caster.EnergizeBySpell(caster, GetSpellInfo(), mana, PowerType.Mana); target.EnergizeBySpell(target, GetSpellInfo(), mana, PowerType.Mana);
} }
} }