Skip to content

Commit e73ae80

Browse files
Blitz54LocalIdentity
andauthored
Add unique item base type origin to tooltip (#2105)
* Add unique item base type origin to tooltip * Remove sekhema's title check as they were renamed * Show mutated icon on Vaal items --------- Co-authored-by: LocalIdentity <localidentity2@gmail.com>
1 parent 6160d94 commit e73ae80

4 files changed

Lines changed: 196 additions & 63 deletions

File tree

src/Classes/ItemsTab.lua

Lines changed: 63 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ local flavourLookup = {}
4949
for _, entry in pairs(data.flavourText) do
5050
if entry.name and entry.id and entry.text then
5151
flavourLookup[entry.name] = flavourLookup[entry.name] or {}
52-
flavourLookup[entry.name][entry.id] = entry.text
52+
flavourLookup[entry.name][entry.id] = {
53+
text = entry.text,
54+
origin = entry.origin
55+
}
5356
end
5457
end
5558

@@ -3224,7 +3227,6 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth)
32243227
tooltip.tooltipHeader = item.rarity
32253228
tooltip.center = true
32263229
tooltip.color = rarityCode
3227-
self:SetTooltipHeaderInfluence(tooltip, item)
32283230
-- Item name
32293231
if item.title then
32303232
tooltip:AddLine(fontSizeTitle, rarityCode..item.title, "FONTIN SC")
@@ -3265,7 +3267,61 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth)
32653267
local slotNum = slot and slot.slotNum or (IsKeyDown("SHIFT") and 2 or 1)
32663268
local modList = item.modList or item.slotModList[slotNum]
32673269

3268-
tooltip:AddLine(fontSizeBig, s_format("^x7F7F7F%s", base.weapon and self.build.data.weaponTypeInfo[base.type].label or base.type), "FONTIN SC")
3270+
-- Find matching flavour entry and extract origin ONCE
3271+
local itemOrigin = nil
3272+
local flavourText = nil
3273+
if item.rarity == "UNIQUE" or item.rarity == "RELIC" or item.base.type == "Transcendent Limb" then
3274+
if main.showFlavourText then
3275+
local flavourTable
3276+
if item.base.type == "Transcendent Limb" then
3277+
flavourTable = flavourLookup["Transcendent Limb"]
3278+
else
3279+
flavourTable = flavourLookup[item.title]
3280+
end
3281+
if flavourTable then
3282+
local flavour = nil
3283+
3284+
if item.title == "Grand Spectrum" then
3285+
local selectedFlavourId = nil
3286+
local baseName = item.baseName
3287+
if baseName == "Ruby" then
3288+
selectedFlavourId = "FourUniqueJewel1"
3289+
elseif baseName == "Emerald" then
3290+
selectedFlavourId = "FourUniqueJewel2"
3291+
elseif baseName == "Sapphire" then
3292+
selectedFlavourId = "FourUniqueJewel3"
3293+
end
3294+
if selectedFlavourId then
3295+
flavour = flavourTable[selectedFlavourId]
3296+
end
3297+
3298+
else
3299+
for _, text in pairs(flavourTable) do
3300+
flavour = text
3301+
break
3302+
end
3303+
end
3304+
3305+
if flavour then
3306+
if flavour.origin then
3307+
itemOrigin = flavour.origin
3308+
end
3309+
flavourText = flavour.text or flavour
3310+
end
3311+
end
3312+
end
3313+
end
3314+
3315+
-- Combine base type with origin if available
3316+
local typeStr = base.weapon and self.build.data.weaponTypeInfo[base.type].label or base.type
3317+
if itemOrigin then
3318+
typeStr = itemOrigin .. " " .. typeStr
3319+
if itemOrigin == "Vaal" then
3320+
item.mutated = true
3321+
end
3322+
end
3323+
self:SetTooltipHeaderInfluence(tooltip, item)
3324+
tooltip:AddLine(fontSizeBig, s_format("^x7F7F7F%s", typeStr), "FONTIN SC")
32693325
if item.quality and item.quality > 0 then
32703326
tooltip:AddLine(fontSizeBig, s_format("^x7F7F7FQuality: "..colorCodes.MAGIC.."+%d%%", item.quality), "FONTIN SC")
32713327
end
@@ -3565,63 +3621,11 @@ function ItemsTabClass:AddItemTooltip(tooltip, item, slot, dbMode, maxWidth)
35653621
end
35663622

35673623
-- Show flavour text:
3568-
if item.rarity == "UNIQUE" or item.rarity == "RELIC" or item.base.type =="Transcendent Limb" and main.showFlavourText then
3569-
local flavourTable
3570-
if item.base.type =="Transcendent Limb" then
3571-
flavourTable = flavourLookup["Transcendent Limb"]
3572-
else
3573-
flavourTable = flavourLookup[item.title]
3574-
end
3575-
if flavourTable then
3576-
local flavour = nil
3577-
3578-
if item.title == "Sekhema's Resolve" then
3579-
local selectedFlavourId = nil
3580-
for _, lineEntry in ipairs(tooltip.lines or {}) do
3581-
local lineText = lineEntry.text or ""
3582-
if lineText:find("Emerald") then
3583-
selectedFlavourId = "FourUniqueSanctum4a"
3584-
break
3585-
elseif lineText:find("Sapphire") then
3586-
selectedFlavourId = "FourUniqueSanctum4b"
3587-
break
3588-
elseif lineText:find("Ruby") then
3589-
selectedFlavourId = "FourUniqueSanctum4c"
3590-
break
3591-
end
3592-
end
3593-
if selectedFlavourId then
3594-
flavour = flavourTable[selectedFlavourId]
3595-
end
3596-
3597-
elseif item.title == "Grand Spectrum" then
3598-
local selectedFlavourId = nil
3599-
local baseName = item.baseName
3600-
if baseName == "Ruby" then
3601-
selectedFlavourId = "FourUniqueJewel1"
3602-
elseif baseName == "Emerald" then
3603-
selectedFlavourId = "FourUniqueJewel2"
3604-
elseif baseName == "Sapphire" then
3605-
selectedFlavourId = "FourUniqueJewel3"
3606-
end
3607-
if selectedFlavourId then
3608-
flavour = flavourTable[selectedFlavourId]
3609-
end
3610-
3611-
else
3612-
for _, text in pairs(flavourTable) do
3613-
flavour = text
3614-
break
3615-
end
3616-
end
3617-
3618-
if flavour then
3619-
for _, line in ipairs(flavour) do
3620-
tooltip:AddLine(fontSizeBig, colorCodes.UNIQUE .. line, "FONTIN SC ITALIC")
3621-
end
3622-
tooltip:AddSeparator(14)
3623-
end
3624+
if flavourText then
3625+
for _, line in ipairs(flavourText) do
3626+
tooltip:AddLine(fontSizeBig, colorCodes.UNIQUE .. line, "FONTIN SC ITALIC")
36243627
end
3628+
tooltip:AddSeparator(14)
36253629
end
36263630

36273631
-- Stat differences

0 commit comments

Comments
 (0)