mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 16:37:00 +00:00
[7881] More types with random generated item at recipe casting. Cleanups code.
Real resulting items creating required DB support (helper error message outputed at loading)
This commit is contained in:
parent
3d1b055e9e
commit
5616ef173b
3 changed files with 27 additions and 32 deletions
|
|
@ -2697,17 +2697,30 @@ void Spell::EffectCreateItem(uint32 i)
|
||||||
|
|
||||||
void Spell::EffectCreateItem2(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)
|
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
|
||||||
return;
|
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(item_id)
|
||||||
|
{
|
||||||
|
if(!player->HasItemCount(item_id,1))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// remove reagent
|
||||||
|
uint32 count = 1;
|
||||||
|
player->DestroyItemCount (item_id,count,true);
|
||||||
|
}
|
||||||
|
|
||||||
// create some random items
|
// create some random items
|
||||||
((Player*)m_caster)->AutoStoreLoot(m_spellInfo->Id,LootTemplates_Spell);
|
player->AutoStoreLoot(m_spellInfo->Id,LootTemplates_Spell);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
DoCreateItem(i,m_spellInfo->EffectItemType[i]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spell::EffectPersistentAA(uint32 i)
|
void Spell::EffectPersistentAA(uint32 i)
|
||||||
|
|
@ -4927,32 +4940,12 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
||||||
case 61288: // Minor Inscription Research
|
case 61288: // Minor Inscription Research
|
||||||
case 61756: // Northrend Inscription Research (FAST QA VERSION)
|
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)
|
if(m_caster->GetTypeId()!=TYPEID_PLAYER)
|
||||||
return;
|
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)
|
// learn random explicit discovery recipe (if any)
|
||||||
if(uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, player))
|
if(uint32 discoveredSpell = GetExplicitDiscoverySpell(m_spellInfo->Id, (Player*)m_caster))
|
||||||
player->learnSpell(discoveredSpell,false);
|
((Player*)m_caster)->learnSpell(discoveredSpell,false);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -140,8 +140,10 @@ inline bool IsExplicitDiscoverySpell(SpellEntry const *spellInfo)
|
||||||
|
|
||||||
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_ITEM_2 && (
|
||||||
(spellInfo->Effect[1]==SPELL_EFFECT_SCRIPT_EFFECT || !spellInfo->EffectItemType[0]);
|
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)
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "7880"
|
#define REVISION_NR "7881"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue