Skip to content

Commit 8bed517

Browse files
committed
feat: make it special indicator
1 parent 9318152 commit 8bed517

File tree

3 files changed

+41
-15
lines changed

3 files changed

+41
-15
lines changed

Modules/Item/Inspect.lua

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ local UnitGUID = UnitGUID
3636
local UnitHealthMax = UnitHealthMax
3737
local UnitLevel = UnitLevel
3838
local UnitName = UnitName
39+
local GetServerExpansionLevel = GetServerExpansionLevel
3940

4041
local HEALTH = HEALTH
4142
local LEVEL = LEVEL
@@ -53,6 +54,7 @@ local Enum_ItemQuality_Common = Enum.ItemQuality.Common
5354
local guids, inspecting = {}, false
5455

5556
local LABEL_COLOR = C.GetRGBFromTemplate("cyan-300")
57+
local CURRENT_EXPANSION_ID = GetServerExpansionLevel()
5658

5759
local DISPLAY_SLOTS = {}
5860
for slotIndex, slotName in ipairs(W.EquipmentSlots) do
@@ -82,12 +84,25 @@ local function GetUnitSlotItemInfo(unit, slotIndex)
8284
return
8385
end
8486

85-
local name, _, quality, level, _, type, subType, _, itemEquipLoc, tex, _, _, _, _, _, set = C_Item_GetItemInfo(link)
87+
local name, _, quality, level, _, type, subType, _, itemEquipLoc, tex, _, _, _, _, expansionID, set, isCraftingReagent =
88+
C_Item_GetItemInfo(link)
89+
90+
local craftingAtlas
91+
local cleanLink = gsub(link, "|h%[(.+)%]|h", function(raw)
92+
local name = gsub(raw, "(%s*)(|A:.-|a)", function(_, atlasString)
93+
craftingAtlas = gsub(atlasString, "|A:(.-):%d+:%d+::%d+|a", "%1")
94+
return ""
95+
end)
96+
return "|h" .. name .. "|h"
97+
end)
8698

8799
return {
100+
cleanLink = cleanLink,
101+
craftingAtlas = craftingAtlas,
102+
expansionID = expansionID,
103+
isCraftingReagent = isCraftingReagent,
88104
level = level,
89105
link = link,
90-
noBracketsLink = gsub(link, "h%[(.+)%]|h", "h%1|h"),
91106
name = name,
92107
quality = quality,
93108
set = set,
@@ -454,11 +469,9 @@ function I:BuildInspectItemListFrame(parent)
454469
)
455470
line.ItemTextureFrame:SetTemplate()
456471

457-
line.ItemTextureFrame.TierSetIndicator = line.ItemTextureFrame:CreateFontString(nil, "OVERLAY")
458-
F.SetFontOutline(line.ItemTextureFrame.TierSetIndicator, F.GetCompatibleFont("Chivo Mono"), 20)
459-
line.ItemTextureFrame.TierSetIndicator:Point("CENTER", line.ItemTextureFrame.Texture, "TOPRIGHT", 1, -1)
460-
line.ItemTextureFrame.TierSetIndicator:SetTextColor(C.ExtractRGBFromTemplate("pink-500"))
461-
line.ItemTextureFrame.TierSetIndicator:SetText("*")
472+
line.ItemTextureFrame.SpecialIndicator = line.ItemTextureFrame:CreateFontString(nil, "OVERLAY")
473+
F.SetFontOutline(line.ItemTextureFrame.SpecialIndicator, F.GetCompatibleFont("Chivo Mono"), 20)
474+
line.ItemTextureFrame.SpecialIndicator:Point("CENTER", line.ItemTextureFrame.Texture, "TOPRIGHT", 1, -2)
462475

463476
-- Item Name
464477
line.ItemName = line:CreateFontString(nil, "ARTWORK")
@@ -550,7 +563,7 @@ function I:ShowInspectItemListFrame(unit, parent, ilevel)
550563

551564
if itemInfo and itemInfo.level > 0 then
552565
line.ItemLevel:SetText(format("%d", itemInfo.level))
553-
line.ItemName:SetText(itemInfo.noBracketsLink or itemInfo.link or itemInfo.name)
566+
line.ItemName:SetText(itemInfo.cleanLink or itemInfo.link or itemInfo.name)
554567
else
555568
line.ItemLevel:SetText("")
556569
line.ItemName:SetText(L["Not Equipped"])
@@ -575,10 +588,23 @@ function I:ShowInspectItemListFrame(unit, parent, ilevel)
575588
line.ItemTextureFrame:Hide()
576589
end
577590

578-
if self.db.icon.enable and self.db.icon.tierSetIndicator and itemInfo and itemInfo.set and itemInfo.set > 0 then
579-
line.ItemTextureFrame.TierSetIndicator:Show()
591+
if self.db.icon.enable and self.db.icon.specialIndicator and itemInfo then
592+
if itemInfo.set and itemInfo.set > 0 then
593+
if itemInfo.expansionID >= CURRENT_EXPANSION_ID then
594+
line.ItemTextureFrame.SpecialIndicator:SetTextColor(C.ExtractRGBFromTemplate("pink-500"))
595+
else
596+
line.ItemTextureFrame.SpecialIndicator:SetTextColor(C.ExtractRGBFromTemplate("gray-400"))
597+
end
598+
line.ItemTextureFrame.SpecialIndicator:SetText("*")
599+
line.ItemTextureFrame.SpecialIndicator:Show()
600+
elseif itemInfo.craftingAtlas then
601+
line.ItemTextureFrame.SpecialIndicator:SetText("|A:" .. itemInfo.craftingAtlas .. ":8:8|a")
602+
line.ItemTextureFrame.SpecialIndicator:Show()
603+
else
604+
line.ItemTextureFrame.SpecialIndicator:Hide()
605+
end
580606
else
581-
line.ItemTextureFrame.TierSetIndicator:Hide()
607+
line.ItemTextureFrame.SpecialIndicator:Hide()
582608
end
583609

584610
-- Update colors for some expansion special items

Options/Item.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,11 +1202,11 @@ options.inspect = {
12021202
return not E.db.WT.item.inspect.icon
12031203
end,
12041204
},
1205-
tierSetIndicator = {
1205+
specialIndicator = {
12061206
order = 3,
12071207
type = "toggle",
1208-
name = L["Tier Set Indicator"],
1209-
desc = L["Show the tier set indicator on the icon."],
1208+
name = L["Special Indicator"],
1209+
desc = L["Show the special mark on the icon to indicate the crafting quality, tier set, etc."],
12101210
hidden = function()
12111211
return not E.db.WT.item.inspect.icon
12121212
end,

Settings/Profile.lua

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -652,7 +652,7 @@ P.item = {
652652
icon = {
653653
enable = true,
654654
qualityBorder = false,
655-
tierSetIndicator = true,
655+
specialIndicator = true,
656656
},
657657
slotText = {
658658
name = E.db.general.font,

0 commit comments

Comments
 (0)