diff options
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 4d372838890..c68280212ab 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1325,7 +1325,7 @@ void Spell::EffectHealthLeech(SpellEffIndex /*effIndex*/) } } -void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype, uint8 context /*= 0*/, std::vector<int32> const& bonusListIDs /*= std::vector<int32>()*/) +void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype, ItemContext context /*= ItemContext::NONE*/, std::vector<int32> const& bonusListIDs /*= std::vector<int32>()*/) { if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; @@ -1433,7 +1433,7 @@ void Spell::EffectCreateItem(SpellEffIndex effIndex) if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET) return; - DoCreateItem(effIndex, effectInfo->ItemType); + DoCreateItem(effIndex, effectInfo->ItemType, m_spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) ? ItemContext::Trade_Skill : ItemContext::NONE); ExecuteLogEffectCreateItem(effIndex, effectInfo->ItemType); } @@ -1448,9 +1448,10 @@ void Spell::EffectCreateItem2(SpellEffIndex effIndex) Player* player = unitTarget->ToPlayer(); uint32 item_id = effectInfo->ItemType; + ItemContext context = m_spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) ? ItemContext::Trade_Skill : ItemContext::NONE; if (item_id) - DoCreateItem(effIndex, item_id); + DoCreateItem(effIndex, item_id, context); // special case: fake item replaced by generate using spell_loot_template if (m_spellInfo->IsLootCrafting()) @@ -1465,10 +1466,10 @@ void Spell::EffectCreateItem2(SpellEffIndex effIndex) player->DestroyItemCount(item_id, count, true); // create some random items - player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell); + player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell, context); } else - player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell); // create some random items + player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell, context); // create some random items player->UpdateCraftSkill(m_spellInfo->Id); } @@ -1485,7 +1486,7 @@ void Spell::EffectCreateRandomItem(SpellEffIndex /*effIndex*/) Player* player = unitTarget->ToPlayer(); // create some random items - player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell); + player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell, m_spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) ? ItemContext::Trade_Skill : ItemContext::NONE); /// @todo ExecuteLogEffectCreateItem(i, m_spellInfo->Effects[i].ItemType); } @@ -1788,7 +1789,7 @@ void Spell::EffectSummonChangeItem(SpellEffIndex /*effIndex*/) uint16 pos = m_CastItem->GetPos(); - Item* pNewItem = Item::CreateItem(newitemid, 1, player); + Item* pNewItem = Item::CreateItem(newitemid, 1, m_CastItem->GetContext(), player); if (!pNewItem) return; @@ -2381,7 +2382,7 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) player->DestroyItemCount(itemTarget, count, true); unitTarget = player; // and add a scroll - DoCreateItem(effIndex, effectInfo->ItemType); + DoCreateItem(effIndex, effectInfo->ItemType, m_spellInfo->HasAttribute(SPELL_ATTR0_TRADESPELL) ? ItemContext::Trade_Skill : ItemContext::NONE); itemTarget = NULL; m_targets.SetItemTarget(NULL); } @@ -5596,7 +5597,7 @@ void Spell::EffectCreateHeirloomItem(SpellEffIndex effIndex) std::vector<int32> bonusList; bonusList.push_back(collectionMgr->GetHeirloomBonus(m_misc.Raw.Data[0])); - DoCreateItem(effIndex, m_misc.Raw.Data[0], 0, bonusList); + DoCreateItem(effIndex, m_misc.Raw.Data[0], ItemContext::NONE, bonusList); ExecuteLogEffectCreateItem(effIndex, m_misc.Raw.Data[0]); } |