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:
-- [...] Some code to go through each spell of each saved bar in the profile, and get its name and ID
-- spellCache = array containing all the class spells (spellCache[spellName] = spellID)
-- talentPvPCache = same for pvp talents
-- talentPvECache = same for pve talents
-- actionID = spellID
if (spellCache[spellName]) then
PickupSpellBookItem(spellCache[spellName], BOOKTYPE_SPELL);
elseif (talentPvPCache[spellName]) then
PickupPvpTalent(talentPvPCache[spellName])
elseif (talentPvECache[spellName]) then
self:Print(spellName)
-- PickupSpellBookItem(spellCache[spellName], BOOKTYPE_SPELL);
else
PickupSpell(actionID)
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:
-- actionID = bar slot where the spell is displayed
-- id = spellID
-- actionType = "spell"
local name, spellRank = GetSpellInfo(id)
if (name and spellRank) then
set[actionID] = string.format("%s|%d|%s|%s|%s|%d", actionType, id, "", name, spellRank or "", "")
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.