Jump to content

[BUG+FIX] Auto select spell rank for low-level targets


Guest kyle1

Recommended Posts

Mangos Version: MaNGOS/0.17.0 Revision 10592

Custom Patches: Playerbot

SD2 Version: Revision [1838]

Database Name and Version : YTDB 0.13.9 R567

How it SHOULD work:

Some spells like buffs require target to be certain minimum level. Mangos checks this with SpellMgr::SelectAuraRankForLevel() which has code to select appropriate spell rank for target.

How it DOES work:

With standard client it works fine since client selects appropriate spell rank itself before sending cast packet to server.

Mangos never finds lower rank if target's level is too low for given spell. I found it while working on Playerbot mod. Fix is simple. Looks more like typo:

diff --git a/src/game/SpellMgr.cpp b/src/game/SpellMgr.cpp
index 970fe5b..b6582b6 100644
--- a/src/game/SpellMgr.cpp
+++ b/src/game/SpellMgr.cpp
@@ -2300,7 +2300,7 @@ SpellEntry const* SpellMgr::SelectAuraRankForLevel(SpellEntry const* spellInfo,
            break;

        // if found appropriate level
-        if (level + 10 >= spellInfo->spellLevel)
+        if (level + 10 >= nextSpellInfo->spellLevel)
            return nextSpellInfo;

        // one rank less then

Since Playerbot has some client functionality it needs this code to work. It would be nice if this would be fixed in the core to avoid same code called twice.

Link to comment
Share on other sites

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