Skip to content

Instantly share code, notes, and snippets.

@Langerz82
Created January 28, 2019 05:07
Show Gist options
  • Save Langerz82/12a4c9c8b759d9153e1d1bdae9fad2b1 to your computer and use it in GitHub Desktop.
Save Langerz82/12a4c9c8b759d9153e1d1bdae9fad2b1 to your computer and use it in GitHub Desktop.
diff --git a/src/game/WorldHandlers/Spell.cpp b/src/game/WorldHandlers/Spell.cpp
index 28b2eab..d429f0c 100644
--- a/src/game/WorldHandlers/Spell.cpp
+++ b/src/game/WorldHandlers/Spell.cpp
@@ -3620,8 +3620,12 @@ void Spell::SendInterrupted(SpellCastResult result)
void Spell::SendChannelUpdate(uint32 time)
{
+ if (time != 0 && CheckChannelInterrupt())
+ cancel();
+
if (time == 0)
{
+
// Reset farsight for some possessing auras of possessed summoned (as they might work with different aura types)
if (m_spellInfo->HasAttribute(SPELL_ATTR_EX_FARSIGHT) && m_caster->GetTypeId() == TYPEID_PLAYER && m_caster->GetCharmGuid()
&& !IsSpellHaveAura(m_spellInfo, SPELL_AURA_MOD_POSSESS) && !IsSpellHaveAura(m_spellInfo, SPELL_AURA_MOD_POSSESS_PET))
@@ -3675,8 +3679,30 @@ void Spell::SendChannelUpdate(uint32 time)
}
}
+bool Spell::CheckChannelInterrupt()
+{
+ for (TargetList::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
+ {
+ TargetInfo const& target = *ihit;
+ if (target.targetGUID != m_caster->GetObjectGuid() && target.missCondition == SPELL_MISS_NONE)
+ return false;
+ }
+ for (GOTargetList::const_iterator ihit = m_UniqueGOTargetInfo.begin(); ihit != m_UniqueGOTargetInfo.end(); ++ihit)
+ {
+ GOTargetInfo const& target = *ihit;
+ if (target.targetGUID != m_caster->GetObjectGuid())
+ return false;
+ }
+ return true;
+}
+
void Spell::SendChannelStart(uint32 duration)
{
+ if (CheckChannelInterrupt()) {
+ cancel();
+ return;
+ }
+
WorldObject* target = NULL;
// select dynobject created by first effect if any
diff --git a/src/game/WorldHandlers/Spell.h b/src/game/WorldHandlers/Spell.h
index c23f248..12a5d70 100644
--- a/src/game/WorldHandlers/Spell.h
+++ b/src/game/WorldHandlers/Spell.h
@@ -373,6 +373,8 @@ class Spell
void SendChannelStart(uint32 duration);
void SendResurrectRequest(Player* target);
+ bool CheckChannelInterrupt();
+
void HandleEffects(Unit* pUnitTarget, Item* pItemTarget, GameObject* pGOTarget, SpellEffectIndex i, float DamageMultiplier = 1.0);
void HandleThreatSpells();
// void HandleAddAura(Unit* Target);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment