WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   Did PickupSpell function change? (https://www.wowinterface.com/forums/showthread.php?t=36141)

Brillynt 10-22-10 04:43 PM

Did PickupSpell function change?
 
I have a addon the places all of my spells in my action buttons and now it is not working. I can see the correct spell id that I am passing to PickupSpell.
If I do the following code :
Code:

ClearCursor();
PickupSpell(iSpellID, BOOKTYPE_SPELL);
local stype, data, subType = GetCursorInfo();

stype, data, subType all come back as nil.

So my question is did the inputs to PickupSpell function change?

v6o 10-22-10 04:50 PM

I can't get PickupSpell to work at all.

Edit: After testing it some more I can get it to work with spell IDs but not spellbook id or spell name.

Brillynt 10-23-10 07:10 AM

Quote:

Originally Posted by v6o (Post 213404)
I can't get PickupSpell to work at all.

Edit: After testing it some more I can get it to work with spell IDs but not spellbook id or spell name.


Yep it works with the global spell id but not the spell id index from the spell book or the spell name.

Brillynt

Xrystal 10-23-10 07:57 AM

Spotted this with a general search for PickupSpell. It's in the SpellBookFrame.lua file from the new API files you can download from the wow site.

PickupSpellBookItem(slot, SpellBookFrame.bookType);

Here is the whole function in its entirety.

Code:

function SpellButton_OnModifiedClick(self, button)
        local slot = SpellBook_GetSpellBookSlot(self);
        if ( slot > MAX_SPELLS ) then
                return;
        end
        if ( IsModifiedClick("CHATLINK") ) then
                if ( MacroFrame and MacroFrame:IsShown() ) then
                        local spellName, subSpellName = GetSpellBookItemName(slot, SpellBookFrame.bookType);
                        if ( spellName and not IsPassiveSpell(slot, SpellBookFrame.bookType) ) then
                                if ( subSpellName and (strlen(subSpellName) > 0) ) then
                                        ChatEdit_InsertLink(spellName.."("..subSpellName..")");
                                else
                                        ChatEdit_InsertLink(spellName);
                                end
                        end
                        return;
                else
                        local spellLink, tradeSkillLink = GetSpellLink(slot, SpellBookFrame.bookType);
                        if ( tradeSkillLink ) then
                                ChatEdit_InsertLink(tradeSkillLink);
                        elseif ( spellLink ) then
                                ChatEdit_InsertLink(spellLink);
                        end
                        return;
                end
        end
        if ( IsModifiedClick("PICKUPACTION") ) then
                PickupSpellBookItem(slot, SpellBookFrame.bookType);
                return;
        end
        if ( IsModifiedClick("SELFCAST") ) then
                CastSpell(slot, SpellBookFrame.bookType, true);
                SpellButton_UpdateSelection(self);
                return;
        end
end


Xrystal 10-23-10 09:15 AM

Oh another set of functions in that file that might shed some useful information for you.

Code:

function SpellButton_OnDrag(self)
        local slot, slotType = SpellBook_GetSpellBookSlot(self);
        if (not slot or slot > MAX_SPELLS or not _G[self:GetName().."IconTexture"]:IsShown() or (slotType == "FUTURESPELL")) then
                return;
        end
        self:SetChecked(0);
        PickupSpellBookItem(slot, SpellBookFrame.bookType);
end

And some other functions that may have changed:

local temp, texture, offset, numSlots = GetSpellTabInfo(SpellBookFrame.selectedSkillLine);

Xubera 10-23-10 10:59 AM

if you find updated code, its nice to go to wowwiki and update the pages so other authors dont have to dig as deep :)

Xrystal 10-23-10 01:58 PM

Its the same code that everyone else has access to by downloading the files from the wow site. :D

I hate wiki pages. Tried using them before.


All times are GMT -6. The time now is 06:21 AM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI