azerothcore / mod-eluna-lua-engine

DEPRECATED

Home Page:https://www.azerothcore.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RemoveSpell(...) not working - PlayerMethods.h

Shard-MW opened this issue · comments

commented

Hello,
I've just noticed that RemoveSpell(...) function doesn't work on AzerothCore due to Player::removeSpell.

Here is the current code :

int RemoveSpell(lua_State* L, Player* player)
    {
        uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
        bool disabled = Eluna::CHECKVAL<bool>(L, 3, false);
        bool learn_low_rank = Eluna::CHECKVAL<bool>(L, 4, true);

#ifdef TRINITY
        player->RemoveSpell(entry, disabled, learn_low_rank);
#else
        player->removeSpell(entry, disabled, learn_low_rank);
#endif
        return 0;
    }

Here is my working fix :

int RemoveSpell(lua_State* L, Player* player)
    {
        uint32 entry = Eluna::CHECKVAL<uint32>(L, 2);
        bool disabled = Eluna::CHECKVAL<bool>(L, 3, false);
        bool learn_low_rank = Eluna::CHECKVAL<bool>(L, 4, true);

#ifdef TRINITY
        player->RemoveSpell(entry, disabled, learn_low_rank);
#else
        if(learn_low_rank)
            entry = sSpellMgr->GetFirstSpellInChain(entry);
        player->removeSpell(entry, SPEC_MASK_ALL, false);
#endif
        return 0;
    }

I don't really know what's "disable" from TC and why is AC using a specMask, so I hope you'll find a better solution if there is one :)