Quantcast
WoWInterface - View Single Post - Pickup talent spells that are not learned
View Single Post
02-23-18, 11:33 PM   #1
Oren
A Defias Bandit
 
Oren's Avatar
Join Date: Feb 2018
Posts: 2
Pickup talent spells that are not learned

Hi everyone,

I've picked up an abandoned addon to try to update it for the last version of WoW and learn a bit of LUA development (I'm a web developer).

The addon is called ActionBarSaver, and it allows you to save spells positions in your bars (you can save profiles and restore them, they are saved by class). When I downloaded it, it worked for spells and objects (like 90% of what we need ^^), but not with mounts, pets, learned pve/pvp talents and unlearned pve/pvp talents.

For the first 3 I managed to make it work after finding the proper API methods, but I can't make the last one...
Basically, when you select a talent that gives you a spell, if you place it in your bars and learn another talent on the same line, the spell can't be used anymore but it stays in your bars (and I wanted to keep it, so that if you have to change your spec quickly the spell is already in your bars, no need to open your spellbook).

I can save the spellID, but when I want to restore it doesn't pickup the spell

Here is what I tried:

Lua Code:
  1. -- [...] Some code to go through each spell of each saved bar in the profile, and get its name and ID
  2.         -- spellCache = array containing all the class spells (spellCache[spellName] = spellID)
  3.         -- talentPvPCache = same for pvp talents
  4.         -- talentPvECache = same for pve talents
  5.         -- actionID = spellID
  6.  
  7.         if (spellCache[spellName]) then
  8.             PickupSpellBookItem(spellCache[spellName], BOOKTYPE_SPELL);
  9.         elseif (talentPvPCache[spellName]) then
  10.             PickupPvpTalent(talentPvPCache[spellName])
  11.         elseif (talentPvECache[spellName]) then
  12.             self:Print(spellName)
  13. --            PickupSpellBookItem(spellCache[spellName], BOOKTYPE_SPELL);
  14.         else
  15.             PickupSpell(actionID)
  16.         end

(at the moment I just print out the name, testing ^^)

To save a spell (when saving a profile), it gets the spellInfo and store it into a string that's later used to restore:

Lua Code:
  1. -- actionID = bar slot where the spell is displayed
  2. -- id = spellID
  3. -- actionType = "spell"
  4.  
  5. local name, spellRank = GetSpellInfo(id)
  6.  
  7. if (name and spellRank) then
  8.     set[actionID] = string.format("%s|%d|%s|%s|%s|%d", actionType, id, "", name, spellRank or "", "")
  9. end

What I do is first generate an array with all the spells names/IDs, and then go through my saved bar to get the spell, find it from my "cache", and pick it up to put it in the position it's supposed to be. But for unlearned talents, I tried "PickupSpell", "PickupSpellBookItem" (both with the spellID) and "PickupTalent" (tried with spellID and talentID) but nothing worked

Do you know if it's possible? And if so what am I doing wrong?
I looked through the "Pickup..." methods on WoW API on Gamepedia, but didn't find anything that could help.
  Reply With Quote