Skip to content

Commit 4544b72

Browse files
committed
Extra debug output to figure out Titan belt issue
1 parent 47cd9b6 commit 4544b72

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

Simulationcraft.toc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## IconTexture: Interface\Addons\SimulationCraft\logo
44
## Notes: Constructs SimC export strings
55
## Author: Theck, navv_, seriallos
6-
## Version: 11.2.0-alpha02
6+
## Version: 11.2.0-alpha03
77
## OptionalDependencies: Ace3, LibRealmInfo, LibDBIcon, LibDataBroker-1.1
88
## SavedVariables: SimulationCraftDB
99

core.lua

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,14 @@ local function GetItemSplit(itemLink)
189189
return itemSplit
190190
end
191191

192+
local function Trim(str)
193+
return string.match(str, '^%s*(.-)%s*$')
194+
end
195+
192196
local function GetItemName(itemLink)
193197
local name = string.match(itemLink, '|h%[(.*)%]|')
194198
local removeIcons = gsub(name, '|%a.+|%a', '')
195-
local trimmed = string.match(removeIcons, '^%s*(.*)%s*$')
199+
local trimmed = Trim(removeIcons)
196200
-- check for empty string or only spaces
197201
if string.match(trimmed, '^%s*$') then
198202
return nil
@@ -432,6 +436,7 @@ local function GetItemStringFromItemLink(slotNum, itemLink, debugOutput)
432436
local simcItemOptions = {}
433437
local gems = {}
434438
local gemBonuses = {}
439+
local debugLines = {}
435440

436441
-- Item id
437442
local itemId = itemSplit[OFFSET_ITEM_ID]
@@ -520,16 +525,24 @@ local function GetItemStringFromItemLink(slotNum, itemLink, debugOutput)
520525

521526
-- 11.1.7 Belt
522527
if itemId == 242664 or itemId == 245964 or itemId == 245965 or itemId == 245966 then
523-
local titanDiscId = Simulationcraft:GetTitanDiscBeltSpell()
528+
local titanDiscId, tooltipStrings = Simulationcraft:GetTitanDiscBeltSpell()
524529
if titanDiscId then
525530
simcItemOptions[#simcItemOptions + 1] = 'titan_disc_id=' .. titanDiscId
526531
end
532+
debugLines[#debugLines + 1] = 'Spell Descriptions:'
533+
for i = 1, #tooltipStrings do
534+
debugLines[#debugLines + 1] = tooltipStrings[i]
535+
end
527536
end
528537

529538
local itemStr = ''
530539
itemStr = itemStr .. (simcSlotNames[slotNum] or 'unknown') .. "=" .. table.concat(simcItemOptions, ',')
531540
if debugOutput then
532-
itemStr = itemStr .. '\n# ' .. gsub(itemLink, "\124", "\124\124") .. '\n'
541+
debugLines[#debugLines + 1] = gsub(itemLink, "\124", "\124\124")
542+
for line = 1, #debugLines do
543+
itemStr = itemStr .. '\n# ' .. debugLines[line]
544+
end
545+
itemStr = itemStr .. '\n'
533546
end
534547

535548
return itemStr
@@ -717,18 +730,21 @@ end
717730
-- This requires the SpellCache with the right spell IDs to be loaded
718731
function Simulationcraft:GetTitanDiscBeltSpell()
719732
local activeSpell = nil
720-
local beltDescription = SpellCache[Simulationcraft.discBeltSpell]:GetSpellDescription()
733+
local debugTooltipStrings = {}
734+
local beltDescription = Trim(SpellCache[Simulationcraft.discBeltSpell]:GetSpellDescription())
735+
debugTooltipStrings[#debugTooltipStrings + 1] = beltDescription
721736
if not beltDescription then
722737
error('Unable to get spell description for DISC Belt spell')
723738
end
724739
for k, v in pairs(Simulationcraft.discBeltEffectSpells) do
725-
local effectDesc = SpellCache[k]:GetSpellDescription()
740+
local effectDesc = Trim(SpellCache[k]:GetSpellDescription())
741+
debugTooltipStrings[#debugTooltipStrings + 1] = effectDesc
726742
if beltDescription:find(effectDesc) then
727743
activeSpell = v
728744
end
729745
end
730746

731-
return activeSpell
747+
return activeSpell, debugTooltipStrings
732748
end
733749

734750
function Simulationcraft:GetMainFrame(text)

0 commit comments

Comments
 (0)