Jump to content

[fix] Runic Power dropping to 0 after skill use.


Guest yavi
 Share

Recommended Posts

Description of the bug?

When a DK uses one of his runepower spells (this doesn't happen with frost strike, dunno why) like Death Coil or Icebound fortitude Runic Power drops to 0 until the next gain.

For which repository revision was the patch created?

8465

Who has been writing this patch?

me

Fix

Research with a debugger showed that it's the client interpreting Runic Power wrong. Core has different RP than client, client thinks it's 0, so doesn't allow spell cast.

This is pretty much an ugly hack after some try-and-error in the subject. I don't know much about opcodes...

--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -2454,7 +2454,8 @@ void Spell::cast(bool skipCheck)
    // CAST SPELL
    SendSpellCooldown();

-    TakePower();
+    if(m_spellInfo->powerType != POWER_RUNIC_POWER) 
+       TakePower();
    TakeReagents();                                         // we must remove reagents before HandleEffects to allow place crafted item in same slot

    SendCastResult(castResult);
@@ -2479,6 +2480,9 @@ void Spell::cast(bool skipCheck)
        handle_immediate();
    }

+    if(m_spellInfo->powerType == POWER_RUNIC_POWER)
+        TakePower();
+
    SetExecutedCurrently(false);
}

@@ -3472,6 +3476,13 @@ void Spell::TakePower()

    Powers powerType = Powers(m_spellInfo->powerType);

+    //ugly hack for 0RP cost spells causing client!=server RP bug
+    if(m_spellInfo->powerType == POWER_RUNIC_POWER && m_powerCost==0)
+    {
+       m_caster->ModifyPower(powerType,1);
+       m_powerCost=1;
+    }
+
    if(powerType == POWER_RUNE)
    {
        TakeRunePower();

Ok... some explanation - moving TakePower() a few lines magically removes the RP dropping to 0 problem.

But... it makes client unable to show cooldowns on runes. The runes seem always active on client side. I have no idea on the effect of this change on other-energy-type users, so I if'ed it to change only Runic Power handling.

Still... 0 RP cost spells (talented Mind Freeze) caused the bug, hence the ugly hack with adding 1 power and making cost = 1 --- it made it work.

I know that 'fix' won't probably get accepted (at least with the hacky part), but still, it makes DK work A LOT better.

Link to comment
Share on other sites

You're doing it wrong, rune-using spells are sending rune state mask ( states of runes before and after cast ) so client will show correctly cooldown on them. This is quite logical and it keeps rune slot in sync.

IDK what is that RP bug about, because on TC there was never such problem.

Also bear in mind that few spells cost runic power, but also have Rune cost ( which is unused, but Mangos might still check for it, and Mind Freeze is nice example of such spell ), try to check out if spell has rune powertype before manipulating with runes.

EDIT: I see that you've figured that out in another topic...

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