Core/Pets: Updated pet summoning for latest client version (5 Call Pet spells and stable size 200)

Port From (https://github.com/TrinityCore/TrinityCore/commit/950db60435e7e513633ff5b22ad7f0ed8b1147e4)
This commit is contained in:
hondacrx
2022-03-10 12:02:05 -05:00
parent a77e6865b2
commit c486b2a846
14 changed files with 448 additions and 218 deletions
+12 -2
View File
@@ -405,6 +405,8 @@ namespace Scripts.Spells.Hunter
[Script]
class spell_hun_tame_beast : SpellScript
{
static uint[] CallPetSpellIds = { 883, 83242, 83243, 83244, 83245, };
SpellCastResult CheckCast()
{
Player caster = GetCaster().ToPlayer();
@@ -427,10 +429,18 @@ namespace Scripts.Spells.Hunter
PetStable petStable = caster.GetPetStable();
if (petStable != null)
{
if (petStable.CurrentPet != null)
if (petStable.CurrentPetIndex.HasValue)
return SpellCastResult.AlreadyHaveSummon;
if (petStable.GetUnslottedHunterPet() != null)
var freeSlotIndex = Array.FindIndex(petStable.ActivePets, petInfo => petInfo == null);
if (freeSlotIndex == -1)
{
caster.SendTameFailure(PetTameResult.TooMany);
return SpellCastResult.DontReport;
}
// Check for known Call Pet X spells
if (!caster.HasSpell(CallPetSpellIds[freeSlotIndex]))
{
caster.SendTameFailure(PetTameResult.TooMany);
return SpellCastResult.DontReport;