Skip to content

Commit 50f108d

Browse files
committed
Initial support for 11.1.7 D.I.S.C. belt
1 parent 5308cea commit 50f108d

File tree

3 files changed

+92
-7
lines changed

3 files changed

+92
-7
lines changed

Simulationcraft.toc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
## Interface: 110100, 110105
1+
## Interface: 110105, 110107
22
## Title: Simulationcraft
33
## IconTexture: Interface\Addons\SimulationCraft\logo
44
## Notes: Constructs SimC export strings
55
## Author: Theck, navv_, seriallos
6-
## Version: 11.1.5-01
6+
## Version: 11.1.7-alpha01
77
## OptionalDependencies: Ace3, LibRealmInfo, LibDBIcon, LibDataBroker-1.1
88
## SavedVariables: SimulationCraftDB
99

core.lua

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ LibDBIcon = LibStub("LibDBIcon-1.0")
3131

3232
local SimcFrame = nil
3333
local OptionsDB = nil
34+
local SpellCache = {}
35+
local SpellCacheLoaded = false
3436

3537
local OFFSET_ITEM_ID = 1
3638
local 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, '/')
672679
end
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+
674728
function 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
11291182
function 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)
11341189
end

extras.lua

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,36 @@ Simulationcraft.upgradeAchievements = {
310310
40945, -- Gilded
311311
}
312312

313+
-- 11.1.7 Belt spells
314+
315+
Simulationcraft.discBeltSpell = 1233515
316+
Simulationcraft.discBeltEffectSpells = {
317+
[1241240] = 1236279,
318+
[1241241] = 1236278,
319+
[1241242] = 1236277,
320+
[1241243] = 1236961,
321+
[1241244] = 1236109,
322+
[1241245] = 1236122,
323+
[1241246] = 1236272,
324+
[1241250] = 1236275,
325+
[1241251] = 1236273,
326+
}
327+
328+
-- Spells to load by LoadSpellsAsync and to store in SpellCache
329+
Simulationcraft.preloadSpellIds = {
330+
-- 11.1.7 DISC Belt Spells
331+
1233515,
332+
1241240,
333+
1241241,
334+
1241242,
335+
1241243,
336+
1241244,
337+
1241245,
338+
1241246,
339+
1241250,
340+
1241251,
341+
}
342+
313343
-- Catalyst currency
314344

315345
Simulationcraft.catalystCurrencies = {

0 commit comments

Comments
 (0)