Quantcast
Did PickupSpell function change? - WoWInterface
Thread Tools Display Modes
10-22-10, 04:43 PM   #1
Brillynt
A Black Drake
 
Brillynt's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 77
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?
  Reply With Quote
10-22-10, 04:50 PM   #2
v6o
An Onyxian Warder
AddOn Author - Click to view addons
Join Date: Mar 2009
Posts: 399
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.
__________________
I stopped playing back World of Warcraft in 2010 and I have no plans on returning.
This is a dead account and if you want to continue any of my addons or make a fork then feel free to do so.
This is your permission slip.

If you need to contact me, do so on Twitter @v6ooo

Best regards, v6.

Last edited by v6o : 10-22-10 at 04:56 PM.
  Reply With Quote
10-23-10, 07:10 AM   #3
Brillynt
A Black Drake
 
Brillynt's Avatar
AddOn Author - Click to view addons
Join Date: Sep 2008
Posts: 77
Originally Posted by v6o View Post
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
  Reply With Quote
10-23-10, 07:57 AM   #4
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,494
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
__________________
  Reply With Quote
10-23-10, 09:15 AM   #5
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,494
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);
__________________
  Reply With Quote
10-23-10, 10:59 AM   #6
Xubera
A Cobalt Mageweaver
 
Xubera's Avatar
AddOn Author - Click to view addons
Join Date: May 2009
Posts: 207
if you find updated code, its nice to go to wowwiki and update the pages so other authors dont have to dig as deep
__________________
Chat Consolidate is the solution to any out of control trade chat. Ignore lines, throttle chat, consolidate posts!Follow the link to find out how!

▲ ▲ WoWInterface wont let me triforce >.>
  Reply With Quote
10-23-10, 01:58 PM   #7
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,494
Its the same code that everyone else has access to by downloading the files from the wow site.

I hate wiki pages. Tried using them before.
__________________
  Reply With Quote

WoWInterface » Developer Discussions » General Authoring Discussion » Did PickupSpell function change?

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off