diff options
Diffstat (limited to 'src/server/game/Handlers/SpellHandler.cpp')
-rw-r--r-- | src/server/game/Handlers/SpellHandler.cpp | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/src/server/game/Handlers/SpellHandler.cpp b/src/server/game/Handlers/SpellHandler.cpp index ec9d24d02d3..cfc2b1cefcd 100644 --- a/src/server/game/Handlers/SpellHandler.cpp +++ b/src/server/game/Handlers/SpellHandler.cpp @@ -299,9 +299,35 @@ void WorldSession::HandleCastSpellOpcode(WorldPackets::Spells::CastSpell& cast) caster = _player; } + TriggerCastFlags triggerFlag = TRIGGERED_NONE; + + // client provided targets + SpellCastTargets targets(caster, cast.Cast); + // check known spell or raid marker spell (which not requires player to know it) if (caster->GetTypeId() == TYPEID_PLAYER && !caster->ToPlayer()->HasActiveSpell(spellInfo->Id) && !spellInfo->HasEffect(SPELL_EFFECT_CHANGE_RAID_MARKER) && !spellInfo->HasAttribute(SPELL_ATTR8_RAID_MARKER)) - return; + { + bool allow = false; + + + // allow casting of unknown spells for special lock cases + if (GameObject* go = targets.GetGOTarget()) + if (go->GetSpellForLock(caster->ToPlayer()) == spellInfo) + allow = true; + + // TODO: Preparation for #23204 + // allow casting of spells triggered by clientside periodic trigger auras + /* + if (caster->HasAuraTypeWithTriggerSpell(SPELL_AURA_PERIODIC_TRIGGER_SPELL_FROM_CLIENT, spellId)) + { + allow = true; + triggerFlag = TRIGGERED_FULL_MASK; + } + */ + + if (!allow) + return; + } // Check possible spell cast overrides spellInfo = caster->GetCastSpellInfo(spellInfo); @@ -310,9 +336,6 @@ void WorldSession::HandleCastSpellOpcode(WorldPackets::Spells::CastSpell& cast) if (_player->isPossessing()) return; - // client provided targets - SpellCastTargets targets(caster, cast.Cast); - // Client is resending autoshot cast opcode when other spell is cast during shoot rotation // Skip it to prevent "interrupt" message // Also check targets! target may have changed and we need to interrupt current spell @@ -334,7 +357,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPackets::Spells::CastSpell& cast) if (cast.Cast.MoveUpdate) HandleMovementOpcode(CMSG_MOVE_STOP, *cast.Cast.MoveUpdate); - Spell* spell = new Spell(caster, spellInfo, TRIGGERED_NONE); + Spell* spell = new Spell(caster, spellInfo, triggerFlag); WorldPackets::Spells::SpellPrepare spellPrepare; spellPrepare.ClientCastID = cast.Cast.CastID; |