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:
@@ -22,7 +22,7 @@ namespace Game.Entities
|
|||||||
long _lastDamagedTime; // Part of Evade mechanics
|
long _lastDamagedTime; // Part of Evade mechanics
|
||||||
MultiMap<byte, byte> m_textRepeat = new();
|
MultiMap<byte, byte> m_textRepeat = new();
|
||||||
|
|
||||||
CreatureStaticFlagsHolder _staticFlags;
|
protected CreatureStaticFlagsHolder _staticFlags;
|
||||||
|
|
||||||
// Regenerate health
|
// Regenerate health
|
||||||
bool _regenerateHealth; // Set on creation
|
bool _regenerateHealth; // Set on creation
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ namespace Game.Entities
|
|||||||
MultiMap<uint, uint> m_overrideSpells = new();
|
MultiMap<uint, uint> m_overrideSpells = new();
|
||||||
public Spell m_spellModTakingSpell;
|
public Spell m_spellModTakingSpell;
|
||||||
uint m_oldpetspell;
|
uint m_oldpetspell;
|
||||||
|
ObjectGuid m_temporaryUnsummonedBattlePet;
|
||||||
Dictionary<uint, StoredAuraTeleportLocation> m_storedAuraTeleportLocations = new();
|
Dictionary<uint, StoredAuraTeleportLocation> m_storedAuraTeleportLocations = new();
|
||||||
SpellCastRequest _pendingSpellCastRequest;
|
SpellCastRequest _pendingSpellCastRequest;
|
||||||
|
|
||||||
|
|||||||
@@ -667,6 +667,7 @@ namespace Game.Entities
|
|||||||
StopCastingCharm();
|
StopCastingCharm();
|
||||||
StopCastingBindSight();
|
StopCastingBindSight();
|
||||||
UnsummonPetTemporaryIfAny();
|
UnsummonPetTemporaryIfAny();
|
||||||
|
UnsummonBattlePetTemporaryIfAny();
|
||||||
SetPower(PowerType.ComboPoints, 0);
|
SetPower(PowerType.ComboPoints, 0);
|
||||||
GetSession().DoLootReleaseAll();
|
GetSession().DoLootReleaseAll();
|
||||||
m_lootRolls.Clear();
|
m_lootRolls.Clear();
|
||||||
@@ -1079,6 +1080,35 @@ namespace Game.Entities
|
|||||||
m_temporaryUnsummonedPetNumber = 0;
|
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()
|
public bool IsPetNeedBeTemporaryUnsummoned()
|
||||||
{
|
{
|
||||||
return !IsInWorld || !IsAlive() || HasUnitMovementFlag(MovementFlag.Flying) || HasExtraUnitMovementFlag2(MovementFlags3.AdvFlying);
|
return !IsInWorld || !IsAlive() || HasUnitMovementFlag(MovementFlag.Flying) || HasExtraUnitMovementFlag2(MovementFlags3.AdvFlying);
|
||||||
|
|||||||
@@ -440,6 +440,26 @@ namespace Game.Entities
|
|||||||
|
|
||||||
public void SetCanFollowOwner(bool can) { m_canFollowOwner = can; }
|
public void SetCanFollowOwner(bool can) { m_canFollowOwner = can; }
|
||||||
|
|
||||||
|
public bool IsDismissedOnFlyingMount()
|
||||||
|
{
|
||||||
|
return !HasFlag(CreatureStaticFlags5.DontDismissOnFlyingMount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDontDismissOnFlyingMount(bool dontDismissOnFlyingMount)
|
||||||
|
{
|
||||||
|
_staticFlags.ApplyFlag(CreatureStaticFlags5.DontDismissOnFlyingMount, dontDismissOnFlyingMount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsAutoResummoned()
|
||||||
|
{
|
||||||
|
return !HasFlag(CreatureStaticFlags6.DoNotAutoResummon);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetDontAutoResummon(bool dontAutoResummon)
|
||||||
|
{
|
||||||
|
_staticFlags.ApplyFlag(CreatureStaticFlags6.DoNotAutoResummon, dontAutoResummon);
|
||||||
|
}
|
||||||
|
|
||||||
public SummonPropertiesRecord m_Properties;
|
public SummonPropertiesRecord m_Properties;
|
||||||
TempSummonType m_type;
|
TempSummonType m_type;
|
||||||
TimeSpan m_timer;
|
TimeSpan m_timer;
|
||||||
|
|||||||
@@ -1533,6 +1533,7 @@ namespace Game.Entities
|
|||||||
{
|
{
|
||||||
player.EnablePetControlsOnDismount();
|
player.EnablePetControlsOnDismount();
|
||||||
player.ResummonPetTemporaryUnSummonedIfAny();
|
player.ResummonPetTemporaryUnSummonedIfAny();
|
||||||
|
player.ResummonBattlePetTemporaryUnSummonedIfAny();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,10 @@ namespace Game
|
|||||||
mover.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.LandingOrFlight); // Parachutes
|
mover.RemoveAurasWithInterruptFlags(SpellAuraInterruptFlags.LandingOrFlight); // Parachutes
|
||||||
|
|
||||||
if (opcode == ClientOpcodes.MoveSetFly || opcode == ClientOpcodes.MoveSetAdvFly)
|
if (opcode == ClientOpcodes.MoveSetFly || opcode == ClientOpcodes.MoveSetAdvFly)
|
||||||
|
{
|
||||||
_player.UnsummonPetTemporaryIfAny(); // always do the pet removal on current client activeplayer only
|
_player.UnsummonPetTemporaryIfAny(); // always do the pet removal on current client activeplayer only
|
||||||
|
_player.UnsummonBattlePetTemporaryIfAny(true);
|
||||||
|
}
|
||||||
|
|
||||||
movementInfo.Guid = mover.GetGUID();
|
movementInfo.Guid = mover.GetGUID();
|
||||||
movementInfo.Time = AdjustClientMovementTime(movementInfo.Time);
|
movementInfo.Time = AdjustClientMovementTime(movementInfo.Time);
|
||||||
@@ -408,6 +411,7 @@ namespace Game
|
|||||||
|
|
||||||
// resummon pet
|
// resummon pet
|
||||||
player.ResummonPetTemporaryUnSummonedIfAny();
|
player.ResummonPetTemporaryUnSummonedIfAny();
|
||||||
|
player.ResummonBattlePetTemporaryUnSummonedIfAny();
|
||||||
|
|
||||||
//lets process all delayed operations on successful teleport
|
//lets process all delayed operations on successful teleport
|
||||||
player.ProcessDelayedOperations();
|
player.ProcessDelayedOperations();
|
||||||
|
|||||||
Reference in New Issue
Block a user