[9862] Defines for some spelentry arrays.

* Move and rename MAX_REAGENTS to DBC Strcuture.h.
  It used only afore access to SpellEntry field and so part of strcuture definition.
* Add MAX_SPELL_TOTEMS and MAX_SPELL_TOTEM_CATEGORIES for same reasons, and use in code.
This commit is contained in:
VladimirMangos 2010-05-11 00:02:32 +04:00
parent ff2cda6af1
commit 6fb07911f9
6 changed files with 23 additions and 22 deletions

View file

@ -407,6 +407,5 @@ enum SpellEffectIndex
}; };
#define MAX_EFFECT_INDEX 3 #define MAX_EFFECT_INDEX 3
#define MAX_REAGENTS 8
#endif #endif

View file

@ -1358,6 +1358,10 @@ struct SoundEntriesEntry
// 29 new in 3.1 // 29 new in 3.1
}; };
#define MAX_SPELL_REAGENTS 8
#define MAX_SPELL_TOTEMS 2
#define MAX_SPELL_TOTEM_CATEGORIES 2
struct SpellEntry struct SpellEntry
{ {
uint32 Id; // 0 m_ID uint32 Id; // 0 m_ID
@ -1410,9 +1414,9 @@ struct SpellEntry
float speed; // 47 m_speed float speed; // 47 m_speed
//uint32 modalNextSpell; // 48 m_modalNextSpell not used //uint32 modalNextSpell; // 48 m_modalNextSpell not used
uint32 StackAmount; // 49 m_cumulativeAura uint32 StackAmount; // 49 m_cumulativeAura
uint32 Totem[2]; // 50-51 m_totem uint32 Totem[MAX_SPELL_TOTEMS]; // 50-51 m_totem
int32 Reagent[MAX_REAGENTS]; // 52-59 m_reagent int32 Reagent[MAX_SPELL_REAGENTS]; // 52-59 m_reagent
uint32 ReagentCount[MAX_REAGENTS]; // 60-67 m_reagentCount uint32 ReagentCount[MAX_SPELL_REAGENTS]; // 60-67 m_reagentCount
int32 EquippedItemClass; // 68 m_equippedItemClass (value) int32 EquippedItemClass; // 68 m_equippedItemClass (value)
int32 EquippedItemSubClassMask; // 69 m_equippedItemSubclass (mask) int32 EquippedItemSubClassMask; // 69 m_equippedItemSubclass (mask)
int32 EquippedItemInventoryTypeMask; // 70 m_equippedItemInvTypes (mask) int32 EquippedItemInventoryTypeMask; // 70 m_equippedItemInvTypes (mask)
@ -1463,7 +1467,7 @@ struct SpellEntry
//uint32 MinFactionId; // 219 m_minFactionID not used //uint32 MinFactionId; // 219 m_minFactionID not used
//uint32 MinReputation; // 220 m_minReputation not used //uint32 MinReputation; // 220 m_minReputation not used
//uint32 RequiredAuraVision; // 221 m_requiredAuraVision not used //uint32 RequiredAuraVision; // 221 m_requiredAuraVision not used
uint32 TotemCategory[2]; // 222-223 m_requiredTotemCategoryID uint32 TotemCategory[MAX_SPELL_TOTEM_CATEGORIES]; // 222-223 m_requiredTotemCategoryID
int32 AreaGroupId; // 224 m_requiredAreaGroupId int32 AreaGroupId; // 224 m_requiredAreaGroupId
uint32 SchoolMask; // 225 m_schoolMask uint32 SchoolMask; // 225 m_schoolMask
uint32 runeCostID; // 226 m_runeCostID uint32 runeCostID; // 226 m_runeCostID

View file

@ -17435,7 +17435,7 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
if(spellInfo) if(spellInfo)
{ {
for(uint32 i = 0; i < MAX_REAGENTS; ++i) for(uint32 i = 0; i < MAX_SPELL_REAGENTS; ++i)
{ {
if(spellInfo->Reagent[i] > 0) if(spellInfo->Reagent[i] > 0)
{ {

View file

@ -3261,16 +3261,14 @@ void Spell::SendCastResult(Player* caster, SpellEntry const* spellInfo, uint8 ca
} }
break; break;
case SPELL_FAILED_TOTEMS: case SPELL_FAILED_TOTEMS:
if(spellInfo->Totem[0]) for(int i = 0; i < MAX_SPELL_TOTEMS; ++i)
data << uint32(spellInfo->Totem[0]); if(spellInfo->Totem[i])
if(spellInfo->Totem[1]) data << uint32(spellInfo->Totem[i]);
data << uint32(spellInfo->Totem[1]);
break; break;
case SPELL_FAILED_TOTEM_CATEGORY: case SPELL_FAILED_TOTEM_CATEGORY:
if(spellInfo->TotemCategory[0]) for(int i = 0; i < MAX_SPELL_TOTEM_CATEGORIES; ++i)
data << uint32(spellInfo->TotemCategory[0]); if(spellInfo->TotemCategory[i])
if(spellInfo->TotemCategory[1]) data << uint32(spellInfo->TotemCategory[i]);
data << uint32(spellInfo->TotemCategory[1]);
break; break;
case SPELL_FAILED_EQUIPPED_ITEM_CLASS: case SPELL_FAILED_EQUIPPED_ITEM_CLASS:
data << uint32(spellInfo->EquippedItemClass); data << uint32(spellInfo->EquippedItemClass);
@ -3958,7 +3956,7 @@ void Spell::TakeReagents()
if (p_caster->CanNoReagentCast(m_spellInfo) ) if (p_caster->CanNoReagentCast(m_spellInfo) )
return; return;
for(uint32 x = 0; x < MAX_REAGENTS; ++x) for(uint32 x = 0; x < MAX_SPELL_REAGENTS; ++x)
{ {
if(m_spellInfo->Reagent[x] <= 0) if(m_spellInfo->Reagent[x] <= 0)
continue; continue;
@ -5643,7 +5641,7 @@ SpellCastResult Spell::CheckItems()
{ {
if (!p_caster->CanNoReagentCast(m_spellInfo)) if (!p_caster->CanNoReagentCast(m_spellInfo))
{ {
for(uint32 i = 0; i < MAX_REAGENTS; ++i) for(uint32 i = 0; i < MAX_SPELL_REAGENTS; ++i)
{ {
if(m_spellInfo->Reagent[i] <= 0) if(m_spellInfo->Reagent[i] <= 0)
continue; continue;
@ -5675,8 +5673,8 @@ SpellCastResult Spell::CheckItems()
} }
// check totem-item requirements (items presence in inventory) // check totem-item requirements (items presence in inventory)
uint32 totems = 2; uint32 totems = MAX_SPELL_TOTEMS;
for(int i = 0; i < 2 ; ++i) for(int i = 0; i < MAX_SPELL_TOTEMS ; ++i)
{ {
if (m_spellInfo->Totem[i] != 0) if (m_spellInfo->Totem[i] != 0)
{ {
@ -5694,8 +5692,8 @@ SpellCastResult Spell::CheckItems()
return SPELL_FAILED_TOTEMS; return SPELL_FAILED_TOTEMS;
// Check items for TotemCategory (items presence in inventory) // Check items for TotemCategory (items presence in inventory)
uint32 TotemCategory = 2; uint32 TotemCategory = MAX_SPELL_TOTEM_CATEGORIES;
for(int i= 0; i < 2; ++i) for(int i= 0; i < MAX_SPELL_TOTEM_CATEGORIES; ++i)
{ {
if (m_spellInfo->TotemCategory[i] != 0) if (m_spellInfo->TotemCategory[i] != 0)
{ {

View file

@ -2709,7 +2709,7 @@ bool SpellMgr::IsSpellValid(SpellEntry const* spellInfo, Player* pl, bool msg)
if(need_check_reagents) if(need_check_reagents)
{ {
for(int j = 0; j < MAX_REAGENTS; ++j) for(int j = 0; j < MAX_SPELL_REAGENTS; ++j)
{ {
if(spellInfo->Reagent[j] > 0 && !ObjectMgr::GetItemPrototype( spellInfo->Reagent[j] )) if(spellInfo->Reagent[j] > 0 && !ObjectMgr::GetItemPrototype( spellInfo->Reagent[j] ))
{ {

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 "9861" #define REVISION_NR "9862"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__