aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Spells/Spell.cpp
diff options
context:
space:
mode:
authorShauren <shauren.trinity@gmail.com>2015-02-21 13:08:33 +0100
committerShauren <shauren.trinity@gmail.com>2015-02-21 13:08:33 +0100
commit68fceee10e6eede180ca444a2a7f2af2fe4ba5dc (patch)
tree5797248d23c302502f304c1f3614d8aaa6f08172 /src/server/game/Spells/Spell.cpp
parent6ff1764084d9234f35609a227567875cd95561a1 (diff)
Core/Spells: Removed leftovers of old cooldown handling
* Use ItemEffect.db2 data directly instead of copying it to another structure
Diffstat (limited to 'src/server/game/Spells/Spell.cpp')
-rw-r--r--src/server/game/Spells/Spell.cpp28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 3279e524b0c..61315062b10 100644
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -4398,12 +4398,12 @@ void Spell::TakeCastItem()
bool expendable = false;
bool withoutCharges = false;
- for (uint8 i = 0; i < proto->Effects.size(); ++i)
+ for (uint8 i = 0; i < proto->Effects.size() && i < 5; ++i)
{
// item has limited charges
- if (proto->Effects[i].Charges)
+ if (proto->Effects[i]->Charges)
{
- if (proto->Effects[i].Charges < 0)
+ if (proto->Effects[i]->Charges < 0)
expendable = true;
int32 charges = m_CastItem->GetSpellCharges(i);
@@ -4640,11 +4640,11 @@ void Spell::TakeReagents()
// if CastItem is also spell reagent
if (castItemTemplate && castItemTemplate->GetId() == itemid)
{
- for (uint8 s = 0; s < castItemTemplate->Effects.size(); ++s)
+ for (uint8 s = 0; s < castItemTemplate->Effects.size() && s < 5; ++s)
{
// CastItem will be used up and does not count as reagent
int32 charges = m_CastItem->GetSpellCharges(s);
- if (castItemTemplate->Effects[s].Charges < 0 && abs(charges) < 2)
+ if (castItemTemplate->Effects[s]->Charges < 0 && abs(charges) < 2)
{
++itemcount;
break;
@@ -6014,8 +6014,8 @@ SpellCastResult Spell::CheckItems()
if (!proto)
return SPELL_FAILED_ITEM_NOT_READY;
- for (uint8 i = 0; i < proto->Effects.size(); ++i)
- if (proto->Effects[i].Charges)
+ for (uint8 i = 0; i < proto->Effects.size() && i < 5; ++i)
+ if (proto->Effects[i]->Charges)
if (m_CastItem->GetSpellCharges(i) == 0)
return SPELL_FAILED_NO_CHARGES_REMAIN;
@@ -6115,11 +6115,11 @@ SpellCastResult Spell::CheckItems()
ItemTemplate const* proto = m_CastItem->GetTemplate();
if (!proto)
return SPELL_FAILED_ITEM_NOT_READY;
- for (uint8 s = 0; s < proto->Effects.size(); ++s)
+ for (uint8 s = 0; s < proto->Effects.size() && s < 5; ++s)
{
// CastItem will be used up and does not count as reagent
int32 charges = m_CastItem->GetSpellCharges(s);
- if (proto->Effects[s].Charges < 0 && abs(charges) < 2)
+ if (proto->Effects[s]->Charges < 0 && abs(charges) < 2)
{
++itemcount;
break;
@@ -6220,9 +6220,9 @@ SpellCastResult Spell::CheckItems()
ItemTemplate const* proto = targetItem->GetTemplate();
for (uint8 e = 0; e < proto->Effects.size(); ++e)
{
- if (proto->Effects[e].SpellID && (
- proto->Effects[e].Trigger == ITEM_SPELLTRIGGER_ON_USE ||
- proto->Effects[e].Trigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE))
+ if (proto->Effects[e]->SpellID && (
+ proto->Effects[e]->Trigger == ITEM_SPELLTRIGGER_ON_USE ||
+ proto->Effects[e]->Trigger == ITEM_SPELLTRIGGER_ON_NO_DELAY_USE))
{
isItemUsable = true;
break;
@@ -6399,8 +6399,8 @@ SpellCastResult Spell::CheckItems()
if (Item* pitem = player->GetItemByEntry(item_id))
{
- for (uint8 x = 0; x < pProto->Effects.size(); ++x)
- if (pProto->Effects[x].Charges != 0 && pitem->GetSpellCharges(x) == pProto->Effects[x].Charges)
+ for (uint8 x = 0; x < pProto->Effects.size() && x < 5; ++x)
+ if (pProto->Effects[x]->Charges != 0 && pitem->GetSpellCharges(x) == pProto->Effects[x]->Charges)
return SPELL_FAILED_ITEM_AT_MAX_CHARGES;
}
break;