Core/Creatures: Implemented unsummoning and resummoning critter pets on flying mounts and teleports (and related static flags)
Port From (https://github.com/TrinityCore/TrinityCore/commit/f2ce5072d62e2835c4426220ebf8ade5fa67a79b)
This commit is contained in:
@@ -109,6 +109,7 @@ namespace Game.Entities
|
||||
MultiMap<uint, uint> m_overrideSpells = new();
|
||||
public Spell m_spellModTakingSpell;
|
||||
uint m_oldpetspell;
|
||||
ObjectGuid m_temporaryUnsummonedBattlePet;
|
||||
Dictionary<uint, StoredAuraTeleportLocation> m_storedAuraTeleportLocations = new();
|
||||
SpellCastRequest _pendingSpellCastRequest;
|
||||
|
||||
|
||||
@@ -667,6 +667,7 @@ namespace Game.Entities
|
||||
StopCastingCharm();
|
||||
StopCastingBindSight();
|
||||
UnsummonPetTemporaryIfAny();
|
||||
UnsummonBattlePetTemporaryIfAny();
|
||||
SetPower(PowerType.ComboPoints, 0);
|
||||
GetSession().DoLootReleaseAll();
|
||||
m_lootRolls.Clear();
|
||||
@@ -1079,6 +1080,35 @@ namespace Game.Entities
|
||||
m_temporaryUnsummonedPetNumber = 0;
|
||||
}
|
||||
|
||||
public void UnsummonBattlePetTemporaryIfAny(bool onFlyingMount = false)
|
||||
{
|
||||
Creature battlepet = GetSummonedBattlePet();
|
||||
if (battlepet == null || !battlepet.IsSummon())
|
||||
return;
|
||||
|
||||
if (onFlyingMount && !battlepet.ToTempSummon().IsDismissedOnFlyingMount())
|
||||
return;
|
||||
|
||||
if (battlepet.ToTempSummon().IsAutoResummoned())
|
||||
m_temporaryUnsummonedBattlePet = battlepet.GetBattlePetCompanionGUID();
|
||||
|
||||
GetSession().GetBattlePetMgr().DismissPet();
|
||||
}
|
||||
|
||||
public void ResummonBattlePetTemporaryUnSummonedIfAny()
|
||||
{
|
||||
if (m_temporaryUnsummonedBattlePet.IsEmpty())
|
||||
return;
|
||||
|
||||
// not resummon in not appropriate state
|
||||
if (IsPetNeedBeTemporaryUnsummoned())
|
||||
return;
|
||||
|
||||
GetSession().GetBattlePetMgr().SummonPet(m_temporaryUnsummonedBattlePet);
|
||||
|
||||
m_temporaryUnsummonedBattlePet.Clear();
|
||||
}
|
||||
|
||||
public bool IsPetNeedBeTemporaryUnsummoned()
|
||||
{
|
||||
return !IsInWorld || !IsAlive() || HasUnitMovementFlag(MovementFlag.Flying) || HasExtraUnitMovementFlag2(MovementFlags3.AdvFlying);
|
||||
|
||||
Reference in New Issue
Block a user