Core/BattlePets: Misc fixes

Port From (https://github.com/TrinityCore/TrinityCore/commit/924182f692bde38d8fed85d5dbe7531a09790501)
This commit is contained in:
hondacrx
2022-01-07 13:20:16 -05:00
parent 56b2c4e0a4
commit e0340e7c07
7 changed files with 86 additions and 37 deletions
+22 -18
View File
@@ -1598,9 +1598,6 @@ namespace Game.Spells
if (summon == null || !summon.HasUnitTypeMask(UnitTypeMask.Minion))
return;
summon.SelectLevel(); // some summoned creaters have different from 1 DB data for level/hp
summon.SetNpcFlags((NPCFlags)((int)summon.GetCreatureTemplate().Npcflag & 0xFFFFFFFF));
summon.SetNpcFlags2((NPCFlags2)((int)summon.GetCreatureTemplate().Npcflag >> 32));
summon.SetImmuneToAll(true);
break;
@@ -4504,21 +4501,6 @@ namespace Game.Spells
unitCaster = unitCaster.ToTotem().GetOwner();
// in another case summon new
uint level = unitCaster.GetLevel();
// level of pet summoned using engineering item based at engineering skill level
if (m_CastItem != null && unitCaster.IsPlayer())
{
ItemTemplate proto = m_CastItem.GetTemplate();
if (proto != null)
if (proto.GetRequiredSkill() == (uint)SkillType.Engineering)
{
ushort skill202 = unitCaster.ToPlayer().GetSkillValue(SkillType.Engineering);
if (skill202 != 0)
level = (uint)(skill202 / 5);
}
}
float radius = 5.0f;
int duration = m_spellInfo.CalcDuration(m_originalCaster);
@@ -4537,8 +4519,30 @@ namespace Game.Spells
TempSummon summon = map.SummonCreature(entry, pos, properties, (uint)duration, unitCaster, m_spellInfo.Id, 0, privateObjectOwner);
if (summon == null)
return;
if (summon.HasUnitTypeMask(UnitTypeMask.Guardian))
{
uint level = summon.GetLevel();
if (properties != null && !properties.GetFlags().HasFlag(SummonPropertiesFlags.UseCreatureLevel))
level = unitCaster.GetLevel();
// level of pet summoned using engineering item based at engineering skill level
if (m_CastItem && unitCaster.IsPlayer())
{
ItemTemplate proto = m_CastItem.GetTemplate();
if (proto != null)
{
if (proto.GetRequiredSkill() == (uint)SkillType.Engineering)
{
ushort skill202 = unitCaster.ToPlayer().GetSkillValue(SkillType.Engineering);
if (skill202 != 0)
level = skill202 / 5u;
}
}
}
((Guardian)summon).InitStatsForLevel(level);
}
if (summon.HasUnitTypeMask(UnitTypeMask.Minion) && m_targets.HasDst())
((Minion)summon).SetFollowAngle(unitCaster.GetAbsoluteAngle(summon.GetPosition()));