Quantcast
WoWInterface - View Single Post - Pickup talent spells that are not learned
View Single Post
02-24-18, 06:16 AM   #2
Banknorris
A Chromatic Dragonspawn
 
Banknorris's Avatar
AddOn Author - Click to view addons
Join Date: Oct 2014
Posts: 153
I have a personal addon that saves bars and also replace macro tabs (general become char macros and char macros become general macros) my solution for this problem is sketched bellow:
Lua Code:
  1. --macros whose names are in the format PHxx where xx is between 00 and 99 are reserved for place holder macros
  2.  
  3. local ph_number = 0 --number of current place holder macros
  4. local ph_list = {} --list of place holder macros; k: spell id; v:macro name
  5. local Create_Place_Holder_Macro
  6.  
  7. --put this in the load loop of saved action bars, when you have a spell to this:
  8. --in my version of action bar saver there is no cache, so the code will need some adaptation on this regard
  9. PickupSpell(spell_id)
  10. if GetCursorInfo()==nil then
  11.     if ph_list[spell_id]==nil then
  12.         ph_number = ph_number+1
  13.         ph_list[spell_id] = Create_Place_Holder_Macro(spell_id,ph_number)
  14.     end
  15.     PickupMacro(ph_list[spell_id])
  16. end
  17.  
  18. --put this in the save loop of current action bars, when you have a macro to this to check if you have a place holder macro to save the spell:
  19. if macro_name:match("^PH%d%d$") then
  20.     for k,v in pairs(ph_list) do
  21.         if v==macro_name then
  22.             local actionType = "spell"
  23.             local id = k
  24.             local name, spellRank = GetSpellInfo(id)
  25.             set[actionID] = string.format("%s|%d|%s|%s|%s|%d", actionType, id, "", name, spellRank or "", "")
  26.             break
  27.         end
  28.     end
  29. end
  30.  
  31. function Create_Place_Holder_Macro(spell_id,ph_number)
  32.     local am = GetNumMacros()
  33.     local macro_name = "PH"..string_format("%02d",ph_number)
  34.     local spell_name,_,texture = GetSpellInfo(spell_id)
  35.     if texture then
  36.         if am<MAX_ACCOUNT_MACROS then
  37.             CreateMacro(macro_name,texture,"#showtooltip\n/cast "..spell_name)
  38.             return macro_name
  39.         end
  40.     end
  41. end
  42.  
  43. --you need a way to detect that specialization has changed and when it happens you should delete all place holder macros
  44. local function call_me_when_spec_changes()
  45.     if ph_number>0 then
  46.         for i=1,ph_number do
  47.             local macro_name = "PH"..string_format("%02d",i)
  48.             DeleteMacro(macro_name)
  49.         end
  50.         wipe(ph_list)
  51.         ph_number = 0
  52.     end
  53. end
The basic idea is to put a macro with /cast spell when the spell can't be picked up.
__________________
"In this world nothing can be said to be certain, except that fractional reserve banking is a Ponzi scheme and that you won't believe it." - Mandrill

Last edited by Banknorris : 02-24-18 at 02:45 PM.
  Reply With Quote