Core/BattlePets: Don't permanently learn battle pet summoning spells
Port From (https://github.com/TrinityCore/TrinityCore/commit/ebc52afa0ace96cd97968c110f558344bdeba43d)
This commit is contained in:
@@ -1823,12 +1823,18 @@ namespace Game.Spells
|
|||||||
if (itemEffect.TriggerType != ItemSpelltriggerType.LearnSpellId)
|
if (itemEffect.TriggerType != ItemSpelltriggerType.LearnSpellId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
player.LearnSpell((uint)itemEffect.SpellID, false);
|
bool dependent = false;
|
||||||
|
|
||||||
var speciesEntry = Global.SpellMgr.GetBattlePetSpecies((uint)itemEffect.SpellID);
|
var speciesEntry = Global.SpellMgr.GetBattlePetSpecies((uint)itemEffect.SpellID);
|
||||||
if (speciesEntry != null)
|
if (speciesEntry != null)
|
||||||
|
{
|
||||||
player.GetSession().GetBattlePetMgr().AddPet(speciesEntry.Id, BattlePetMgr.SelectPetDisplay(speciesEntry), BattlePetMgr.RollPetBreed(speciesEntry.Id), BattlePetMgr.GetDefaultPetQuality(speciesEntry.Id));
|
player.GetSession().GetBattlePetMgr().AddPet(speciesEntry.Id, BattlePetMgr.SelectPetDisplay(speciesEntry), BattlePetMgr.RollPetBreed(speciesEntry.Id), BattlePetMgr.GetDefaultPetQuality(speciesEntry.Id));
|
||||||
|
// If the spell summons a battle pet, we fake that it has been learned and the battle pet is added
|
||||||
|
// marking as dependent prevents saving the spell to database (intended)
|
||||||
|
dependent = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
player.LearnSpell((uint)itemEffect.SpellID, dependent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -5481,8 +5487,8 @@ namespace Game.Spells
|
|||||||
if (speciesEntry == null)
|
if (speciesEntry == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player plr = m_caster.ToPlayer();
|
Player player = m_caster.ToPlayer();
|
||||||
BattlePetMgr battlePetMgr = plr.GetSession().GetBattlePetMgr();
|
BattlePetMgr battlePetMgr = player.GetSession().GetBattlePetMgr();
|
||||||
if (battlePetMgr == null)
|
if (battlePetMgr == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -5502,13 +5508,9 @@ namespace Game.Spells
|
|||||||
|
|
||||||
battlePetMgr.AddPet(speciesId, displayId, breed, quality, level);
|
battlePetMgr.AddPet(speciesId, displayId, breed, quality, level);
|
||||||
|
|
||||||
if (speciesEntry.SummonSpellID != 0)
|
player.SendPlaySpellVisual(player, SharedConst.SpellVisualUncagePet, 0, 0, 0.0f, false);
|
||||||
if (!plr.HasSpell(speciesEntry.SummonSpellID))
|
|
||||||
plr.LearnSpell(speciesEntry.SummonSpellID, false);
|
|
||||||
|
|
||||||
plr.SendPlaySpellVisual(plr, SharedConst.SpellVisualUncagePet, 0, 0, 0.0f, false);
|
player.DestroyItem(m_CastItem.GetBagSlot(), m_CastItem.GetSlot(), true);
|
||||||
|
|
||||||
plr.DestroyItem(m_CastItem.GetBagSlot(), m_CastItem.GetSlot(), true);
|
|
||||||
m_CastItem = null;
|
m_CastItem = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user