View Single Post
05-19-18, 04:54 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,929
Identified Problem ..

Finally figured out the problem is due to the data table not being generated properly. I must be creating it at the wrong time in Beta and not doing it at all in Live. Manually setting the spell ID on the XML allowed the button click to cast the spell but no icon appearing ( likely due to the problem identified ). So back to tracing the execution route to make sure the right values are set at the right time rofl. Considering setting a full table at the start rather than smaller tables when requested.

Lua Code:
  1. function addonData:GenerateSpellsPerMap()
  2.     local factionGroup, factionName = UnitFactionGroup("player")
  3.     local portalIdx = 1
  4.     local teleportIdx = 1
  5.    
  6.     self.MapSpells = {}
  7.     DEFAULT_CHAT_FRAME:AddMessage("GenerateSpellsPerMap 1")  
  8.     for i,v in pairs(self.Spells) do
  9.         local mapInfo = C_Map.GetMapInfo(v.map)
  10.  
  11.         self.MapSpells[v.map] = self.MapSpells[v.map] or {}
  12.  
  13.         local spell = Spell:CreateFromSpellID(i)
  14.  
  15.         DEFAULT_CHAT_FRAME:AddMessage("GenerateSpellsPerMap 2 : " .. i)
  16.  
  17.         spell:ContinueOnSpellLoad(function()
  18.             local spellName = GetSpellInfo(i)
  19.             local id,fileID = GetSpellTexture(i)
  20.             local idx = v.isPortal and portalIdx or teleportIdx
  21.             if v.faction == factionName or "Neutral" then
  22.                 DEFAULT_CHAT_FRAME:AddMessage("Generating data for " .. i .. " : " .. spellName .. " : " .. fileID)  -- Contains values
  23.  
  24.                 addonData.MapSpells[v.map].Spells = addonData.MapSpells[v.map].Spells or {}
  25.                 addonData.MapSpells[v.map].Spells[i] = addonData.MapSpells[v.map].Spells[i] or {}
  26.                 addonData.MapSpells[v.map].Spells[i].isPortal = v.isPortal
  27.                 addonData.MapSpells[v.map].Spells[i].name = spellName
  28.                 addonData.MapSpells[v.map].Spells[i].icon = fileID
  29.                 addonData.MapSpells[v.map].Spells[i].buttonIdx = idx
  30.  
  31.                 if v.isPortal then
  32.                     portalIdx = portalIdx + 1
  33.                 else
  34.                     teleportIdx = teleportIdx + 1
  35.                 end
  36.                 DEFAULT_CHAT_FRAME:AddMessage("GenerateSpellsPerMap 3 : " .. addonData.MapSpells[v.map].Spells[i].name)  -- Contains value
  37.             end
  38.         end)
  39.        
  40.     end
  41.    
  42.     DEFAULT_CHAT_FRAME:AddMessage("GenerateSpellsPerMap 4 : " .. #addonData.MapSpells[addonData.activePage].Spells)  -- attempt to index field error
  43. end

Based on this latest debugging session it appears the new callback feature to ensure spell data is available also resets the data it sets when you leave, even on an addon wide data table. It is starting to look like I will have to use this function for every spell button that I want to set the spell data to. Hard coding the button attribute setting code to a specific value works ( without icon at the moment ) but trying to access the data value it has a hiccough ... more research, but getting closer.
__________________


Characters:
Gwynedda - 70 - Demon Warlock
Galaviel - 65 - Resto Druid
Gamaliel - 61 - Disc Priest
Gwynytha - 60 - Survival Hunter
Lienae - 60 - Resto Shaman
Plus several others below level 60

Info Panel IDs : http://www.wowinterface.com/forums/s...818#post136818

Last edited by Xrystal : 05-19-18 at 05:55 PM.
  Reply With Quote