Skip to content

Commit b41717a

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

File tree

5 files changed

+1865
-757
lines changed

5 files changed

+1865
-757
lines changed

src/Classes/ItemsTab.lua

Lines changed: 57 additions & 9 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()
@@ -2883,10 +2885,56 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode)
28832885

28842886
-- Show flavour text:
28852887
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)
2888+
local flavourTable = flavourLookup[item.title]
2889+
if flavourTable then
2890+
local flavour = nil
2891+
2892+
if item.title == "Sekhema's Resolve" then
2893+
local selectedFlavourId = nil
2894+
for _, lineEntry in ipairs(tooltip.lines or {}) do
2895+
local lineText = lineEntry.text or ""
2896+
if lineText:find("Emerald") then
2897+
selectedFlavourId = "FourUniqueSanctum4a"
2898+
break
2899+
elseif lineText:find("Sapphire") then
2900+
selectedFlavourId = "FourUniqueSanctum4b"
2901+
break
2902+
elseif lineText:find("Ruby") then
2903+
selectedFlavourId = "FourUniqueSanctum4c"
2904+
break
2905+
end
2906+
end
2907+
if selectedFlavourId then
2908+
flavour = flavourTable[selectedFlavourId]
2909+
end
2910+
2911+
elseif item.title == "Grand Spectrum" then
2912+
local selectedFlavourId = nil
2913+
local baseName = item.baseName
2914+
if baseName == "Ruby" then
2915+
selectedFlavourId = "FourUniqueJewel1"
2916+
elseif baseName == "Emerald" then
2917+
selectedFlavourId = "FourUniqueJewel2"
2918+
elseif baseName == "Sapphire" then
2919+
selectedFlavourId = "FourUniqueJewel3"
2920+
end
2921+
if selectedFlavourId then
2922+
flavour = flavourTable[selectedFlavourId]
2923+
end
2924+
2925+
else
2926+
for _, text in pairs(flavourTable) do
2927+
flavour = text
2928+
break
2929+
end
2930+
end
2931+
2932+
if flavour then
2933+
for _, line in ipairs(flavour) do
2934+
tooltip:AddLine(16, colorCodes.UNIQUE .. line)
2935+
end
2936+
tooltip:AddSeparator(14)
2937+
end
28902938
end
28912939
end
28922940

0 commit comments

Comments
 (0)