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

+66 -4
View File
@@ -5,7 +5,7 @@ ns.Amibis = Amibis
Amibis.version = "1.0.0"
local DEFAULT_AMIBIS_DB = {
selectedPhase = "T5",
selectedPhase = "T6",
}
local DEFAULT_AMIBIS_CHAR_DB = {
@@ -60,6 +60,34 @@ function Amibis:GetStatKeysForSpec(class, spec)
return GetUpgradeStatKeys(class, spec)
end
function Amibis:StatRatio(equippedStats, bisStats, class, spec)
if not equippedStats or not bisStats then return 0 end
local statKeys = GetUpgradeStatKeys(class, spec)
local count, sum = 0, 0
for _, statKey in ipairs(statKeys) do
local bis = bisStats[statKey] or 0
if bis > 0 then
local current = equippedStats[statKey] or 0
local ratio = current / bis
if ratio > 1 then ratio = 1 end
sum = sum + ratio
count = count + 1
end
end
if count == 0 then return 0 end
return sum / count
end
function Amibis:GetCompletionRatio(data)
if not data then return 0 end
if data.statsComplete and data.bisStats then
return self:StatRatio(data.equippedStats, data.bisStats, data.class, data.spec)
end
return (data.bisCount or 0) / math.max(1, data.totalSlots or 1)
end
local function InitializeDB()
if not AmibisDB then
AmibisDB = CopyTable(DEFAULT_AMIBIS_DB)
@@ -183,9 +211,14 @@ local STAT_MAP = {
["ITEM_MOD_HEALING_SHORT"] = "healing",
}
local MAX_AGGREGATE_STATS = {
-- Stats that multiple WoW API keys map to (school-specific spell damage, haste
-- rating, etc.): only one alias is ever active, so take MAX instead of SUM.
local ALIAS_STATS = {
healing = true,
spellDamage = true,
mp5 = true,
haste = true,
crit = true,
}
function Amibis:ScanItemStats(itemID)
@@ -203,7 +236,7 @@ function Amibis:ScanItemStats(itemID)
for wowKey, ourKey in pairs(STAT_MAP) do
local value = stats[wowKey]
if value then
if MAX_AGGREGATE_STATS[ourKey] then
if ALIAS_STATS[ourKey] then
local current = result[ourKey]
if not current or value > current then
result[ourKey] = value
@@ -247,7 +280,7 @@ end
function Amibis:CompareGear()
local class = self:GetPlayerClass()
local spec = AmibisCharDB.overrideSpec or self:GetPlayerSpec()
local phase = AmibisDB.selectedPhase or "T5"
local phase = ns.Data.BISLists:ResolvePhase(class, spec, AmibisDB.selectedPhase or "T5")
local bisList = ns.Data.BISLists:GetBISList(class, spec, phase)
if not bisList then
@@ -357,6 +390,33 @@ function Amibis:CompareGear()
end
end
local latestPhase = ns.Data.BISLists:GetLatestPhase(class, spec)
local latestCompletionRatio = nil
if latestPhase and statsComplete then
local latestList = ns.Data.BISLists:GetBISList(class, spec, latestPhase)
if latestList then
local latestStatsComplete = true
for slotName, bisItem in pairs(latestList) do
if not GetItemInfo(bisItem.itemID) then
latestStatsComplete = false
break
end
end
if latestStatsComplete then
if latestPhase == phase then
latestCompletionRatio = self:StatRatio(equippedStats, bisStats, class, spec)
else
local latestItems = {}
for slotName, bisItem in pairs(latestList) do
latestItems[slotName] = { itemID = bisItem.itemID }
end
local latestStats = self:AggregateStats(latestItems)
latestCompletionRatio = self:StatRatio(equippedStats, latestStats, class, spec)
end
end
end
end
return {
class = class,
spec = spec,
@@ -369,6 +429,8 @@ function Amibis:CompareGear()
equippedStats = equippedStats,
bisStats = bisStats,
statsComplete = statsComplete,
latestPhase = latestPhase,
latestCompletionRatio = latestCompletionRatio,
}
end