Core/BattlePets: Add battle pets to pet journal when learning related spells

This commit is contained in:
hondacrx
2017-12-04 14:32:40 -05:00
parent b017ef8e84
commit f6d86328f9
2 changed files with 298 additions and 277 deletions
@@ -22,6 +22,7 @@ using Game.Network.Packets;
using Game.Spells;
using System;
using System.Collections.Generic;
using Game.BattlePets;
namespace Game.Entities
{
@@ -2520,6 +2521,17 @@ namespace Game.Entities
if (Global.DB2Mgr.GetMount(spellId) != null)
GetSession().GetCollectionMgr().AddMount(spellId, MountStatusFlags.None, false, IsInWorld ? false : true);
// 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, entry.CreatureID, BattlePetMgr.RollPetBreed(entry.Id), BattlePetMgr.GetDefaultPetQuality(entry.Id));
UpdateCriteria(CriteriaTypes.OwnBattlePetCount);
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;
}