View Single Post
09-29-14, 06:05 AM   #20
Duugu
Premium Member
 
Duugu's Avatar
AddOn Author - Click to view addons
Join Date: Nov 2006
Posts: 851
Right now I'm iterating the full mounts list on SPELLS_CHANGED to build a list of mount names/spellIDs and passing that list to the secure environement:

Lua Code:
  1. for i = 1, 1000 do
  2.     ClearCursor()
  3.     local Mname, spellID = C_MountJournal.GetMountInfo(i)
  4.     C_MountJournal.Pickup(i)
  5.     local _, cnum = GetCursorInfo()
  6.     if cnum then
  7.         tSpellRepositoryString = tSpellRepositoryString..","..Mname.."-"..spellID
  8.     end
  9. end
  10. for i, v in pairs(BAB.DB.Bars) do
  11.     v.header:SetAttribute("SpellRepository", tSpellRepositoryString)
  12. end

Then I'm using the list to find a mounts spellID for use with type/spell on my action button:
Lua Code:
  1. local tSpellRepository = self:GetParent():GetAttribute('SpellRepository')
  2. if tSpellRepository then
  3.     for spell in string.gmatch(self:GetParent():GetAttribute('SpellRepository'), '([^%,]+)') do
  4.         local tn, ti = string.match(spell, '(.+)-(.+)')
  5.         if tn == buttonAction then
  6.             buttonAction = ti
  7.         end
  8.     end
  9. end

Clearly not the best approach.
But I'll definetly not touch this black hole again before WoD is in a final state. Who knows what they come up with next?

Last edited by Duugu : 09-29-14 at 06:23 AM.