Update IsExplicitDiscoverySpell/IsLootCraftingSpell and related code.

This commit is contained in:
VladimirMangos 2010-04-06 20:00:37 +04:00
parent 8d97ad06b2
commit 61255a1a8f
2 changed files with 17 additions and 11 deletions

View file

@ -3301,12 +3301,16 @@ void Spell::EffectCreateItem2(SpellEffectIndex eff_idx)
return; return;
Player* player = (Player*)m_caster; Player* player = (Player*)m_caster;
// explicit item (possible fake)
uint32 item_id = m_spellInfo->EffectItemType[eff_idx]; uint32 item_id = m_spellInfo->EffectItemType[eff_idx];
if (item_id)
DoCreateItem(eff_idx, item_id); DoCreateItem(eff_idx, item_id);
// special case: fake item replaced by generate using spell_loot_template // not explicit loot (with fake item drop if need)
if (IsLootCraftingSpell(m_spellInfo)) if (IsLootCraftingSpell(m_spellInfo))
{
if(item_id)
{ {
if (!player->HasItemCount(item_id, 1)) if (!player->HasItemCount(item_id, 1))
return; return;
@ -3314,6 +3318,7 @@ void Spell::EffectCreateItem2(SpellEffectIndex eff_idx)
// remove reagent // remove reagent
uint32 count = 1; uint32 count = 1;
player->DestroyItemCount(item_id, count, true); player->DestroyItemCount(item_id, count, true);
}
// create some random items // create some random items
player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell); player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell);

View file

@ -171,7 +171,8 @@ inline bool IsElementalShield(SpellEntry const *spellInfo)
inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo) inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo)
{ {
return ((spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_RANDOM_ITEM return (((spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_RANDOM_ITEM
|| spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_ITEM_2)
&& spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_SCRIPT_EFFECT) && spellInfo->Effect[EFFECT_INDEX_1] == SPELL_EFFECT_SCRIPT_EFFECT)
|| spellInfo->Id == 64323); // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data) || spellInfo->Id == 64323); // Book of Glyph Mastery (Effect0==SPELL_EFFECT_SCRIPT_EFFECT without any other data)
} }
@ -179,9 +180,9 @@ inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo)
inline bool IsLootCraftingSpell(SpellEntry const *spellInfo) inline bool IsLootCraftingSpell(SpellEntry const *spellInfo)
{ {
return (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_RANDOM_ITEM || return (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_RANDOM_ITEM ||
// different random cards from Inscription (121==Virtuoso Inking Set category) // different random cards from Inscription (121==Virtuoso Inking Set category) r without explicit item
// also Abyssal Shatter (63), any !=0 infact (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_ITEM_2 &&
(spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] != 0)); (spellInfo->TotemCategory[0] != 0 || spellInfo->EffectItemType[0]==0)));
} }
int32 CompareAuraRanks(uint32 spellId_1, SpellEffectIndex effIndex_1, uint32 spellId_2, SpellEffectIndex effIndex_2); int32 CompareAuraRanks(uint32 spellId_1, SpellEffectIndex effIndex_1, uint32 spellId_2, SpellEffectIndex effIndex_2);