aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorn0n4m3 <none@none>2010-04-11 11:24:05 +0400
committern0n4m3 <none@none>2010-04-11 11:24:05 +0400
commit45e750148a256333b49dae7b2725eb815ba4089d (patch)
tree76cbff407d31d1ba4755601c011118c0981b7ada
parentcdec48b9efab92c0af3bb1b96de0b4e8566f5a35 (diff)
Update IsExplicitDiscoverySpell/IsLootCraftingSpell and related code. by Vladimir.
--HG-- branch : trunk
-rw-r--r--src/game/SpellEffects.cpp20
-rw-r--r--src/game/SpellMgr.h8
2 files changed, 17 insertions, 11 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 067edf5a7d4..45c7fe1af60 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -3125,20 +3125,24 @@ void Spell::EffectCreateItem2(uint32 i)
uint32 item_id = m_spellInfo->EffectItemType[i];
- DoCreateItem(i, item_id);
+ if (item_id)
+ DoCreateItem(i, item_id);
// special case: fake item replaced by generate using spell_loot_template
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);
+ // create some random items
+ player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell);
+ }
}
}
diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h
index 8c576bb93bf..cd796636be5 100644
--- a/src/game/SpellMgr.h
+++ b/src/game/SpellMgr.h
@@ -281,7 +281,8 @@ inline bool IsElementalShield(SpellEntry const *spellInfo)
inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo)
{
- return ((spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM
+ return (((spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM
+ || spellInfo->Effect[0] == SPELL_EFFECT_CREATE_ITEM_2)
&& spellInfo->Effect[1] == SPELL_EFFECT_SCRIPT_EFFECT)
|| spellInfo->Id == 64323); // Book of Glyph Mastery (Effect0 == SPELL_EFFECT_SCRIPT_EFFECT without any other data)
}
@@ -289,8 +290,9 @@ inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo)
inline bool IsLootCraftingSpell(SpellEntry const *spellInfo)
{
return (spellInfo->Effect[0] == SPELL_EFFECT_CREATE_RANDOM_ITEM ||
- // different random cards from Inscription (121 == Virtuoso Inking Set category)
- (spellInfo->Effect[0] == SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] == 121));
+ // different random cards from Inscription (121==Virtuoso Inking Set category) r without explicit item
+ (spellInfo->Effect[0] == SPELL_EFFECT_CREATE_ITEM_2 &&
+ (spellInfo->TotemCategory[0] != 0 || spellInfo->EffectItemType[0]==0)));
}
bool IsHigherHankOfSpell(uint32 spellId_1,uint32 spellId_2);