From f8a13b401d132c6e8e86fb76244c0586378bc189 Mon Sep 17 00:00:00 2001 From: kaelima Date: Thu, 22 Dec 2011 00:38:01 +0100 Subject: Core/Spells: - Fix channeling spells with infinite duration (-1) - Allowed SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND and SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND in SendCastResult (more reasons todo) --- src/server/game/Spells/Spell.cpp | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'src/server/game/Spells/Spell.cpp') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index e1c5b9074ba..15901e33a91 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3254,6 +3254,12 @@ void Spell::handle_immediate() m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags); SendChannelStart(duration); } + else if (duration == -1) + { + m_spellState = SPELL_STATE_CASTING; + m_caster->AddInterruptMask(m_spellInfo->ChannelInterruptFlags); + SendChannelStart(duration); + } } PrepareTargetProcessing(); @@ -3279,7 +3285,6 @@ void Spell::handle_immediate() if (m_spellInfo->IsRangedWeaponSpell() && m_spellInfo->IsChanneled()) TakeAmmo(); - if (m_spellState != SPELL_STATE_CASTING) finish(true); // successfully finish spell cast (not last in case autorepeat or channel spell) } @@ -3666,9 +3671,9 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas switch (result) { case SPELL_FAILED_REQUIRES_SPELL_FOCUS: - data << uint32(spellInfo->RequiresSpellFocus); + data << uint32(spellInfo->RequiresSpellFocus); // SpellFocusObject.dbc id break; - case SPELL_FAILED_REQUIRES_AREA: + case SPELL_FAILED_REQUIRES_AREA: // AreaTable.dbc id // hardcode areas limitation case switch (spellInfo->Id) { @@ -3701,14 +3706,15 @@ void Spell::SendCastResult(Player* caster, SpellInfo const* spellInfo, uint8 cas data << uint32(spellInfo->TotemCategory[1]); break; case SPELL_FAILED_EQUIPPED_ITEM_CLASS: + case SPELL_FAILED_EQUIPPED_ITEM_CLASS_MAINHAND: + case SPELL_FAILED_EQUIPPED_ITEM_CLASS_OFFHAND: data << uint32(spellInfo->EquippedItemClass); data << uint32(spellInfo->EquippedItemSubClassMask); - //data << uint32(spellInfo->EquippedItemInventoryTypeMask); break; case SPELL_FAILED_TOO_MANY_OF_ITEM: { uint32 item = 0; - for (int8 x = 0;x < 3; x++) + for (int8 x = 0; x < 3; x++) if (spellInfo->Effects[x].ItemType) item = spellInfo->Effects[x].ItemType; ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(item); @@ -3757,7 +3763,7 @@ void Spell::SendSpellStart() data << uint8(m_cast_count); // pending spell cast? data << uint32(m_spellInfo->Id); // spellId data << uint32(castFlags); // cast flags - data << uint32(m_timer); // delay? + data << int32(m_timer); // delay? m_targets.Write(data); @@ -3856,7 +3862,7 @@ void Spell::SendSpellGo() } } - if (castFlags & CAST_FLAG_UNKNOWN_18) // unknown wotlk + if (castFlags & CAST_FLAG_UNKNOWN_18) { data << float(0); data << uint32(0); @@ -3865,7 +3871,7 @@ void Spell::SendSpellGo() if (castFlags & CAST_FLAG_AMMO) WriteAmmoToPacket(&data); - if (castFlags & CAST_FLAG_UNKNOWN_20) // unknown wotlk + if (castFlags & CAST_FLAG_UNKNOWN_20) { data << uint32(0); data << uint32(0); @@ -6260,7 +6266,7 @@ void Spell::Delayed() // only called in DealDamage() AddPctN(delaytime, -delayReduce); - if (int32(m_timer) + delaytime > m_casttime) + if (m_timer + delaytime > m_casttime) { delaytime = m_casttime - m_timer; m_timer = m_casttime; @@ -6295,7 +6301,7 @@ void Spell::DelayedChannel() AddPctN(delaytime, -delayReduce); - if (int32(m_timer) <= delaytime) + if (m_timer <= delaytime) { delaytime = m_timer; m_timer = 0; -- cgit v1.2.3