Skip to content

Commit 3f8d4c0

Browse files
committed
fix quality tooltip to show quality lines that were previously on variant
1 parent 4f49335 commit 3f8d4c0

1 file changed

Lines changed: 50 additions & 8 deletions

File tree

src/Classes/SkillsTab.lua

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -756,16 +756,58 @@ function SkillsTabClass:CreateGemSlot(index)
756756
end)
757757
slot.quality.tooltipFunc = function(tooltip)
758758
if tooltip:CheckForUpdate(self.build.outputRevision, self.displayGroup) then
759-
if self.displayGroup.gemList[index] then
760-
local calcFunc, calcBase = self.build.calcsTab:GetMiscCalculator(self.build)
761-
if calcFunc then
762-
local storedQuality = self.displayGroup.gemList[index].quality
763-
self.displayGroup.gemList[index].quality = 20
764-
local output = calcFunc()
765-
self.displayGroup.gemList[index].quality = storedQuality
766-
self.build:AddStatComparesToTooltip(tooltip, calcBase, output, "^7Setting to 20 quality will give you:")
759+
-- Get the gem instance from the skills
760+
local gemInstance = self.displayGroup.gemList[index]
761+
if not gemInstance then
762+
return
763+
end
764+
local gemData = gemInstance.gemData
765+
766+
-- Function for both granted effect and secondary such as vaal
767+
local addQualityLines = function(qualityList, grantedEffect)
768+
tooltip:AddLine(18, colorCodes.GEM..grantedEffect.name)
769+
-- Hardcoded to use 20% quality instead of grabbing from gem, this is for consistency and so we always show something
770+
tooltip:AddLine(16, colorCodes.NORMAL.."At +20% Quality:")
771+
for k, qual in pairs(qualityList) do
772+
-- Do the stats one at a time because we're not guaranteed to get the descriptions in the same order we look at them here
773+
local stats = { }
774+
stats[qual[1]] = qual[2] * 20
775+
local descriptions = self.build.data.describeStats(stats, grantedEffect.statDescriptionScope)
776+
-- line may be nil if the value results in no line due to not being enough quality
777+
for _, line in ipairs(descriptions) do
778+
if line then
779+
-- Check if we have a handler for the mod in the gem's statMap or in the shared stat map for skills
780+
if grantedEffect.statMap[qual[1]] or self.build.data.skillStatMap[qual[1]] then
781+
tooltip:AddLine(16, colorCodes.MAGIC..line)
782+
else
783+
local line = colorCodes.UNSUPPORTED..line
784+
line = main.notSupportedModTooltips and (line .. main.notSupportedTooltipText) or line
785+
tooltip:AddLine(16, line)
786+
end
787+
end
788+
end
767789
end
768790
end
791+
-- Check if there is a quality of this type for the effect
792+
if gemData and gemData.grantedEffect.qualityStats and gemData.grantedEffect.qualityStats["Default"] then
793+
local qualityTable = gemData.grantedEffect.qualityStats["Default"]
794+
addQualityLines(qualityTable, gemData.grantedEffect)
795+
tooltip:AddSeparator(10)
796+
end
797+
if gemData and gemData.secondaryGrantedEffect and gemData.secondaryGrantedEffect.qualityStats and gemData.secondaryGrantedEffect.qualityStats["Default"] then
798+
local qualityTable = gemData.secondaryGrantedEffect.qualityStats["Default"]
799+
addQualityLines(qualityTable, gemData.secondaryGrantedEffect)
800+
tooltip:AddSeparator(10)
801+
end
802+
803+
local calcFunc, calcBase = self.build.calcsTab:GetMiscCalculator(self.build)
804+
if calcFunc then
805+
local storedQuality = self.displayGroup.gemList[index].quality
806+
self.displayGroup.gemList[index].quality = 20
807+
local output = calcFunc()
808+
self.displayGroup.gemList[index].quality = storedQuality
809+
self.build:AddStatComparesToTooltip(tooltip, calcBase, output, "^7Setting to 20 quality will give you:")
810+
end
769811
end
770812
end
771813
slot.quality:AddToTabGroup(self.controls.groupLabel)

0 commit comments

Comments
 (0)