Skip to content

Commit 09306b1

Browse files
committed
feat: gem acquisition info
1 parent 92bc0df commit 09306b1

4 files changed

Lines changed: 3157 additions & 1 deletion

File tree

src/Classes/GemSelectControl.lua

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ function GemSelectClass:AddGemTooltip(gemInstance)
608608
self.tooltip:AddLine(fontSizeTitle, colorCodes.GEM..grantedEffect.name, "FONTIN SC")
609609
self.tooltip:AddSeparator(10)
610610
self.tooltip:AddLine(fontSizeBig, "^x7F7F7F" .. gemInstance.gemData.tagString, "FONTIN SC")
611+
self:AddGemAcquisitionInfo(gemInstance)
611612
self:AddCommonGemInfo(gemInstance, grantedEffect, true)
612613
self.tooltip:AddSeparator(10)
613614
self.tooltip:AddLine(fontSizeTitle, colorCodes.GEM .. (gemInstance.gemData.secondaryEffectName or grantedEffectSecondary.name), "FONTIN SC")
@@ -623,10 +624,43 @@ function GemSelectClass:AddGemTooltip(gemInstance)
623624
self.tooltip:AddSeparator(10)
624625
end
625626
self.tooltip:AddLine(fontSizeBig, "^x7F7F7F" .. gemInstance.gemData.tagString, "FONTIN SC")
627+
self:AddGemAcquisitionInfo(gemInstance)
626628
self:AddCommonGemInfo(gemInstance, grantedEffect, true, secondary and secondary.support and secondary)
627629
end
628630
end
629631

632+
function GemSelectClass:AddGemAcquisitionInfo(gemInstance)
633+
if not self.skillsTab.showAcquisitionSource then
634+
return
635+
end
636+
local info = data.gemAcquisitionSources and (
637+
data.gemAcquisitionSources[gemInstance.gemData.name] or
638+
data.gemAcquisitionSources[gemInstance.gemId]
639+
)
640+
if not info then
641+
return
642+
end
643+
local className = self.skillsTab.build.spec and self.skillsTab.build.spec.curClassName
644+
local location = string.format("%s (Act %s)", info.npc or "?", tostring(info.act or "?"))
645+
local color, text
646+
if info.reward == "all" or (type(info.reward) == "table" and info.reward[className]) then
647+
color = colorCodes.POSITIVE
648+
text = string.format("Quest reward from %s after %s", location, info.quest or "the quest")
649+
elseif info.vendor == nil or info.vendor == "all" or (type(info.vendor) == "table" and info.vendor[className]) then
650+
color = colorCodes.CRAFTED
651+
text = string.format("Buy from %s after %s", location, info.quest or "the quest")
652+
elseif (tonumber(info.act) or 0) <= 3 then
653+
color = colorCodes.CRAFTED
654+
text = "Buy from Siosa (Act 3) after A Fixture of Fate"
655+
else
656+
color = colorCodes.CRAFTED
657+
text = "Buy from Lilly Roth (Act 6) after Fallen from Grace"
658+
end
659+
local fontSizeBig = main.showFlavourText and 18 or 16
660+
self.tooltip:AddSeparator(6)
661+
self.tooltip:AddLine(fontSizeBig, color .. text, "FONTIN SC")
662+
end
663+
630664
function GemSelectClass:AddCommonGemInfo(gemInstance, grantedEffect, addReq, mergeStatsFrom)
631665
local fontSizeBig = main.showFlavourText and 18 or 16
632666
local displayInstance = gemInstance.displayEffect or gemInstance

src/Classes/SkillsTab.lua

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
8787
self.sortGemsByDPS = true
8888
self.sortGemsByDPSField = "CombinedDPS"
8989
self.showSupportGemTypes = "ALL"
90+
self.showAcquisitionSource = false
9091
self.showLegacyGems = false
9192
self.defaultGemLevel = "normalMaximum"
9293
self.defaultGemQuality = main.defaultGemQuality
@@ -120,7 +121,7 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
120121
-- Gem options
121122
local optionInputsX = 170
122123
local optionInputsY = 45
123-
self.controls.optionSection = new("SectionControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { 0, optionInputsY + 50, 360, 156 }, "Gem Options")
124+
self.controls.optionSection = new("SectionControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { 0, optionInputsY + 50, 360, 180 }, "Gem Options")
124125
self.controls.sortGemsByDPS = new("CheckBoxControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { optionInputsX, optionInputsY + 70, 20 }, "Sort gems by DPS:", function(state)
125126
self.sortGemsByDPS = state
126127
end, nil, true)
@@ -148,6 +149,9 @@ local SkillsTabClass = newClass("SkillsTab", "UndoHandler", "ControlHost", "Cont
148149
self.controls.showLegacyGems = new("CheckBoxControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { optionInputsX, optionInputsY + 166, 20 }, "^7Show legacy gems:", function(state)
149150
self.showLegacyGems = state
150151
end)
152+
self.controls.showAcquisitionSource = new("CheckBoxControl", { "TOPLEFT", self.controls.groupList, "BOTTOMLEFT" }, { optionInputsX, optionInputsY + 190, 20 }, "^7Show acquisition source:", function(state)
153+
self.showAcquisitionSource = state
154+
end)
151155

152156
-- Socket group details
153157
if main.portraitMode then
@@ -444,6 +448,10 @@ function SkillsTabClass:Load(xml, fileName)
444448
self.controls.sortGemsByDPSFieldControl:SelByValue(xml.attrib.sortGemsByDPSField or "CombinedDPS", "type")
445449
self.showSupportGemTypes = self.controls.showSupportGemTypes:GetSelValueByKey("show")
446450
self.sortGemsByDPSField = self.controls.sortGemsByDPSFieldControl:GetSelValueByKey("type")
451+
if xml.attrib.showAcquisitionSource then
452+
self.showAcquisitionSource = xml.attrib.showAcquisitionSource == "true"
453+
end
454+
self.controls.showAcquisitionSource.state = self.showAcquisitionSource
447455
for _, node in ipairs(xml) do
448456
if node.elem == "Skill" then
449457
-- Old format, initialize skill sets if needed
@@ -474,6 +482,7 @@ function SkillsTabClass:Save(xml)
474482
defaultGemQuality = tostring(self.defaultGemQuality),
475483
sortGemsByDPS = tostring(self.sortGemsByDPS),
476484
showSupportGemTypes = self.showSupportGemTypes,
485+
showAcquisitionSource = tostring(self.showAcquisitionSource),
477486
sortGemsByDPSField = self.sortGemsByDPSField,
478487
showLegacyGems = tostring(self.showLegacyGems),
479488
}

0 commit comments

Comments
 (0)