diff options
-rw-r--r-- | src/game/SpellEffects.cpp | 51 | ||||
-rw-r--r-- | src/game/SpellMgr.h | 6 |
2 files changed, 26 insertions, 31 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index b01a445da58..1049234f4d7 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2792,17 +2792,30 @@ void Spell::EffectCreateItem(uint32 i) void Spell::EffectCreateItem2(uint32 i) { - // special case: generate using spell_loot_template - if(!m_spellInfo->EffectItemType[i]) + if(m_caster->GetTypeId()!=TYPEID_PLAYER) + return; + Player* player = (Player*)m_caster; + + uint32 item_id = m_spellInfo->EffectItemType[i]; + if(item_id) + DoCreateItem(i,item_id); + + // special case: fake item replaced by generate using spell_loot_template + if(IsLootCraftingSpell(m_spellInfo)) { - if(m_caster->GetTypeId()!=TYPEID_PLAYER) - return; + if(item_id) + { + if(!player->HasItemCount(item_id,1)) + return; + + // remove reagent + uint32 count = 1; + player->DestroyItemCount (item_id,count,true); + } // create some random items - ((Player*)m_caster)->AutoStoreLoot(m_spellInfo->Id,LootTemplates_Spell); - return; + player->AutoStoreLoot(m_spellInfo->Id,LootTemplates_Spell); } - DoCreateItem(i,m_spellInfo->EffectItemType[i]); } void Spell::EffectPersistentAA(uint32 i) @@ -4973,32 +4986,12 @@ void Spell::EffectScriptEffect(uint32 effIndex) case 61288: // Minor Inscription Research case 61756: // Northrend Inscription Research (FAST QA VERSION) { - if(!IsExplicitDiscoverySpell(m_spellInfo)) - { - sLog.outError("Wrong explicit discovery spell %u structure, or outdated...",m_spellInfo->Id); - return; - } - if(m_caster->GetTypeId()!=TYPEID_PLAYER) return; - Player* player = (Player*)m_caster; - - // need replace effect 0 item by loot - uint32 reagent_id = m_spellInfo->EffectItemType[0]; - - if(!player->HasItemCount(reagent_id,1)) - return; - - // remove reagent - uint32 count = 1; - player->DestroyItemCount (reagent_id,count,true); - - // create some random items - player->AutoStoreLoot(m_spellInfo->Id,LootTemplates_Spell); // learn random explicit discovery recipe (if any) - if(uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, player)) - player->learnSpell(discoveredSpell,false); + if(uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, (Player*)m_caster)) + ((Player*)m_caster)->learnSpell(discoveredSpell,false); return; } } diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index a313c525dc7..0fde7578860 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -238,8 +238,10 @@ inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo) inline bool IsLootCraftingSpell(SpellEntry const *spellInfo) { - return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && - (spellInfo->Effect[1]==SPELL_EFFECT_SCRIPT_EFFECT || !spellInfo->EffectItemType[0]); + return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && ( + spellInfo->Effect[1]==SPELL_EFFECT_SCRIPT_EFFECT || // see IsExplicitDiscoverySpell + !spellInfo->EffectItemType[0] || // result item not provided + spellInfo->TotemCategory[0] == 121); // different random cards from Inscription (121==Virtuoso Inking Set category) } bool IsHigherHankOfSpell(uint32 spellId_1,uint32 spellId_2); |