Thread Tools Display Modes
06-25-18, 10:55 AM   #1
Taet
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 17
help with ContinueOnSpellLoad

I using GetSpellDescription in legion without any problems, now blizzard change this function and must by called with ContinueOnSpellLoad, but dont work any help me.

me previous (legion) code:
Lua Code:
  1. spell_desc = {
  2.                 type = 'description',
  3.                 fontSize = 'medium',
  4.                 order = 3.3,
  5.                 name = function(info)
  6.                         return GetSpellDescription(spellID)
  7.                 end,
  8.             },

me BFA code (dont work, no bugs report only dont show any):
Lua Code:
  1. spell_desc = {
  2.                 type = 'description',
  3.                 fontSize = 'medium',
  4.                 order = 3.3,
  5.                 name = function(info)
  6.                     local spell = Spell:CreateFromSpellID(spellID);
  7.                     spell:ContinueOnSpellLoad(function()
  8.                     return GetSpellDescription(spell:GetSpellID())
  9.                     end);
  10.                 end,
  11.             },
  Reply With Quote
06-25-18, 02:46 PM   #2
Xrystal
nUI Maintainer
 
Xrystal's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Feb 2006
Posts: 5,877
This is what I ended up doing for my Mage Portal addon. It might not work for your use but thought I would put it out there to see if it works for you. I recall trying the one you did and it seemed to be intermittent in its use so tried this route and so far it hasn't failed me once I cached the results.


OnEvent Script function contents
Lua Code:
  1. if event == "PLAYER_ENTERING_WORLD" then
  2.         for i,v in pairs(addonData.Spells) do
  3.             C_Spell.RequestLoadSpellData(i)
  4.         end        
  5.     elseif event == "SPELL_DATA_LOAD_RESULT" then
  6.         local spellID,success = ...
  7.         if success and addonData.Spells[spellID] then
  8.             CacheSpellData(spellID)
  9.         end
  10.     end

In my case I have a preset list of spellID's I am interested in so I grab and store when the addon first loads but you can call that RequestLoadSpellData(spellID) function at any point and then watch for it and act according with the other event.

CacheSpellData is a function that stores the data i need to keep for the duration of the addon as for some reason it seems to disappear after a while. I guess the if you snooze you lose scenario.

Lua Code:
  1. local function CacheSpellData(spellID)
  2.     addonData.SpellCache = {}
  3.     addonData.SpellCache[spellID] = {}
  4.    
  5.     local id,fileID = GetSpellTexture(spellID)
  6.     local name = GetSpellInfo(spellID)
  7.     local isKnown = IsSpellKnown(spellID)
  8.    
  9.     addonData.SpellCache[spellID].TextureID = fileID    
  10.     addonData.SpellCache[spellID].Name = name
  11.     addonData.SpellCache[spellID].isKnown = isKnown
  12.    
  13. end
__________________
  Reply With Quote
06-27-18, 11:33 AM   #3
Taet
A Deviate Faerie Dragon
Join Date: Jan 2010
Posts: 17
ty, i try this, when i select dungeon, i directly call GetSpellDescription for all spellID in database:
Lua Code:
  1. set = function(info, value)
  2.                     selectedDungeon = value;
  3.                     local mapID = selectedDungeon and match(selectedDungeon, "(%d+)")
  4.                     if mapID then mapID = tonumber(mapID) end
  5.                     for i,v in pairs(L.MythicSpellData[mapID]) do
  6.                         GetSpellDescription(i)
  7.                     end  
  8.                     L.UpdateSpellDatabase()
  9.                 end,

and in another code i take 100% correct answer when call GetSpellDescription(spelID), dont need ContinueOnSpellLoad.


sry for eng.
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » AddOn Help/Support » help with ContinueOnSpellLoad

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off