Core/Items: Refactored learning spells from items to check for ITEM_SPELLTRIGGER_LEARN_SPELL_ID instead of hardcoded spell ids
Port From (https://github.com/TrinityCore/TrinityCore/commit/6b69338990a651c54dd9d2b5ad3281a4d702efb7)
This commit is contained in:
@@ -1059,16 +1059,17 @@ namespace Game
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
if (item.GetBonus().EffectCount < 2)
|
||||
return;
|
||||
|
||||
uint spellToLearn = (uint)item.GetEffect(1).SpellID;
|
||||
|
||||
var entry = Global.SpellMgr.GetBattlePetSpecies(spellToLearn);
|
||||
if (entry != null)
|
||||
foreach (var itemEffect in item.GetEffects())
|
||||
{
|
||||
GetBattlePetMgr().AddPet(entry.Id, BattlePetMgr.SelectPetDisplay(entry), BattlePetMgr.RollPetBreed(entry.Id), BattlePetMgr.GetDefaultPetQuality(entry.Id));
|
||||
_player.UpdateCriteria(CriteriaType.UniquePetsOwned);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
GetPlayer().DestroyItem(item.GetBagSlot(), item.GetSlot(), true);
|
||||
|
||||
Reference in New Issue
Block a user