Skip to content

Commit 19d1722

Browse files
committed
Fix flavourtext for 2 uniques with variants, and Fix Sekhema's resolve mods
1 parent 4a3bd3b commit 19d1722

5 files changed

Lines changed: 1859 additions & 756 deletions

File tree

src/Classes/ItemsTab.lua

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

47-
-- Flavour Text lookup
48-
local nameToFlavour = {}
47+
local flavourLookup = {}
48+
4949
for _, entry in pairs(data.flavourText) do
50-
if entry.name then
51-
nameToFlavour[entry.name] = entry.text
52-
end
50+
if entry.name and entry.id and entry.text then
51+
flavourLookup[entry.name] = flavourLookup[entry.name] or {}
52+
flavourLookup[entry.name][entry.id] = entry.text
53+
end
5354
end
5455

56+
5557
local ItemsTabClass = newClass("ItemsTab", "UndoHandler", "ControlHost", "Control", function(self, build)
5658
self.UndoHandler()
5759
self.ControlHost()
@@ -2882,10 +2884,51 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
28822884
tooltip:AddSeparator(14)
28832885

28842886
-- Show flavour text:
2885-
if item.rarity == "UNIQUE" and main.showFlavourText == true then
2886-
local flavour = nameToFlavour[item.title]
2887+
local flavourTable = flavourLookup[item.title]
2888+
if flavourTable then
2889+
local flavour = nil
2890+
if item.title == "Sekhema's Resolve" then
2891+
local selectedFlavourId = nil
2892+
for _, lineEntry in ipairs(tooltip.lines or {}) do
2893+
local lineText = lineEntry.text or ""
2894+
if lineText:find("Emerald") then
2895+
selectedFlavourId = "FourUniqueSanctum4a"
2896+
break
2897+
elseif lineText:find("Sapphire") then
2898+
selectedFlavourId = "FourUniqueSanctum4b"
2899+
break
2900+
elseif lineText:find("Ruby") then
2901+
selectedFlavourId = "FourUniqueSanctum4c"
2902+
break
2903+
end
2904+
end
2905+
if selectedFlavourId then
2906+
flavour = flavourTable[selectedFlavourId]
2907+
end
2908+
elseif item.title == "Grand Spectrum" then
2909+
local selectedFlavourId = nil
2910+
local baseName = item.baseName
2911+
if baseName == "Ruby" then
2912+
selectedFlavourId = "FourUniqueJewel1"
2913+
elseif baseName == "Emerald" then
2914+
selectedFlavourId = "FourUniqueJewel2"
2915+
elseif baseName == "Sapphire" then
2916+
selectedFlavourId = "FourUniqueJewel3"
2917+
end
2918+
if selectedFlavourId then
2919+
flavour = flavourTable[selectedFlavourId]
2920+
end
2921+
else -- Most uniques will run through here.
2922+
for _, text in pairs(flavourTable) do
2923+
flavour = text
2924+
break
2925+
end
2926+
end
2927+
28872928
if flavour then
2888-
tooltip:AddLine(16, colorCodes.UNIQUE .. flavour)
2929+
for _, line in ipairs(flavour) do
2930+
tooltip:AddLine(16, colorCodes.UNIQUE .. line)
2931+
end
28892932
tooltip:AddSeparator(14)
28902933
end
28912934
end

0 commit comments

Comments
 (0)