Core/Items: Fixed learning 2nd and 3rd copies of battle pets from items (not caged pets)

Port From (https://github.com/TrinityCore/TrinityCore/commit/361946419e1a1d665f0d075231372cf4106058d9)
This commit is contained in:
hondacrx
2020-04-25 00:39:37 -04:00
parent 9ee0d404b7
commit 400088bb38
3 changed files with 32 additions and 8 deletions
+5 -7
View File
@@ -1056,14 +1056,12 @@ namespace Game
return;
uint spellToLearn = (uint)item.GetTemplate().Effects[1].SpellID;
foreach (BattlePetSpeciesRecord entry in CliDB.BattlePetSpeciesStorage.Values)
var entry = Global.SpellMgr.GetBattlePetSpecies(spellToLearn);
if (entry != null)
{
if (entry.SummonSpellID == spellToLearn)
{
GetBattlePetMgr().AddPet(entry.Id, entry.CreatureID, BattlePetMgr.RollPetBreed(entry.Id), BattlePetMgr.GetDefaultPetQuality(entry.Id));
_player.UpdateCriteria(CriteriaTypes.OwnBattlePetCount);
break;
}
GetBattlePetMgr().AddPet(entry.Id, entry.CreatureID, BattlePetMgr.RollPetBreed(entry.Id), BattlePetMgr.GetDefaultPetQuality(entry.Id));
_player.UpdateCriteria(CriteriaTypes.OwnBattlePetCount);
}
GetPlayer().DestroyItem(item.GetBagSlot(), item.GetSlot(), true);