[8070] Restore spell casting loot items and recipes.

* SPELL_EFFECT_OPEN_LOCK_ITEM (59) effect removed in 3.1.3
* It replaced by SPELL_EFFECT_CREATE_RANDOM_ITEM (59), random item without template replace spells like clam loot spells)
  Used by spells that use before SPELL_EFFECT_CREATE_ITEM_2 (157) with itemtype==0

Note: required DB support in `spell_loot_termplate`
This commit is contained in:
VladimirMangos 2009-06-23 03:32:08 +04:00
parent e455ee7da7
commit 7175007aba
8 changed files with 33 additions and 30 deletions

View file

@ -1320,11 +1320,13 @@ void LoadLootTemplates_Spell()
if(!ids_set.count(spell_id)) if(!ids_set.count(spell_id))
{ {
// not report about not trainable spells (optionally supported by DB) except with SPELL_ATTR_EX2_UNK14 (clams) // not report about not trainable spells (optionally supported by DB)
// 61756 (Northrend Inscription Research (FAST QA VERSION) for example // ignore 61756 (Northrend Inscription Research (FAST QA VERSION) for example
if ((spellInfo->Attributes & SPELL_ATTR_UNK5) || (spellInfo->AttributesEx2 & SPELL_ATTR_EX2_UNK14)) if (!(spellInfo->Attributes & SPELL_ATTR_NOT_SHAPESHIFT) || (spellInfo->Attributes & SPELL_ATTR_UNK5))
{
LootTemplates_Spell.ReportNotExistedId(spell_id); LootTemplates_Spell.ReportNotExistedId(spell_id);
} }
}
else else
ids_set.erase(spell_id); ids_set.erase(spell_id);
} }

View file

@ -579,7 +579,7 @@ enum SpellEffects
SPELL_EFFECT_SUMMON_PET = 56, SPELL_EFFECT_SUMMON_PET = 56,
SPELL_EFFECT_LEARN_PET_SPELL = 57, SPELL_EFFECT_LEARN_PET_SPELL = 57,
SPELL_EFFECT_WEAPON_DAMAGE = 58, SPELL_EFFECT_WEAPON_DAMAGE = 58,
SPELL_EFFECT_OPEN_LOCK_ITEM = 59, SPELL_EFFECT_CREATE_RANDOM_ITEM = 59,
SPELL_EFFECT_PROFICIENCY = 60, SPELL_EFFECT_PROFICIENCY = 60,
SPELL_EFFECT_SEND_EVENT = 61, SPELL_EFFECT_SEND_EVENT = 61,
SPELL_EFFECT_POWER_BURN = 62, SPELL_EFFECT_POWER_BURN = 62,

View file

@ -4165,7 +4165,6 @@ SpellCastResult Spell::CheckCast(bool strict)
break; break;
} }
case SPELL_EFFECT_OPEN_LOCK_ITEM:
case SPELL_EFFECT_OPEN_LOCK: case SPELL_EFFECT_OPEN_LOCK:
{ {
if( m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT && if( m_spellInfo->EffectImplicitTargetA[i] != TARGET_GAMEOBJECT &&

View file

@ -229,11 +229,11 @@ class Spell
void EffectQuestComplete(uint32 i); void EffectQuestComplete(uint32 i);
void EffectCreateItem(uint32 i); void EffectCreateItem(uint32 i);
void EffectCreateItem2(uint32 i); void EffectCreateItem2(uint32 i);
void EffectCreateRandomItem(uint32 i);
void EffectPersistentAA(uint32 i); void EffectPersistentAA(uint32 i);
void EffectEnergize(uint32 i); void EffectEnergize(uint32 i);
void EffectOpenLock(uint32 i); void EffectOpenLock(uint32 i);
void EffectSummonChangeItem(uint32 i); void EffectSummonChangeItem(uint32 i);
void EffectOpenSecretSafe(uint32 i);
void EffectProficiency(uint32 i); void EffectProficiency(uint32 i);
void EffectApplyAreaAura(uint32 i); void EffectApplyAreaAura(uint32 i);
void EffectSummonType(uint32 i); void EffectSummonType(uint32 i);

View file

@ -116,7 +116,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectSummonPet, // 56 SPELL_EFFECT_SUMMON_PET &Spell::EffectSummonPet, // 56 SPELL_EFFECT_SUMMON_PET
&Spell::EffectLearnPetSpell, // 57 SPELL_EFFECT_LEARN_PET_SPELL &Spell::EffectLearnPetSpell, // 57 SPELL_EFFECT_LEARN_PET_SPELL
&Spell::EffectWeaponDmg, // 58 SPELL_EFFECT_WEAPON_DAMAGE &Spell::EffectWeaponDmg, // 58 SPELL_EFFECT_WEAPON_DAMAGE
&Spell::EffectOpenSecretSafe, // 59 SPELL_EFFECT_OPEN_LOCK_ITEM &Spell::EffectCreateRandomItem, // 59 SPELL_EFFECT_CREATE_RANDOM_ITEM create item base at spell specific loot
&Spell::EffectProficiency, // 60 SPELL_EFFECT_PROFICIENCY &Spell::EffectProficiency, // 60 SPELL_EFFECT_PROFICIENCY
&Spell::EffectSendEvent, // 61 SPELL_EFFECT_SEND_EVENT &Spell::EffectSendEvent, // 61 SPELL_EFFECT_SEND_EVENT
&Spell::EffectPowerBurn, // 62 SPELL_EFFECT_POWER_BURN &Spell::EffectPowerBurn, // 62 SPELL_EFFECT_POWER_BURN
@ -214,7 +214,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectNULL, //154 unused &Spell::EffectNULL, //154 unused
&Spell::EffectTitanGrip, //155 SPELL_EFFECT_TITAN_GRIP Allows you to equip two-handed axes, maces and swords in one hand, but you attack $49152s1% slower than normal. &Spell::EffectTitanGrip, //155 SPELL_EFFECT_TITAN_GRIP Allows you to equip two-handed axes, maces and swords in one hand, but you attack $49152s1% slower than normal.
&Spell::EffectEnchantItemPrismatic, //156 SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC &Spell::EffectEnchantItemPrismatic, //156 SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC
&Spell::EffectCreateItem2, //157 SPELL_EFFECT_CREATE_ITEM_2 create/learn item/spell for profession &Spell::EffectCreateItem2, //157 SPELL_EFFECT_CREATE_ITEM_2 create item or create item template and replace by some randon spell loot item
&Spell::EffectMilling, //158 SPELL_EFFECT_MILLING milling &Spell::EffectMilling, //158 SPELL_EFFECT_MILLING milling
&Spell::EffectRenamePet, //159 SPELL_EFFECT_ALLOW_RENAME_PET allow rename pet once again &Spell::EffectRenamePet, //159 SPELL_EFFECT_ALLOW_RENAME_PET allow rename pet once again
&Spell::EffectNULL, //160 SPELL_EFFECT_160 unused &Spell::EffectNULL, //160 SPELL_EFFECT_160 unused
@ -2705,13 +2705,11 @@ void Spell::EffectCreateItem2(uint32 i)
Player* player = (Player*)m_caster; Player* player = (Player*)m_caster;
uint32 item_id = m_spellInfo->EffectItemType[i]; uint32 item_id = m_spellInfo->EffectItemType[i];
if(item_id)
DoCreateItem(i, item_id); DoCreateItem(i, item_id);
// special case: fake item replaced by generate using spell_loot_template // special case: fake item replaced by generate using spell_loot_template
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;
@ -2719,13 +2717,22 @@ void Spell::EffectCreateItem2(uint32 i)
// 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);
} }
} }
void Spell::EffectCreateRandomItem(uint32 i)
{
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
return;
Player* player = (Player*)m_caster;
// create some random items
player->AutoStoreLoot(m_spellInfo->Id, LootTemplates_Spell);
}
void Spell::EffectPersistentAA(uint32 i) void Spell::EffectPersistentAA(uint32 i)
{ {
float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i])); float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
@ -3127,11 +3134,6 @@ void Spell::EffectSummonChangeItem(uint32 i)
delete pNewItem; delete pNewItem;
} }
void Spell::EffectOpenSecretSafe(uint32 i)
{
EffectOpenLock(i); //no difference for now
}
void Spell::EffectProficiency(uint32 /*i*/) void Spell::EffectProficiency(uint32 /*i*/)
{ {
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)

View file

@ -2318,6 +2318,7 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg)
// craft spell for crafting non-existed item (break client recipes list show) // craft spell for crafting non-existed item (break client recipes list show)
case SPELL_EFFECT_CREATE_ITEM: case SPELL_EFFECT_CREATE_ITEM:
case SPELL_EFFECT_CREATE_ITEM_2:
{ {
if(!ObjectMgr::GetItemPrototype( spellInfo->EffectItemType[i] )) if(!ObjectMgr::GetItemPrototype( spellInfo->EffectItemType[i] ))
{ {

View file

@ -145,15 +145,14 @@ inline bool IsElementalShield(SpellEntry const *spellInfo)
inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo) inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo)
{ {
return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->Effect[1]==SPELL_EFFECT_SCRIPT_EFFECT; return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_RANDOM_ITEM && spellInfo->Effect[1]==SPELL_EFFECT_SCRIPT_EFFECT;
} }
inline bool IsLootCraftingSpell(SpellEntry const *spellInfo) inline bool IsLootCraftingSpell(SpellEntry const *spellInfo)
{ {
return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && ( return spellInfo->Effect[0]==SPELL_EFFECT_CREATE_RANDOM_ITEM ||
spellInfo->Effect[1]==SPELL_EFFECT_SCRIPT_EFFECT || // see IsExplicitDiscoverySpell // different random cards from Inscription (121==Virtuoso Inking Set category)
!spellInfo->EffectItemType[0] || // result item not provided spellInfo->Effect[0]==SPELL_EFFECT_CREATE_ITEM_2 && spellInfo->TotemCategory[0] == 121;
spellInfo->TotemCategory[0] == 121); // different random cards from Inscription (121==Virtuoso Inking Set category)
} }
int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2); int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "8069" #define REVISION_NR "8070"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__