Skip to content

Commit 3ac7e54

Browse files
committed
Add flavour text to Uniques
1 parent ccd87df commit 3ac7e54

File tree

6 files changed

+13361
-3
lines changed

6 files changed

+13361
-3
lines changed

src/Classes/ItemsTab.lua

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@ local catalystQualityFormat = {
4444
"^x7F7F7FQuality (Attribute Modifiers): "..colorCodes.MAGIC.."+%d%% (augmented)",
4545
}
4646

47+
-- Flavour Text lookup
48+
local nameToFlavour = {}
49+
for _, entry in pairs(data.flavourText) do
50+
if entry.Name then
51+
nameToFlavour[entry.Name] = entry.Text
52+
end
53+
end
54+
4755
local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Control", function(self, build)
4856
self.UndoHandler()
4957
self.ControlHost()
@@ -2565,6 +2573,7 @@ end
25652573
function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
25662574
-- Item name
25672575
local rarityCode = colorCodes[item.rarity]
2576+
tooltip.maxWidth = 458
25682577
tooltip.center = true
25692578
tooltip.color = rarityCode
25702579
if item.title then
@@ -2872,6 +2881,15 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
28722881
end
28732882
tooltip:AddSeparator(14)
28742883

2884+
-- Show flavour text:
2885+
if item.rarity == "UNIQUE" and main.showFlavourText == true then
2886+
local flavour = nameToFlavour[item.title]
2887+
if flavour then
2888+
tooltip:AddLine(16, colorCodes.UNIQUE .. flavour)
2889+
tooltip:AddSeparator(14)
2890+
end
2891+
end
2892+
28752893
-- Stat differences
28762894
if not self.showStatDifferences then
28772895
tooltip:AddSeparator(14)

0 commit comments

Comments
 (0)