Add T4/T6 phase data, phase selector bar, and latest-phase progress

Data: T4 (Karazhan/Gruul/Magtheridon) and T6 (Black Temple/Hyjal) BiS
lists for all 9 classes x 3 specs, sourced from wowtbc.gg page-data
JSON. Phase registry gains PHASE_ORDER-driven ordering, GetLatestPhase
and ResolvePhase fallback. Stat scanning takes MAX across all alias-key
stats (spell damage schools, healing, haste/crit/mp5 ratings).

UI: horizontal phase selector bar between title and summary with a
progress fill that measures completion against the latest available
phase regardless of the selected phase. CompareGear returns latestPhase
and latestCompletionRatio; GetCompletionRatio delegates to a new
StatRatio helper. Default phase switched to T6.
This commit is contained in:
dfj committed 2026-10-11 15:59:32 +02:00
1 parent 5ff421bd09
commit c59a705d05
4 files changed
+1140 -37

No files matched your search

+105 -1
View File
@@ -238,6 +238,10 @@ local StatsPanelTitle = nil
local StatLabels = {}
local StatValues = {}
local UpgradeLabels = {}
local PhaseBar = nil
local PhaseProgressFill = nil
local PhaseProgressText = nil
local PhaseButtons = {}
local STAT_LABELS = {
healing = "+Healing",
@@ -424,6 +428,85 @@ local function StatKeysEqual(a, b)
return true
end
local function CreatePhaseBar(parent, anchor)
local bar = CreateFrame("Frame", nil, parent, "BackdropTemplate")
bar:SetPoint("TOPLEFT", anchor, "BOTTOMLEFT", 0, -4)
bar:SetPoint("TOPRIGHT", anchor, "BOTTOMRIGHT", 0, -4)
bar:SetHeight(24)
bar:SetBackdrop({
bgFile = "Interface\\Buttons\\WHITE8x8",
edgeFile = "Interface\\Buttons\\WHITE8x8",
tile = false,
tileSize = 0,
edgeSize = 1,
insets = { left = 0, right = 0, top = 0, bottom = 0 }
})
bar:SetBackdropColor(ELVUI_TITLE_BG[1], ELVUI_TITLE_BG[2], ELVUI_TITLE_BG[3], 0.9)
bar:SetBackdropBorderColor(ELVUI_BORDER_COLOR[1], ELVUI_BORDER_COLOR[2], ELVUI_BORDER_COLOR[3], ELVUI_BORDER_ALPHA)
local fill = bar:CreateTexture(nil, "BACKGROUND")
fill:SetTexture("Interface\\Buttons\\WHITE8x8")
fill:SetVertexColor(0, 0.68, 0.3, 0.28)
fill:SetPoint("TOPLEFT", bar, "TOPLEFT", 1, -1)
fill:SetPoint("BOTTOMLEFT", bar, "BOTTOMLEFT", 1, 1)
fill:SetWidth(1)
local progressText = bar:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
progressText:SetPoint("RIGHT", bar, "RIGHT", -6, 0)
progressText:SetText("")
progressText:SetTextColor(0.75, 0.95, 0.75, 1)
PhaseBar = bar
PhaseProgressFill = fill
PhaseProgressText = progressText
return bar
end
local function ClearPhaseButtons()
for _, btn in ipairs(PhaseButtons) do
btn:Hide()
btn:SetParent(nil)
end
PhaseButtons = {}
end
local function RebuildPhaseButtons(class, spec, activePhase)
ClearPhaseButtons()
local phases = ns.Data.BISLists:GetAvailablePhases(class, spec)
local barWidth = PhaseBar:GetWidth()
local count = #phases
if count == 0 or barWidth <= 0 then return end
local segWidth = barWidth / count
for i, phase in ipairs(phases) do
local btn = CreateFrame("Button", nil, PhaseBar)
btn:SetPoint("TOPLEFT", PhaseBar, "TOPLEFT", (i - 1) * segWidth, 0)
btn:SetSize(segWidth, 24)
local text = btn:CreateFontString(nil, "OVERLAY", "GameFontNormalSmall")
text:SetPoint("CENTER", btn, "CENTER", 0, 0)
text:SetText(phase)
if phase == activePhase then
text:SetTextColor(1, 0.82, 0, 1)
else
text:SetTextColor(0.45, 0.45, 0.45, 1)
end
if phase ~= activePhase then
btn:SetScript("OnClick", function()
AmibisDB.selectedPhase = phase
ns.UI.RefreshUI()
end)
btn:EnableMouse(true)
else
btn:EnableMouse(false)
end
PhaseButtons[i] = btn
end
end
local function InitializeUI()
if MainFrame then return end
@@ -431,7 +514,9 @@ local function InitializeUI()
local titleBar, title = CreateTitleBar(MainFrame)
TitleText = title
local summaryBar, summary = CreateSummaryBar(MainFrame, titleBar)
local phaseBar = CreatePhaseBar(MainFrame, titleBar)
local summaryBar, summary = CreateSummaryBar(MainFrame, phaseBar)
SummaryText = summary
local header = CreateColumnHeaders(MainFrame, summaryBar)
@@ -483,6 +568,13 @@ function ns.UI.RefreshUI()
UpgradeLabels[i]:SetText("")
end
end
ClearPhaseButtons()
if PhaseProgressFill then
PhaseProgressFill:SetWidth(1)
end
if PhaseProgressText then
PhaseProgressText:SetText("")
end
for i = 1, MAX_VISIBLE_ROWS do
SlotRows[i].slotText:SetText("")
SlotRows[i].equippedText:SetText("")
@@ -496,6 +588,18 @@ function ns.UI.RefreshUI()
SummaryText:SetText(string.format("BIS: %d/%d slots", data.bisCount, data.totalSlots))
if PhaseBar then
RebuildPhaseButtons(data.class, data.spec, data.phase)
local ratio = data.latestCompletionRatio or Amibis:GetCompletionRatio(data)
local targetPhase = data.latestPhase or data.phase
if PhaseProgressFill then
PhaseProgressFill:SetWidth(math.max(1, PhaseBar:GetWidth() * ratio))
end
if PhaseProgressText then
PhaseProgressText:SetText(string.format("%d%% to %s", math.floor(ratio * 100 + 0.5), targetPhase))
end
end
for i = 1, MAX_VISIBLE_ROWS do
local row = SlotRows[i]
local slotData = data.slots[i]