Problem with /removebuff

Fixxer

Active member
Joined
May 22, 2011
Messages
395
Reaction score
26
Points
28
When my necromancer casts Grave Pact, he gains 2 buffs. The first is titled "Grave Pact" and the second is called "Bloodbone Skeletal Form". If I try to remove the buff using /removebuff "Grave Pact", it removes the "Bloodbone Skeletal Form" buff, but not the "Grave Pact" buff. I get the feeling that this problem resides with the coding on the emulator servers. Is there a simple alternative to removing these buffs?
 

Chatwiththisname

Learning2Code
Joined
Sep 28, 2008
Messages
1,232
Reaction score
51
Points
48
Location
Texas
I experienced similar issues with legacy live.

I determined the issue was because the index of a buff in the array isn't the same as the index for the buff in the window. If you cast multiple spells, remove some between (or they fade) then cast more then the indexing becomes off.

I ended up writing a function for myself to use. The method I use reads the window to find what the index in the window is.

C++:
    for (int j = 0; j < NUM_LONG_BUFFS; j++) {
        char buffbutton[64] = { 0 };
        sprintf_s(buffbutton, "BW_Buff%i_Button", j);
        CButtonWnd* buff = (CButtonWnd*)pBuffWnd->GetChildItem(buffbutton);
        if (!buff) {
            continue;
        }

        char buffatindex[MAX_STRING] = { 0 };
        GetCXStr(buff->GetTooltip(), buffatindex, MAX_STRING);
        if (strstr(buffatindex, szLine)) {
            ((PcZoneClient*)pPCData)->RemoveBuffEffect(j, ((PSPAWNINFO)pLocalPlayer)->SpawnID);
            WriteChatf("%s\arRemoving: \ap%s\ax from Index: \ay%i", pluginmsg.c_str(), szLine, j);
            AutoRemoveBuffTimer = GetTickCount64() + 1000;
            return true;
        }
    }
as opposed to the built in
C++:
            for (unsigned long nBuff = 0; nBuff<NUM_LONG_BUFFS; nBuff++)
            {
                if (pChar2->Buff[nBuff].SpellID == 0 || pChar2->Buff[nBuff].SpellID == -1)
                    continue;
                if (PSPELL pBuffSpell = GetSpellByID(pChar2->Buff[nBuff].SpellID)) {
                    if (!_strnicmp(pBuffSpell->Name, szCmd, strlen(szCmd))) {
                        ((PcZoneClient*)pPCData)->RemoveBuffEffect(nBuff, ((PSPAWNINFO)pLocalPlayer)->SpawnID);
                        ClearCachedBuffs(((PSPAWNINFO)pLocalPlayer)->SpawnID);
                        return;
                    }
                }
            }
the jist of it is that pChar2->Buff[] array doesn't match the indexing used for RemoveBuffEffect function.
 
  • Wow
Reactions: EQDAB