Core/Spells: Fix summoning warlock pets in case that pet has never been summoned before
Port From (https://github.com/TrinityCore/TrinityCore/commit/87b1c3700e8b8e5722b31fef2de124a2f39915c0)
This commit is contained in:
+24
-22
@@ -5222,32 +5222,34 @@ namespace Game.Spells
|
||||
if (playerCaster != null && playerCaster.GetPetStable() != null)
|
||||
{
|
||||
var info = Pet.GetLoadPetInfo(playerCaster.GetPetStable(), (uint)spellEffectInfo.MiscValue, 0, false);
|
||||
if (info.Item1 == null)
|
||||
if (info.Item1 != null)
|
||||
{
|
||||
if (info.Item1.Type == PetType.Hunter)
|
||||
{
|
||||
if (info.Item1.Health == 0)
|
||||
{
|
||||
playerCaster.SendTameFailure(PetTameResult.Dead);
|
||||
return SpellCastResult.DontReport;
|
||||
}
|
||||
|
||||
CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate(info.Item1.CreatureId);
|
||||
if (creatureInfo == null || !creatureInfo.IsTameable(playerCaster.CanTameExoticPets()))
|
||||
{
|
||||
// if problem in exotic pet
|
||||
if (creatureInfo != null && creatureInfo.IsTameable(true))
|
||||
playerCaster.SendTameFailure(PetTameResult.CantControlExotic);
|
||||
else
|
||||
playerCaster.SendTameFailure(PetTameResult.NoPetAvailable);
|
||||
|
||||
return SpellCastResult.DontReport;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (spellEffectInfo.MiscValue == 0) // when miscvalue is present it is allowed to create new pets
|
||||
{
|
||||
playerCaster.SendTameFailure(PetTameResult.NoPetAvailable);
|
||||
return SpellCastResult.DontReport;
|
||||
}
|
||||
|
||||
if (info.Item1.Type == PetType.Hunter)
|
||||
{
|
||||
if (info.Item1.Health == 0)
|
||||
{
|
||||
playerCaster.SendTameFailure(PetTameResult.Dead);
|
||||
return SpellCastResult.DontReport;
|
||||
}
|
||||
|
||||
CreatureTemplate creatureInfo = Global.ObjectMgr.GetCreatureTemplate(info.Item1.CreatureId);
|
||||
if (creatureInfo == null || !creatureInfo.IsTameable(playerCaster.CanTameExoticPets()))
|
||||
{
|
||||
// if problem in exotic pet
|
||||
if (creatureInfo != null && creatureInfo.IsTameable(true))
|
||||
playerCaster.SendTameFailure(PetTameResult.CantControlExotic);
|
||||
else
|
||||
playerCaster.SendTameFailure(PetTameResult.NoPetAvailable);
|
||||
|
||||
return SpellCastResult.DontReport;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user