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:
@@ -2592,11 +2592,6 @@ namespace Game.Entities
|
||||
public void SetChildItem(ObjectGuid childItem) { m_childItem = childItem; }
|
||||
|
||||
public ItemEffectRecord[] GetEffects() { return _bonusData.Effects[0.._bonusData.EffectCount]; }
|
||||
public ItemEffectRecord GetEffect(int i)
|
||||
{
|
||||
Cypher.Assert(i < _bonusData.EffectCount, $"Attempted to get effect at index {i} but item has only {_bonusData.EffectCount} effects!");
|
||||
return _bonusData.Effects[i];
|
||||
}
|
||||
|
||||
//Static
|
||||
public static bool ItemCanGoIntoBag(ItemTemplate pProto, ItemTemplate pBagProto)
|
||||
|
||||
@@ -1472,37 +1472,6 @@ namespace Game.Entities
|
||||
{
|
||||
if (!item.GetTemplate().GetFlags().HasFlag(ItemFlags.Legacy))
|
||||
{
|
||||
// special learning case
|
||||
if (item.GetBonus().EffectCount >= 2)
|
||||
{
|
||||
if (item.GetEffect(0).SpellID == 483 || item.GetEffect(0).SpellID == 55884)
|
||||
{
|
||||
uint learn_spell_id = (uint)item.GetEffect(0).SpellID;
|
||||
uint learning_spell_id = (uint)item.GetEffect(1).SpellID;
|
||||
|
||||
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(learn_spell_id, Difficulty.None);
|
||||
if (spellInfo == null)
|
||||
{
|
||||
Log.outError(LogFilter.Player, "Player.CastItemUseSpell: Item (Entry: {0}) in have wrong spell id {1}, ignoring ", item.GetEntry(), learn_spell_id);
|
||||
SendEquipError(InventoryResult.InternalBagError, item);
|
||||
return;
|
||||
}
|
||||
|
||||
Spell spell = new(this, spellInfo, TriggerCastFlags.None);
|
||||
|
||||
SpellPrepare spellPrepare = new();
|
||||
spellPrepare.ClientCastID = castCount;
|
||||
spellPrepare.ServerCastID = spell.m_castId;
|
||||
SendPacket(spellPrepare);
|
||||
|
||||
spell.m_fromClient = true;
|
||||
spell.m_CastItem = item;
|
||||
spell.SetSpellValue(SpellValueMod.BasePoint0, (int)learning_spell_id);
|
||||
spell.Prepare(targets);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// item spells casted at use
|
||||
foreach (ItemEffectRecord effectData in item.GetEffects())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user