Don't allow to summon dead hunter pets
Port From (https://github.com/TrinityCore/TrinityCore/commit/92fc09b1b5507c11c9e7ca63e6de0ec7574f0810)
This commit is contained in:
@@ -123,4 +123,23 @@ namespace Framework.Constants
|
|||||||
CantControlExotic = 11, // "you are unable to control exotic creatures"
|
CantControlExotic = 11, // "you are unable to control exotic creatures"
|
||||||
InternalError = 12, // "Internal pet error"
|
InternalError = 12, // "Internal pet error"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum PetTameResult
|
||||||
|
{
|
||||||
|
Ok = 0,
|
||||||
|
InvalidCreature = 1,
|
||||||
|
TooMany = 2,
|
||||||
|
CreatureAlreadyOwned = 3,
|
||||||
|
NotTameable = 4,
|
||||||
|
AnotherSummonActive = 5,
|
||||||
|
UnitsCantTame = 6,
|
||||||
|
NoPetAvailable = 7,
|
||||||
|
InternalError = 8,
|
||||||
|
TooHighLevel = 9,
|
||||||
|
Dead = 10,
|
||||||
|
NotDead = 11,
|
||||||
|
CantControlExotic = 12,
|
||||||
|
InvalidSlot = 13,
|
||||||
|
EliteTooHighLevel = 14
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,11 +17,13 @@
|
|||||||
|
|
||||||
using Framework.Constants;
|
using Framework.Constants;
|
||||||
using Framework.Database;
|
using Framework.Database;
|
||||||
|
using Framework.Dynamic;
|
||||||
using Game.Achievements;
|
using Game.Achievements;
|
||||||
using Game.AI;
|
using Game.AI;
|
||||||
using Game.Arenas;
|
using Game.Arenas;
|
||||||
using Game.BattleFields;
|
using Game.BattleFields;
|
||||||
using Game.BattleGrounds;
|
using Game.BattleGrounds;
|
||||||
|
using Game.BattlePets;
|
||||||
using Game.Chat;
|
using Game.Chat;
|
||||||
using Game.DataStorage;
|
using Game.DataStorage;
|
||||||
using Game.Garrisons;
|
using Game.Garrisons;
|
||||||
@@ -38,7 +40,6 @@ using Game.Spells;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Framework.Dynamic;
|
|
||||||
|
|
||||||
namespace Game.Entities
|
namespace Game.Entities
|
||||||
{
|
{
|
||||||
@@ -952,7 +953,7 @@ namespace Game.Entities
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetBattlePetData(BattlePets.BattlePetMgr.BattlePet pet = null)
|
public void SetBattlePetData(BattlePet pet = null)
|
||||||
{
|
{
|
||||||
if (pet != null)
|
if (pet != null)
|
||||||
{
|
{
|
||||||
@@ -4683,11 +4684,18 @@ namespace Game.Entities
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pet SummonPet(uint entry, float x, float y, float z, float ang, PetType petType, uint duration)
|
public Pet SummonPet(uint entry, float x, float y, float z, float ang, PetType petType, uint duration, bool aliveOnly = false)
|
||||||
{
|
{
|
||||||
Pet pet = new(this, petType);
|
Pet pet = new(this, petType);
|
||||||
if (petType == PetType.Summon && pet.LoadPetFromDB(this, entry))
|
if (petType == PetType.Summon && pet.LoadPetFromDB(this, entry))
|
||||||
{
|
{
|
||||||
|
if (aliveOnly && !pet.IsAlive())
|
||||||
|
{
|
||||||
|
pet.DespawnOrUnsummon();
|
||||||
|
SendTameFailure(PetTameResult.Dead);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
if (duration > 0)
|
if (duration > 0)
|
||||||
pet.SetDuration(duration);
|
pet.SetDuration(duration);
|
||||||
|
|
||||||
@@ -4836,6 +4844,13 @@ namespace Game.Entities
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendTameFailure(PetTameResult result)
|
||||||
|
{
|
||||||
|
PetTameFailure petTameFailure = new();
|
||||||
|
petTameFailure.Result = result;
|
||||||
|
SendPacket(petTameFailure);
|
||||||
|
}
|
||||||
|
|
||||||
public void AddPetAura(PetAura petSpell)
|
public void AddPetAura(PetAura petSpell)
|
||||||
{
|
{
|
||||||
m_petAuras.Add(petSpell);
|
m_petAuras.Add(petSpell);
|
||||||
|
|||||||
@@ -354,6 +354,18 @@ namespace Game.Networking.Packets
|
|||||||
public PetTalk Action;
|
public PetTalk Action;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class PetTameFailure : ServerPacket
|
||||||
|
{
|
||||||
|
public PetTameFailure() : base(ServerOpcodes.PetTameFailure) { }
|
||||||
|
|
||||||
|
public override void Write()
|
||||||
|
{
|
||||||
|
_worldPacket.WriteUInt8(Result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte Result;
|
||||||
|
}
|
||||||
|
|
||||||
//Structs
|
//Structs
|
||||||
public class PetSpellCooldown
|
public class PetSpellCooldown
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2309,7 +2309,7 @@ namespace Game.Spells
|
|||||||
|
|
||||||
float x, y, z;
|
float x, y, z;
|
||||||
owner.GetClosePoint(out x, out y, out z, owner.GetCombatReach());
|
owner.GetClosePoint(out x, out y, out z, owner.GetCombatReach());
|
||||||
Pet pet = owner.SummonPet(petentry, x, y, z, owner.Orientation, PetType.Summon, 0);
|
Pet pet = owner.SummonPet(petentry, x, y, z, owner.Orientation, PetType.Summon, 0, true);
|
||||||
if (!pet)
|
if (!pet)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user