Jump to content

Need a fix for demonic circle


Auntie Mangos

Recommended Posts

  • 40 years later...

Hey guys,

I need a fix for demonic circle the warlock spell as it just doesnt work.

if there is a thread like this on forums explaining how to fix it, then giving me a link would be great.

If there isnt a thread like this, then a little bit of help would be cool

Thanks

Link to comment
Share on other sites

EDIT: Credits go to jizar

diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index b0acd37..6d67881 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2197,6 +2197,11 @@ void Spell::SetTargetMap(SpellEffectIndex effIndex, uint32 targetMode, UnitList&
        {
            // add here custom effects that need default target.
            // FOR EVERY TARGET TYPE THERE IS A DIFFERENT FILL!!
+            if (m_spellInfo->SpellFamilyFlags2 & UI64LIT (0x00000020) && m_spellInfo->SpellIconID == 3217)
+            {
+                targetUnitMap.push_back(m_caster);
+                break;
+            }
            switch(m_spellInfo->Effect[effIndex])
            {
                case SPELL_EFFECT_DUMMY:
@@ -3995,7 +4000,9 @@ SpellCastResult Spell::CheckCast(bool strict)
        return SPELL_FAILED_CASTER_AURASTATE;

    // Caster aura req check if need
-    if(m_spellInfo->casterAuraSpell && !m_caster->HasAura(m_spellInfo->casterAuraSpell))
+    if(m_spellInfo->casterAuraSpell &&
+        sSpellStore.LookupEntry(m_spellInfo->casterAuraSpell) &&
+        !m_caster->HasAura(m_spellInfo->casterAuraSpell))
        return SPELL_FAILED_CASTER_AURASTATE;
    if(m_spellInfo->excludeCasterAuraSpell)
    {
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 35362de..2df7592 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -1229,6 +1229,38 @@ bool Aura::_RemoveAura()
    return true;
}

+void Aura::SendFakeAuraUpdate(uint32 auraId, bool remove)
+{
+    WorldPacket data(SMSG_AURA_UPDATE);
+    data << m_target->GetPackGUID();
+    data << uint8(64);
+    data << uint32(remove ? 0 : auraId);
+
+    if(remove)
+    {
+        m_target->SendMessageToSet(&data, true);
+        return;
+    }
+
+    uint8 auraFlags = GetAuraFlags();
+    data << uint8(auraFlags);
+    data << uint8(GetAuraLevel());
+    data << uint8(m_procCharges ? m_procCharges : m_stackAmount);
+
+    if(!(auraFlags & AFLAG_NOT_CASTER))
+    {
+        data << uint8(0);                                   // pguid
+    }
+
+    if(auraFlags & AFLAG_DURATION)
+    {
+        data << uint32(GetAuraMaxDuration());
+        data << uint32(GetAuraDuration());
+    }
+
+    m_target->SendMessageToSet(&data, true);
+}
+
void Aura::SendAuraUpdate(bool remove)
{
    WorldPacket data(SMSG_AURA_UPDATE);
@@ -4474,6 +4506,19 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/)

    m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,misc,apply);

+    // Demonic Circle
+    if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_WARLOCK && GetSpellProto()->SpellIconID == 3221)
+    {
+        if (m_target->GetTypeId() != TYPEID_PLAYER)
+            return;
+        if (apply)
+        {
+            GameObject* obj = m_target->GetGameObject(48018);
+            if (obj)
+                if (m_target->IsWithinDist(obj,GetSpellMaxRange(sSpellRangeStore.LookupEntry(GetSpellProto()->rangeIndex))))
+                    ((Player*)m_target)->TeleportTo(obj->GetMapId(),obj->GetPositionX(),obj->GetPositionY(),obj->GetPositionZ(),obj->GetOrientation());
+        }
+    }
    // Bestial Wrath
    if (GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->SpellIconID == 1680)
    {
@@ -4745,6 +4790,21 @@ void Aura::HandleAuraPeriodicDummy(bool apply, bool Real)
            }
            break;
        }
+        case SPELLFAMILY_WARLOCK:
+        {
+            switch (spell->Id)
+            {
+                case 48018:
+                    if (apply)
+                        SendFakeAuraUpdate(62388,false);
+                    else
+                    {
+                        m_target->RemoveGameObject(spell->Id,true);
+                        SendFakeAuraUpdate(62388,true);
+                    }
+                break;
+            }
+        }
        case SPELLFAMILY_HUNTER:
        {
            Unit* caster = GetCaster();
@@ -7855,6 +7915,20 @@ void Aura::PeriodicDummyTick()
            }
            break;
        }
+        case SPELLFAMILY_WARLOCK:
+            switch (spell->Id)
+            {
+                case 48018:
+                    GameObject* obj = m_target->GetGameObject(spell->Id);
+                    if (!obj) return;
+                    // We must take a range of teleport spell, not summon.
+                    const SpellEntry* goToCircleSpell = sSpellStore.LookupEntry(48020);
+                    if (m_target->IsWithinDist(obj,GetSpellMaxRange(sSpellRangeStore.LookupEntry(goToCircleSpell->rangeIndex))))
+                        SendFakeAuraUpdate(62388,false);
+                    else
+                        SendFakeAuraUpdate(62388,true);
+            }
+            break;
        case SPELLFAMILY_ROGUE:
        {
            switch (spell->Id)
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index fa7d86d..e5c0d82 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -294,6 +294,7 @@ class MANGOS_DLL_SPEC Aura

        void SetAura(bool remove) { m_target->SetVisibleAura(m_auraSlot, remove ? 0 : GetId()); }
        void SendAuraUpdate(bool remove);
+        void SendFakeAuraUpdate(uint32 auraId, bool remove);

        uint8 GetStackAmount() {return m_stackAmount;}
        void SetStackAmount(uint8 num);
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 819db61..24baef9 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -6571,7 +6571,16 @@ void Spell::EffectSummonObject(SpellEffectIndex eff_idx)
    }
    // Summon in random point all other units if location present
    else
-        m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
+    {
+        if(m_spellInfo->Id == 48018)
+        {
+            x = m_caster->GetPositionX();
+            y = m_caster->GetPositionY();
+            z = m_caster->GetPositionZ();
+        }
+        else
+            m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE);
+    }

    Map *map = m_caster->GetMap();
    if(!pGameObj->Create(sObjectMgr.GenerateLowGuid(HIGHGUID_GAMEOBJECT), go_id, map,
-- 
1.7.0.2

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use