mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 07:37:03 +00:00
[9280] Fixed work scrolls of enchantment.
SOme for its have spells with unexpected reagent requirements. Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
parent
7bb40630e5
commit
ad7729479c
3 changed files with 79 additions and 59 deletions
|
|
@ -3812,14 +3812,14 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take)
|
||||||
|
|
||||||
void Spell::TakeReagents()
|
void Spell::TakeReagents()
|
||||||
{
|
{
|
||||||
if(m_IsTriggeredSpell) // reagents used in triggered spell removed by original spell or don't must be removed.
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (IgnoreItemRequirements()) // reagents used in triggered spell removed by original spell or don't must be removed.
|
||||||
|
return;
|
||||||
|
|
||||||
Player* p_caster = (Player*)m_caster;
|
Player* p_caster = (Player*)m_caster;
|
||||||
if (p_caster->CanNoReagentCast(m_spellInfo))
|
if (p_caster->CanNoReagentCast(m_spellInfo) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for(uint32 x = 0; x < 8; ++x)
|
for(uint32 x = 0; x < 8; ++x)
|
||||||
|
|
@ -5383,6 +5383,18 @@ SpellCastResult Spell::CheckPower()
|
||||||
return SPELL_CAST_OK;
|
return SPELL_CAST_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Spell::IgnoreItemRequirements() const
|
||||||
|
{
|
||||||
|
if (m_IsTriggeredSpell)
|
||||||
|
return true;
|
||||||
|
|
||||||
|
/// Check if it's an enchant scroll. These have no required reagents even though their spell does.
|
||||||
|
if (m_CastItem && m_CastItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_ENCHANT_SCROLL))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
SpellCastResult Spell::CheckItems()
|
SpellCastResult Spell::CheckItems()
|
||||||
{
|
{
|
||||||
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
if (m_caster->GetTypeId() != TYPEID_PLAYER)
|
||||||
|
|
@ -5499,7 +5511,9 @@ SpellCastResult Spell::CheckItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
// check reagents (ignore triggered spells with reagents processed by original spell) and special reagent ignore case.
|
// check reagents (ignore triggered spells with reagents processed by original spell) and special reagent ignore case.
|
||||||
if (!m_IsTriggeredSpell && !p_caster->CanNoReagentCast(m_spellInfo))
|
if (!IgnoreItemRequirements())
|
||||||
|
{
|
||||||
|
if (!p_caster->CanNoReagentCast(m_spellInfo))
|
||||||
{
|
{
|
||||||
for(uint32 i = 0; i < 8; ++i)
|
for(uint32 i = 0; i < 8; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -5510,10 +5524,10 @@ SpellCastResult Spell::CheckItems()
|
||||||
uint32 itemcount = m_spellInfo->ReagentCount[i];
|
uint32 itemcount = m_spellInfo->ReagentCount[i];
|
||||||
|
|
||||||
// if CastItem is also spell reagent
|
// if CastItem is also spell reagent
|
||||||
if( m_CastItem && m_CastItem->GetEntry() == itemid )
|
if (m_CastItem && m_CastItem->GetEntry() == itemid)
|
||||||
{
|
{
|
||||||
ItemPrototype const *proto = m_CastItem->GetProto();
|
ItemPrototype const *proto = m_CastItem->GetProto();
|
||||||
if(!proto)
|
if (!proto)
|
||||||
return SPELL_FAILED_REAGENTS;
|
return SPELL_FAILED_REAGENTS;
|
||||||
for(int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
|
for(int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
|
||||||
{
|
{
|
||||||
|
|
@ -5526,7 +5540,8 @@ SpellCastResult Spell::CheckItems()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( !p_caster->HasItemCount(itemid, itemcount) )
|
|
||||||
|
if (!p_caster->HasItemCount(itemid, itemcount))
|
||||||
return SPELL_FAILED_REAGENTS;
|
return SPELL_FAILED_REAGENTS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -5535,26 +5550,28 @@ SpellCastResult Spell::CheckItems()
|
||||||
uint32 totems = 2;
|
uint32 totems = 2;
|
||||||
for(int i = 0; i < 2 ; ++i)
|
for(int i = 0; i < 2 ; ++i)
|
||||||
{
|
{
|
||||||
if(m_spellInfo->Totem[i] != 0)
|
if (m_spellInfo->Totem[i] != 0)
|
||||||
{
|
{
|
||||||
if( p_caster->HasItemCount(m_spellInfo->Totem[i], 1) )
|
if (p_caster->HasItemCount(m_spellInfo->Totem[i], 1))
|
||||||
{
|
{
|
||||||
totems -= 1;
|
totems -= 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}else
|
}
|
||||||
|
else
|
||||||
totems -= 1;
|
totems -= 1;
|
||||||
}
|
}
|
||||||
if(totems != 0)
|
|
||||||
|
if (totems != 0)
|
||||||
return SPELL_FAILED_TOTEMS; //0x7C
|
return SPELL_FAILED_TOTEMS; //0x7C
|
||||||
|
|
||||||
// Check items for TotemCategory (items presence in inventory)
|
// Check items for TotemCategory (items presence in inventory)
|
||||||
uint32 TotemCategory = 2;
|
uint32 TotemCategory = 2;
|
||||||
for(int i= 0; i < 2; ++i)
|
for(int i= 0; i < 2; ++i)
|
||||||
{
|
{
|
||||||
if(m_spellInfo->TotemCategory[i] != 0)
|
if (m_spellInfo->TotemCategory[i] != 0)
|
||||||
{
|
{
|
||||||
if( p_caster->HasItemTotemCategory(m_spellInfo->TotemCategory[i]) )
|
if (p_caster->HasItemTotemCategory(m_spellInfo->TotemCategory[i]))
|
||||||
{
|
{
|
||||||
TotemCategory -= 1;
|
TotemCategory -= 1;
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -5563,9 +5580,11 @@ SpellCastResult Spell::CheckItems()
|
||||||
else
|
else
|
||||||
TotemCategory -= 1;
|
TotemCategory -= 1;
|
||||||
}
|
}
|
||||||
if(TotemCategory != 0)
|
|
||||||
|
if (TotemCategory != 0)
|
||||||
return SPELL_FAILED_TOTEM_CATEGORY; //0x7B
|
return SPELL_FAILED_TOTEM_CATEGORY; //0x7B
|
||||||
|
|
||||||
|
}
|
||||||
// special checks for spell effects
|
// special checks for spell effects
|
||||||
for(int i = 0; i < 3; ++i)
|
for(int i = 0; i < 3; ++i)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -456,6 +456,7 @@ class Spell
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void SendLoot(uint64 guid, LootType loottype);
|
void SendLoot(uint64 guid, LootType loottype);
|
||||||
|
bool IgnoreItemRequirements() const; // some item use spells have unexpected reagent data
|
||||||
|
|
||||||
Unit* m_caster;
|
Unit* m_caster;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "9279"
|
#define REVISION_NR "9280"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue