diff --git a/Source/Game/BattlePets/BattlePetManager.cs b/Source/Game/BattlePets/BattlePetManager.cs index c668cb641..2f0422498 100644 --- a/Source/Game/BattlePets/BattlePetManager.cs +++ b/Source/Game/BattlePets/BattlePetManager.cs @@ -357,6 +357,7 @@ namespace Game.BattlePets updates.Add(pet); SendUpdates(updates, true); + _owner.GetPlayer().UpdateCriteria(CriteriaType.UniquePetsOwned); _owner.GetPlayer().UpdateCriteria(CriteriaType.LearnedNewPet, species); } diff --git a/Source/Game/Entities/Player/Player.Spells.cs b/Source/Game/Entities/Player/Player.Spells.cs index f147b635f..a40056538 100644 --- a/Source/Game/Entities/Player/Player.Spells.cs +++ b/Source/Game/Entities/Player/Player.Spells.cs @@ -2622,17 +2622,6 @@ namespace Game.Entities if (Global.DB2Mgr.GetMount(spellId) != null) GetSession().GetCollectionMgr().AddMount(spellId, MountStatusFlags.None, false, !IsInWorld); - // need to add Battle pets automatically into pet journal - foreach (BattlePetSpeciesRecord entry in CliDB.BattlePetSpeciesStorage.Values) - { - if (entry.SummonSpellID == spellId && GetSession().GetBattlePetMgr().GetPetCount(entry.Id) == 0) - { - GetSession().GetBattlePetMgr().AddPet(entry.Id, BattlePetMgr.SelectPetDisplay(entry), BattlePetMgr.RollPetBreed(entry.Id), BattlePetMgr.GetDefaultPetQuality(entry.Id)); - UpdateCriteria(CriteriaType.UniquePetsOwned); - break; - } - } - // return true (for send learn packet) only if spell active (in case ranked spells) and not replace old spell return active && !disabled && !superceded_old; } diff --git a/Source/Game/Handlers/ItemHandler.cs b/Source/Game/Handlers/ItemHandler.cs index 57121a72d..6e2ac2aa3 100644 --- a/Source/Game/Handlers/ItemHandler.cs +++ b/Source/Game/Handlers/ItemHandler.cs @@ -1064,12 +1064,9 @@ namespace Game if (itemEffect.TriggerType != ItemSpelltriggerType.LearnSpellId) continue; - var entry = Global.SpellMgr.GetBattlePetSpecies((uint)itemEffect.SpellID); - if (entry != null) - { - GetBattlePetMgr().AddPet(entry.Id, BattlePetMgr.SelectPetDisplay(entry), BattlePetMgr.RollPetBreed(entry.Id), BattlePetMgr.GetDefaultPetQuality(entry.Id)); - _player.UpdateCriteria(CriteriaType.UniquePetsOwned); - } + var speciesEntry = Global.SpellMgr.GetBattlePetSpecies((uint)itemEffect.SpellID); + if (speciesEntry != null) + GetBattlePetMgr().AddPet(speciesEntry.Id, BattlePetMgr.SelectPetDisplay(speciesEntry), BattlePetMgr.RollPetBreed(speciesEntry.Id), BattlePetMgr.GetDefaultPetQuality(speciesEntry.Id)); } GetPlayer().DestroyItem(item.GetBagSlot(), item.GetSlot(), true); diff --git a/Source/Game/Spells/SpellEffects.cs b/Source/Game/Spells/SpellEffects.cs index 0c99d3b25..0d9478bf7 100644 --- a/Source/Game/Spells/SpellEffects.cs +++ b/Source/Game/Spells/SpellEffects.cs @@ -1824,6 +1824,11 @@ namespace Game.Spells continue; player.LearnSpell((uint)itemEffect.SpellID, false); + + var speciesEntry = Global.SpellMgr.GetBattlePetSpecies((uint)itemEffect.SpellID); + if (speciesEntry != null) + player.GetSession().GetBattlePetMgr().AddPet(speciesEntry.Id, BattlePetMgr.SelectPetDisplay(speciesEntry), BattlePetMgr.RollPetBreed(speciesEntry.Id), BattlePetMgr.GetDefaultPetQuality(speciesEntry.Id)); + } } @@ -5497,8 +5502,9 @@ namespace Game.Spells battlePetMgr.AddPet(speciesId, displayId, breed, quality, level); - if (!plr.HasSpell(speciesEntry.SummonSpellID)) - plr.LearnSpell(speciesEntry.SummonSpellID, false); + if (speciesEntry.SummonSpellID != 0) + if (!plr.HasSpell(speciesEntry.SummonSpellID)) + plr.LearnSpell(speciesEntry.SummonSpellID, false); plr.SendPlaySpellVisual(plr, SharedConst.SpellVisualUncagePet, 0, 0, 0.0f, false);