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 From ff2dbfc38196e0aa339896357898ec25c8dcdc97 Mon Sep 17 00:00:00 2001 From: kaelima Date: Thu, 22 Dec 2011 13:22:18 +0100 Subject: Core/Spells: Fix two signed / unsigned warnings from f8a13b401d132c6e8e86fb76244c0586378bc189 --- src/server/game/Spells/Spell.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 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 15901e33a91..e3fb407d52c 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3485,7 +3485,7 @@ void Spell::update(uint32 difftime) { if (m_timer) { - if (difftime >= m_timer) + if (difftime >= (uint32)m_timer) m_timer = 0; else m_timer -= difftime; @@ -3494,7 +3494,8 @@ void Spell::update(uint32 difftime) if (m_timer == 0 && !IsNextMeleeSwingSpell() && !IsAutoRepeat()) // don't CheckCast for instant spells - done in spell::prepare, skip duplicate checks, needed for range checks for example cast(!m_casttime); - } break; + break; + } case SPELL_STATE_CASTING: { if (m_timer > 0) @@ -3507,7 +3508,7 @@ void Spell::update(uint32 difftime) finish(); } - if (difftime >= m_timer) + if (difftime >= (uint32)m_timer) m_timer = 0; else m_timer -= difftime; @@ -3552,10 +3553,10 @@ void Spell::update(uint32 difftime) finish(); } - } break; + break; + } default: - { - }break; + break; } } -- cgit v1.2.3 From 398299084ef4c878cd362de86a2809099ce3a5be Mon Sep 17 00:00:00 2001 From: kaelima Date: Thu, 22 Dec 2011 18:48:06 +0100 Subject: Corrected some logic in my recent commits. - ff2dbfc38196e0aa339896357898ec25c8dcdc97 thanks LihO - 6ccf95af4c5ce24cf6eecc49830dd0d714184ff6 thanks frostmourne --- src/server/game/Spells/Spell.cpp | 15 +++++++++------ .../TrialOfTheChampion/boss_grand_champions.cpp | 4 ++-- 2 files changed, 11 insertions(+), 8 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 e3fb407d52c..d9abc15f4e5 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -3483,7 +3483,7 @@ void Spell::update(uint32 difftime) { case SPELL_STATE_PREPARING: { - if (m_timer) + if (m_timer > 0) { if (difftime >= (uint32)m_timer) m_timer = 0; @@ -3498,7 +3498,7 @@ void Spell::update(uint32 difftime) } case SPELL_STATE_CASTING: { - if (m_timer > 0) + if (m_timer) { // check if there are alive targets left if (!UpdateChanneledTargetList()) @@ -3508,10 +3508,13 @@ void Spell::update(uint32 difftime) finish(); } - if (difftime >= (uint32)m_timer) - m_timer = 0; - else - m_timer -= difftime; + if (m_timer > 0) + { + if (difftime >= (uint32)m_timer) + m_timer = 0; + else + m_timer -= difftime; + } } if (m_timer == 0) diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index ece172c685b..2f6a01e73d7 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -840,7 +840,7 @@ public: { DoCast(target, SPELL_MULTI_SHOT); } - else if (target) + else { Map::PlayerList const& players = me->GetMap()->GetPlayers(); if (me->GetMap()->IsDungeon() && !players.isEmpty()) @@ -850,7 +850,7 @@ public: Player* player = itr->getSource(); if (player && !player->isGameMaster() && me->IsInRange(player, 5.0f, 30.0f, false)) { - DoCast(target, SPELL_MULTI_SHOT); + DoCast(player, SPELL_MULTI_SHOT); break; } } -- cgit v1.2.3 From 15bd8f3cd51e908b0a56577119b7949a2bcb89ec Mon Sep 17 00:00:00 2001 From: QAston Date: Sat, 24 Dec 2011 08:40:30 +0100 Subject: Core/Spells: Fix logic in AnyDeadUnitSpellTargetInRangeCheck - spells using this should now correctly check target requirements. This is an alternative fix to #4112. --- src/server/game/Grids/Notifiers/GridNotifiers.cpp | 6 +++--- src/server/game/Spells/Spell.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/server/game/Spells/Spell.cpp') diff --git a/src/server/game/Grids/Notifiers/GridNotifiers.cpp b/src/server/game/Grids/Notifiers/GridNotifiers.cpp index ca61a82e840..99d402b4add 100755 --- a/src/server/game/Grids/Notifiers/GridNotifiers.cpp +++ b/src/server/game/Grids/Notifiers/GridNotifiers.cpp @@ -344,7 +344,7 @@ bool AnyDeadUnitObjectInRangeCheck::operator()(Creature* u) bool AnyDeadUnitSpellTargetInRangeCheck::operator()(Player* u) { return AnyDeadUnitObjectInRangeCheck::operator()(u) - && i_spellInfo->CheckTarget(i_searchObj, u, true) + && (i_spellInfo->CheckTarget(i_searchObj, u, true) == SPELL_CAST_OK) && i_searchObj->IsTargetMatchingCheck(u, i_check); } @@ -352,14 +352,14 @@ bool AnyDeadUnitSpellTargetInRangeCheck::operator()(Corpse* u) { Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGUID()); return owner && AnyDeadUnitObjectInRangeCheck::operator()(u) - && i_spellInfo->CheckTarget(i_searchObj, owner, true) + && (i_spellInfo->CheckTarget(i_searchObj, owner, true) == SPELL_CAST_OK) && i_searchObj->IsTargetMatchingCheck(owner, i_check); } bool AnyDeadUnitSpellTargetInRangeCheck::operator()(Creature* u) { return AnyDeadUnitObjectInRangeCheck::operator()(u) - && i_spellInfo->CheckTarget(i_searchObj, u, true) + && (i_spellInfo->CheckTarget(i_searchObj, u, true) == SPELL_CAST_OK) && i_searchObj->IsTargetMatchingCheck(u, i_check); } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index d9abc15f4e5..fbb1a1965d8 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -5653,7 +5653,8 @@ SpellCastResult Spell::CheckRange(bool strict) if (m_spellInfo->RangeEntry) { - // self cast is used for triggered spells, no range checking needed + // check needed by 68766 51693 - both spells are cast on enemies and have 0 max range + // these are triggered by other spells - possibly we should omit range check in that case? if (m_spellInfo->RangeEntry->ID == 1) return SPELL_CAST_OK; -- cgit v1.2.3 From 3405e0811d904cdff89f37e5ebe4cbcd886dfa65 Mon Sep 17 00:00:00 2001 From: Svannon Date: Sat, 24 Dec 2011 12:41:22 -0700 Subject: [Fishing] Reduce the Fishing cast cone to 35 degrees from each side of the facing instead of 70. Make the overall cone 70 degrees instead of 140. --- src/server/game/Spells/Spell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (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 d9abc15f4e5..e40a63a065c 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2033,7 +2033,7 @@ uint32 Spell::SelectEffectTargets(uint32 i, SpellImplicitTargetInfo const& cur) float max_dis = m_spellInfo->GetMaxRange(true); float dis = (float)rand_norm() * (max_dis - min_dis) + min_dis; float x, y, z, angle; - angle = (float)rand_norm() * static_cast(M_PI * 70.0f / 180.0f) - static_cast(M_PI * 35.0f / 180.0f); + angle = (float)rand_norm() * static_cast(M_PI * 35.0f / 180.0f) - static_cast(M_PI * 17.5f / 180.0f); m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE, dis, angle); m_targets.SetDst(x, y, z, m_caster->GetOrientation()); break; -- cgit v1.2.3