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
+8 -7
View File
@@ -188,12 +188,8 @@ namespace Game.Entities
Unit owner = GetSummonerUnit();
if (owner != null && IsTrigger() && m_spells[0] != 0)
{
SetLevel(owner.GetLevel());
if (owner.IsTypeId(TypeId.Player))
m_ControlledByPlayer = true;
}
if (m_Properties == null)
return;
@@ -211,15 +207,20 @@ namespace Game.Entities
}
owner.m_SummonSlot[slot] = GetGUID();
}
if (!m_Properties.GetFlags().HasFlag(SummonPropertiesFlags.UseCreatureLevel))
SetLevel(owner.GetLevel());
}
uint faction = m_Properties.Faction;
if (m_Properties.GetFlags().HasFlag(SummonPropertiesFlags.UseSummonerFaction)) // TODO: Determine priority between faction and flag
if (owner)
faction = owner.GetFaction();
if (owner && m_Properties.GetFlags().HasFlag(SummonPropertiesFlags.UseSummonerFaction)) // TODO: Determine priority between faction and flag
faction = owner.GetFaction();
if (faction != 0)
SetFaction(faction);
if (m_Properties.GetFlags().HasFlag(SummonPropertiesFlags.SummonFromBattlePetJournal))
RemoveNpcFlag(NPCFlags.WildBattlePet);
}
public virtual void InitSummon()
-2
View File
@@ -83,8 +83,6 @@ namespace Game.Entities
m_type = TotemType.Active;
m_duration = duration;
SetLevel(GetOwner().GetLevel());
}
public override void InitSummon()
+17 -6
View File
@@ -146,18 +146,29 @@ namespace Game.Entities
if (GetMinionGUID().IsEmpty())
SetMinionGUID(minion.GetGUID());
if (minion.m_Properties != null && minion.m_Properties.Title == SummonTitle.Companion)
var properties = minion.m_Properties;
if (properties != null && properties.Title == SummonTitle.Companion)
{
SetCritterGUID(minion.GetGUID());
Player thisPlayer = ToPlayer();
if (thisPlayer != null)
{
var pet = thisPlayer.GetSession().GetBattlePetMgr().GetPet(thisPlayer.GetSummonedBattlePetGUID());
if (pet != null)
if (properties.GetFlags().HasFlag(SummonPropertiesFlags.SummonFromBattlePetJournal))
{
minion.SetBattlePetCompanionGUID(thisPlayer.GetSummonedBattlePetGUID());
minion.SetBattlePetCompanionNameTimestamp((uint)pet.NameTimestamp);
minion.SetWildBattlePetLevel(pet.PacketInfo.Level);
var pet = thisPlayer.GetSession().GetBattlePetMgr().GetPet(thisPlayer.GetSummonedBattlePetGUID());
if (pet != null)
{
minion.SetBattlePetCompanionGUID(thisPlayer.GetSummonedBattlePetGUID());
minion.SetBattlePetCompanionNameTimestamp((uint)pet.NameTimestamp);
minion.SetWildBattlePetLevel(pet.PacketInfo.Level);
uint display = pet.PacketInfo.DisplayID;
if (display != 0)
{
minion.SetDisplayId(display);
minion.SetNativeDisplayId(display);
}
}
}
}
}