@@ -31,6 +31,8 @@ LibDBIcon = LibStub("LibDBIcon-1.0")
3131
3232local SimcFrame = nil
3333local OptionsDB = nil
34+ local SpellCache = {}
35+ local SpellCacheLoaded = false
3436
3537local OFFSET_ITEM_ID = 1
3638local OFFSET_ENCHANT_ID = 2
@@ -516,6 +518,11 @@ local function GetItemStringFromItemLink(slotNum, itemLink, debugOutput)
516518 simcItemOptions [# simcItemOptions + 1 ] = ' crafting_quality=' .. craftingQuality
517519 end
518520
521+ -- 11.1.7 Belt
522+ if itemId == 242664 or itemId == 245964 or itemId == 245965 or itemId == 245966 then
523+ simcItemOptions [# simcItemOptions + 1 ] = ' titan_disc_id=' .. Simulationcraft :GetDiscBeltSpell ()
524+ end
525+
519526 local itemStr = ' '
520527 itemStr = itemStr .. (simcSlotNames [slotNum ] or ' unknown' ) .. " =" .. table.concat (simcItemOptions , ' ,' )
521528 if debugOutput then
@@ -671,6 +678,53 @@ function Simulationcraft:GetItemUpgradeAchievements()
671678 return table.concat (achieves , ' /' )
672679end
673680
681+ function LoadSpellsAsync (callback )
682+ local spellIds = Simulationcraft .preloadSpellIds
683+
684+ -- Build up the SpellCache asynchronously
685+ local numLoaded = 0
686+ function onLoad ()
687+ numLoaded = numLoaded + 1
688+
689+ if numLoaded == # spellIds then
690+ SpellCacheLoaded = true
691+ if callback then
692+ callback (SpellCache )
693+ end
694+ end
695+ end
696+
697+ for index = 1 , # spellIds do
698+ local spellId = spellIds [index ]
699+ local spell = Spell :CreateFromSpellID (spellId )
700+ if not spell :IsSpellEmpty () then
701+ spell :ContinueOnSpellLoad (function ()
702+ SpellCache [spellId ] = spell
703+ onLoad ()
704+ end )
705+ else
706+ onLoad ()
707+ end
708+ end
709+ end
710+
711+ -- This requires the SpellCache with the right spell IDs to be loaded
712+ function Simulationcraft :GetDiscBeltSpell ()
713+ local activeSpell = nil
714+ local beltDescription = SpellCache [Simulationcraft .discBeltSpell ]:GetSpellDescription ()
715+ if not beltDescription then
716+ error (' Unable to get spell description for DISC Belt spell' )
717+ end
718+ for k , v in pairs (Simulationcraft .discBeltEffectSpells ) do
719+ local effectDesc = SpellCache [k ]:GetSpellDescription ()
720+ if beltDescription :find (effectDesc ) then
721+ activeSpell = v
722+ end
723+ end
724+
725+ return activeSpell
726+ end
727+
674728function Simulationcraft :GetMainFrame (text )
675729 -- Frame code largely adapted from https://www.wowinterface.com/forums/showpost.php?p=323901&postcount=2
676730 if not SimcFrame then
@@ -909,8 +963,7 @@ function Simulationcraft:GetSimcProfile(debugOutput, noBags, showMerchant, links
909963 " # " .. playerName .. ' - ' .. playerSpec
910964 .. ' - ' .. date (' %Y-%m-%d %H:%M' ) .. ' - '
911965 .. playerRegion .. ' /' .. playerRealm
912- )
913-
966+ )
914967
915968 -- Construct SimC-compatible strings from the basic information
916969 local player = Tokenize (playerClass ) .. ' ="' .. playerName .. ' "'
@@ -1127,8 +1180,10 @@ end
11271180
11281181-- This is the workhorse function that constructs the profile
11291182function Simulationcraft :PrintSimcProfile (debugOutput , noBags , showMerchant , links )
1130- local simulationcraftProfile , simcPrintError = Simulationcraft :GetSimcProfile (debugOutput , noBags , showMerchant , links )
1183+ LoadSpellsAsync (function ()
1184+ simulationcraftProfile , simcPrintError = Simulationcraft :GetSimcProfile (debugOutput , noBags , showMerchant , links )
11311185
1132- local f = Simulationcraft :GetMainFrame (simcPrintError or simulationcraftProfile )
1133- f :Show ()
1186+ local f = Simulationcraft :GetMainFrame (simcPrintError or simulationcraftProfile )
1187+ f :Show ()
1188+ end )
11341189end
0 commit comments