Jump to content

Dancing Rune Weapon


Guest laise
 Share

Recommended Posts

I've tried to implement the part where rune blade repeats any of it's owner's attacks, autoattacks work fine except the part that there is no way to know if DK made an attack with offhand weapon or mainhand..and the spell repeating part has another problem - melee based spells' damage is calculated in EffectWeaponDmg..i can add hacks there only for rune blade but it can cast other spells and I think some of their damage is also calculated in spellEffects..so...here's the code - http://pastebin.com/f63c56cbc everyone is welcome to help

-- (49028) Dancing Rune Weapon ()
DELETE FROM `spell_proc_event` WHERE `entry` IN (49028);
INSERT INTO `spell_proc_event` VALUES
(49028, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00010004, 0x00000000, 0.000000, 0.000000, 0);

Link to comment
Share on other sites

49028 do not proc from autoattacks, I'm wondering where did you get information that it should proc from them?

some forum related to retail..and this spell, it was described there that the weapon does it attacks when player attacks and also has its own autoattack..btw also saw somewhere that buffs are copied from player to weapon but idk if it is true..

Link to comment
Share on other sites

some forum related to retail..and this spell, it was described there that the weapon does it attacks when player attacks and also has its own autoattack..btw also saw somewhere that buffs are copied from player to weapon but idk if it is true..

http://www.wowhead.com/?spell=49028

somewhat down the page you will find this text:

True, the weapon gets any buffs you activate on yourself (trinkets) or already have on yourself. (Such as Bloody Vengence). A great spell overall.

as just above that line

They really do mean it does the same attacks as the death knight. If you summon a ghoul while this is active, the weapon will actually also summon its own ghoul that will last until the weapon itself disappears.

I'm not positive, but I also believe that if you cast Hysteria on yourself, the weapon gets that as well.

apparently its supposed to cast its own Raise Dead spell IF the dk who summoned it casts the Raise Dead spell while DRW is active. Also any spells (Raise Dead, Army of the Dead, etc) that the DRW uses are dismissed after the DRW disapears

Link to comment
Share on other sites

SpelllAuras.cpp

@@ -6552,6 +6552,10 @@ void Aura::PeriodicTick()
                pdamage = pCaster->SpellDamageBonus(m_target, GetSpellProto(), pdamage, DOT, GetStackAmount());

+                  // Death Knight Diseases AP Bonus
+                 if (GetSpellProto()->Id == 55095 || GetSpellProto()->Id == 60950)
+                     pdamage+=pCaster->GetTotalAttackPowerValue(BASE_ATTACK)*0.055;
+
// Curse of Agony damage-per-tick calculation
if (GetSpellProto()->SpellFamilyName==SPELLFAMILY_WARLOCK && (GetSpellProto()->SpellFamilyFlags & UI64LIT(0x0000000000000400)) && GetSpellProto()->SpellIconID==544)
                {

Link to comment
Share on other sites

http://www.wowhead.com/?spell=49028

apparently its supposed to cast its own Raise Dead spell IF the dk who summoned it casts the Raise Dead spell while DRW is active. Also any spells (Raise Dead, Army of the Dead, etc) that the DRW uses are dismissed after the DRW disapears

Raise Dead/Army of the Dead can't be cast after 3.2 by rune blade according to wow wiki

Link to comment
Share on other sites

  • 2 weeks later...

Just add owner's weapon as virtual item for that npc, however choosing displayID might be tricky, and it has to be unattackable and so...

EDIT:, pretty much the most of the script you need, and whoa, MaNGOS has only dummy script library so it does not belong in here

    void Reset()
   {
       Unit * owner = m_creature->GetOwner();
       if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
           return;

       // Cannot be Selected or Attacked
       m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
       m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);

       // Add visible weapon
       if (Item const * item = ((Player *)owner)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
           m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, item->GetProto()->ItemId);

       // Add stats scaling
       int32 damageDone=owner->CalculateDamage(BASE_ATTACK, false, true); // might be average damage instead ?
       int32 meleeSpeed=owner->m_modAttackSpeedPct[bASE_ATTACK];
       m_creature->CastCustomSpell(m_creature, 51906, &damageDone, &meleeSpeed, NULL, true);

       // Visual Glow
       m_creature->CastSpell(m_creature, 53160, true);

       // Start Chasing victim
       if (uint64 guid = ((Player*)owner)->GetSelection())
           if (Unit *target = m_creature->GetUnit(*owner,guid))
               if (!target->IsFriendlyTo(owner) && m_creature->canAttack(target,true))
                   m_creature->Attack(target,true);
   }

Link to comment
Share on other sites

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index f31c738..be64e7d 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
-6380,7 +6380,40 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
                    return false;
                // TODO: wite script for this "fights on its own, doing the same attacks"
                // NOTE: Trigger here on every attack and spell cast
-                return false;
+                Pet* runeBlade = FindGuardianWithEntry(27893);
+                if (!runeBlade)
+                    return false;
+                else
+                {
+
[b]+        // Cannot be Selected or Attacked
+        runeBlade->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+        runeBlade->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+
+        // Add visible weapon
+        if (Item const * item = ((Player *)owner)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
+        runeBlade->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, item->GetProto()->ItemId);
+
+        // Add stats scaling
+        int32 damageDone=owner->CalculateDamage(BASE_ATTACK, false, true);
+        int32 meleeSpeed=owner->m_modAttackSpeedPct[bASE_ATTACK];
+        runeBlade->CastCustomSpell(runeBlade, 51906, &damageDone, &meleeSpeed, NULL, true);
+
+        // Visual Glow
+        runeBlade->CastSpell(m_creature, 53160, true);[/b]
+
+                    if(!procSpell) // triggered from auto-attack
+                    {
+                        // copy paste from attacker state update...
+                        pVictim = SelectMagnetTarget(pVictim);
+
+                        CalcDamageInfo damageInfo;
+                        CalculateMeleeDamage(pVictim, 0, &damageInfo, BASE_ATTACK);
+                        damageInfo.attacker = runeBlade;
+                        damageInfo.damage = damageInfo.damage / 2;
+                        // Send log damage message to client
+                        runeBlade->DealDamageMods(pVictim,damageInfo.damage,&damageInfo.absorb);
+                        runeBlade->SendAttackStateUpdate(&damageInfo);
+                        runeBlade->ProcDamageAndSpell(damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, damageInfo.damage, damageInfo.attackType);
+                        runeBlade->DealMeleeDamage(&damageInfo,true);
+
+                        // if damage pVictim call AI reaction
+                        if(pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->AI())
+                            ((Creature*)pVictim)->AI()->AttackedBy(runeBlade); 
+                    }
+                    else           // only melee based spells?
+                    {
+                        // is it really half???
+                        basepoints0 = procSpell->EffectBasePoints[0] / 2;
+                        int32 basepoints1 = procSpell->EffectBasePoints[1] / 2;
+                        int32 basepoints2 = procSpell->EffectBasePoints[2] / 2;
+                        runeBlade->CastCustomSpell(pVictim,procSpell,&basepoints0,&basepoints1,&basepoints2,true,castItem,triggeredByAura);
+                    }
+                    return true;
+                }
            }
            // Mark of Blood
            if (dummySpell->Id == 49005)

Experts, check up please, the allocated site of a code is truly inserted into the basic patch?

Link to comment
Share on other sites

diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index f31c738..be64e7d 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
-6380,7 +6380,40 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
                    return false;
                // TODO: wite script for this "fights on its own, doing the same attacks"
                // NOTE: Trigger here on every attack and spell cast
-                return false;
+                Pet* runeBlade = FindGuardianWithEntry(27893);
+                if (!runeBlade)
+                    return false;
+                else
+                {
+
[b]+        // Cannot be Selected or Attacked
+        runeBlade->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+        runeBlade->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+
+        // Add visible weapon
+        if (Item const * item = ((Player *)owner)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
+        runeBlade->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, item->GetProto()->ItemId);
+
+        // Add stats scaling
+        int32 damageDone=owner->CalculateDamage(BASE_ATTACK, false, true);
+        int32 meleeSpeed=owner->m_modAttackSpeedPct[bASE_ATTACK];
+        runeBlade->CastCustomSpell(runeBlade, 51906, &damageDone, &meleeSpeed, NULL, true);
+
+        // Visual Glow
+        runeBlade->CastSpell(m_creature, 53160, true);[/b]
+
+                    if(!procSpell) // triggered from auto-attack
+                    {
+                        // copy paste from attacker state update...
+                        pVictim = SelectMagnetTarget(pVictim);
+
+                        CalcDamageInfo damageInfo;
+                        CalculateMeleeDamage(pVictim, 0, &damageInfo, BASE_ATTACK);
+                        damageInfo.attacker = runeBlade;
+                        damageInfo.damage = damageInfo.damage / 2;
+                        // Send log damage message to client
+                        runeBlade->DealDamageMods(pVictim,damageInfo.damage,&damageInfo.absorb);
+                        runeBlade->SendAttackStateUpdate(&damageInfo);
+                        runeBlade->ProcDamageAndSpell(damageInfo.target, damageInfo.procAttacker, damageInfo.procVictim, damageInfo.procEx, damageInfo.damage, damageInfo.attackType);
+                        runeBlade->DealMeleeDamage(&damageInfo,true);
+
+                        // if damage pVictim call AI reaction
+                        if(pVictim->GetTypeId()==TYPEID_UNIT && ((Creature*)pVictim)->AI())
+                            ((Creature*)pVictim)->AI()->AttackedBy(runeBlade); 
+                    }
+                    else           // only melee based spells?
+                    {
+                        // is it really half???
+                        basepoints0 = procSpell->EffectBasePoints[0] / 2;
+                        int32 basepoints1 = procSpell->EffectBasePoints[1] / 2;
+                        int32 basepoints2 = procSpell->EffectBasePoints[2] / 2;
+                        runeBlade->CastCustomSpell(pVictim,procSpell,&basepoints0,&basepoints1,&basepoints2,true,castItem,triggeredByAura);
+                    }
+                    return true;
+                }
            }
            // Mark of Blood
            if (dummySpell->Id == 49005)

Experts, check up please, the allocated site of a code is truly inserted into the basic patch?

should be only on weapon summon not on every spell proc

Link to comment
Share on other sites

+                        int32 basepoints1 = procSpell->EffectBasePoints[1] / 2;
+                        int32 basepoints2 = procSpell->EffectBasePoints[2] / 2;
+                        runeBlade->CastCustomSpell(pVictim,procSpell,&basepoints0,&basepoints1,&basepoints2,true,castItem,triggeredByAura);
+                    }
+    void Reset()
+    {
+        Unit * owner = m_creature->GetOwner();
+        if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
+            return;
+
+        // Cannot be Selected or Attacked
+        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+
+        // Add visible weapon
+        if (Item const * item = ((Player *)owner)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
+            m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, item->GetProto()->ItemId);
+
+        // Visual Glow
+        m_creature->CastSpell(m_creature, 53160, true);
+   }
+                    return true;
+                }
            }
            // Mark of Blood

And here will truly add?

Link to comment
Share on other sites

updated version:

mangos part:

diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h
index 7f58b26..e9c0369 100644
--- a/src/game/SharedDefines.h
+++ b/src/game/SharedDefines.h
@@ -2457,6 +2457,7 @@ enum SummonType
    SUMMON_TYPE_TOTEM       = 121,
    SUMMON_TYPE_UNKNOWN3    = 181,
    SUMMON_TYPE_UNKNOWN4    = 187,
+    SUMMON_TYPE_RUNE_BLADE  = 208,
    SUMMON_TYPE_UNKNOWN1    = 247,
    SUMMON_TYPE_CRITTER2    = 407,
    SUMMON_TYPE_CRITTER3    = 307,
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 74dd44f..c2102ec 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -3379,6 +3379,7 @@ void Spell::EffectSummonType(uint32 i)
        case SUMMON_TYPE_POSESSED2:
        case SUMMON_TYPE_FORCE_OF_NATURE:
        case SUMMON_TYPE_GUARDIAN2:
+        case SUMMON_TYPE_RUNE_BLADE:
        case SUMMON_TYPE_GUARDIAN3:
            // Jewelery statue case (totem like)
            if(m_spellInfo->SpellIconID == 2056)
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 36f0cc6..a1b92f8 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -6487,7 +6487,16 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
                    return false;
                // TODO: wite script for this "fights on its own, doing the same attacks"
                // NOTE: Trigger here on every attack and spell cast
-                return false;
+                Pet* runeBlade = FindGuardianWithEntry(27893);
+                if (!runeBlade)
+                   return false;
+                else
+                {
+                    // only melee based spells?
+                    if(procSpell)
+                        runeBlade->CastSpell(pVictim,procSpell,true,castItem,triggeredByAura);
+                    return true;
+                }
            }
            // Mark of Blood
            if (dummySpell->Id == 49005)

mangos sql:

DELETE FROM `spell_proc_event` WHERE `entry` IN (49028);
INSERT INTO `spell_proc_event` VALUES
(49028, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00010010, 0x00010000, 0.000000, 0.000000, 0);

SD2 part:

Index: scripts/world/npcs_special.cpp
===================================================================
--- scripts/world/npcs_special.cpp    (revision 1493)
+++ scripts/world/npcs_special.cpp    (working copy)
@@ -1451,6 +1451,43 @@
    return true;
}

+struct MANGOS_DLL_DECL npc_rune_blade : public ScriptedAI
+{
+    npc_rune_blade(Creature* pCreature) : ScriptedAI(pCreature) {Reset();}
+    void Reset()
+    {
+        Unit * owner = m_creature->GetOwner();
+        if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
+            return;
+
+        // Cannot be Selected or Attacked
+        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+        m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+
+        // Add visible weapon
+        if (Item const * item = ((Player *)owner)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
+            m_creature->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, item->GetProto()->ItemId);
+
+        // Add stats scaling
+        int32 damageDone=owner->CalculateDamage(BASE_ATTACK, true); // might be average damage instead ?
+        int32 meleeSpeed=owner->m_modAttackSpeedPct[bASE_ATTACK];
+        m_creature->CastCustomSpell(m_creature, 51906, &damageDone, &meleeSpeed, NULL, true);
+
+        // Visual Glow
+        m_creature->CastSpell(m_creature, 53160, true);
+
+        // Start Chasing victim
+        if (uint64 guid = ((Player*)owner)->GetSelection())
+            if (Unit *target = m_creature->GetUnit(*owner,guid))
+                if (!target->IsFriendlyTo(owner))
+                    m_creature->Attack(target,true);
+
+    }
+};
+CreatureAI* GetAI_npc_rune_blade(Creature* pCreature)
+{
+    return new npc_rune_blade(pCreature);
+}
void AddSC_npcs_special()
{
    Script *newscript;
@@ -1528,4 +1565,9 @@
    newscript->pGossipHello = &GossipHello_npc_sayge;
    newscript->pGossipSelect = &GossipSelect_npc_sayge;
    newscript->RegisterSelf();
+
+    newscript = new Script;
+    newscript->Name = "npc_runeblade";
+    newscript->GetAI = &GetAI_npc_rune_blade;
+    newscript->RegisterSelf();
}

SD2 sql:

update creature_template set ScriptName='npc_runeblade' where entry=27893;

Link to comment
Share on other sites

 Share

×
×
  • 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