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,19 +3301,24 @@ void Spell::EffectCreateItem2(SpellEffectIndex eff_idx)
return;
Player* player = (Player*)m_caster;
// explicit item (possible fake)
uint32 item_id = m_spellInfo->EffectItemType[eff_idx];
DoCreateItem(eff_idx, item_id);
if (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 (!player->HasItemCount(item_id, 1))
return;
if(item_id)
{
if (!player->HasItemCount(item_id, 1))
return;
// remove reagent
uint32 count = 1;
player->DestroyItemCount(item_id, count, true);
// remove reagent
uint32 count = 1;
player->DestroyItemCount(item_id, count, true);
}
// create some random items
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)
{
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->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)
{
return (spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_RANDOM_ITEM ||
// different random cards from Inscription (121==Virtuoso Inking Set category)
// also Abyssal Shatter (63), any !=0 infact
(spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] != 0));
// different random cards from Inscription (121==Virtuoso Inking Set category) r without explicit item
(spellInfo->Effect[EFFECT_INDEX_0] == SPELL_EFFECT_CREATE_ITEM_2 &&
(spellInfo->TotemCategory[0] != 0 || spellInfo->EffectItemType[0]==0)));
}
int32 CompareAuraRanks(uint32 spellId_1, SpellEffectIndex effIndex_1, uint32 spellId_2, SpellEffectIndex effIndex_2);