delted old debug window, added new version notice window, added new features to tracker module, updated locales, and updated main addon files.

This commit is contained in:
Torsten Brendgen
2026-04-25 17:33:32 +02:00
parent f1d2a761e4
commit 02e062d66b
12 changed files with 401 additions and 681 deletions

View File

@@ -4,6 +4,91 @@ if not HMGT then return end
HMGT.TrackerCore = HMGT.TrackerCore or {}
HMGT.TRACKER_PRESET_DEFINITIONS = HMGT.TRACKER_PRESET_DEFINITIONS or {
interruptTracker = {
moduleName = "InterruptTracker",
dbKey = "interruptTracker",
trackerType = "normal",
trackerKey = "interruptTracker",
categories = { "interrupt" },
defaultName = function(L)
return (L and L["IT_NAME"]) or "Interrupts"
end,
},
raidCooldownTracker = {
moduleName = "RaidCooldownTracker",
dbKey = "raidCooldownTracker",
trackerType = "normal",
trackerKey = "raidCooldownTracker",
categories = { "lust", "defensive", "healing", "tank", "utility", "offensive", "cc", "interrupt" },
defaultName = function(L)
return (L and L["RCD_NAME"]) or "Raid Cooldowns"
end,
},
groupCooldownTracker = {
moduleName = "GroupCooldownTracker",
dbKey = "groupCooldownTracker",
trackerType = "group",
trackerKey = "groupCooldownTracker",
categories = { "tank", "defensive", "healing", "cc", "utility", "offensive", "lust", "interrupt" },
includeSelfFrame = false,
showChargesOnIcon = true,
defaultName = function(L)
return (L and L["GCD_NAME"]) or "Cooldowns"
end,
},
}
function HMGT:GetTrackerPresetDefinitions()
return self.TRACKER_PRESET_DEFINITIONS or {}
end
function HMGT:GetTrackerPresetDefinition(key)
local definitions = self:GetTrackerPresetDefinitions()
return definitions and definitions[tostring(key or "")]
end
function HMGT:GetTrackerPresetDefinitionByModule(moduleName)
local target = tostring(moduleName or "")
for _, definition in pairs(self:GetTrackerPresetDefinitions()) do
if tostring(definition.moduleName or "") == target then
return definition
end
end
return nil
end
function HMGT:GetTrackerTypeOptions()
local L = self.L
return {
normal = (L and L["OPT_TRACKER_TYPE_NORMAL"]) or "Normal tracker",
group = (L and L["OPT_TRACKER_TYPE_GROUP"]) or "Group-based tracker",
}
end
function HMGT:BuildTrackerConfigFromPreset(presetKey, trackerId, overrides)
local definition = self:GetTrackerPresetDefinition(presetKey)
local config = overrides or {}
if not definition then
return self:CreateTrackerConfig(trackerId, config)
end
local base = {
name = type(definition.defaultName) == "function" and definition.defaultName(self.L) or tostring(definition.defaultName or ""),
trackerType = definition.trackerType,
trackerKey = definition.trackerKey,
categories = definition.categories,
includeSelfFrame = definition.includeSelfFrame,
showChargesOnIcon = definition.showChargesOnIcon,
}
for key, value in pairs(config) do
base[key] = value
end
return self:CreateTrackerConfig(trackerId, base)
end
local function EntryNeedsVisualTicker(entry)
if type(entry) ~= "table" then
return false
@@ -204,6 +289,93 @@ function HMGT:CollectTrackerEntries(tracker)
return entries
end
function HMGT:GetDemoEntries(trackerKey, database, settings)
local pool = {}
local poolByClass = {}
for _, entry in ipairs(database or {}) do
if settings.enabledSpells[entry.spellId] ~= false then
pool[#pool + 1] = entry
for _, classToken in ipairs(entry.classes or {}) do
poolByClass[classToken] = poolByClass[classToken] or {}
poolByClass[classToken][#poolByClass[classToken] + 1] = entry
end
end
end
if #pool == 0 then
return {}
end
local classKeys = {}
for classToken in pairs(poolByClass) do
classKeys[#classKeys + 1] = classToken
end
if #classKeys == 0 then
classKeys[1] = "WARRIOR"
end
local count = settings.showBar and math.min(8, #pool) or math.min(12, #pool)
local names = { "Alice", "Bob", "Clara", "Duke", "Elli", "Fynn", "Gina", "Hektor", "Ivo", "Jana", "Kira", "Lio" }
local spellIds = {}
for _, entry in ipairs(pool) do
spellIds[#spellIds + 1] = tostring(entry.spellId)
end
table.sort(spellIds)
local signature = table.concat(spellIds, ",") .. "|" .. tostring(settings.showBar and 1 or 0) .. "|" .. tostring(count)
local now = GetTime()
local cache = self.demoModeData[trackerKey]
if (not cache) or cache.signature ~= signature or (not cache.entries) or #cache.entries ~= count then
local cachedEntries = {}
for index = 1, count do
local classToken = classKeys[math.random(1, #classKeys)]
local classPool = poolByClass[classToken]
local spellEntry = (classPool and classPool[math.random(1, #classPool)]) or pool[math.random(1, #pool)]
local duration = math.max(
1,
tonumber(HMGT_SpellData.GetBaseCooldown and HMGT_SpellData.GetBaseCooldown(spellEntry)) or tonumber(spellEntry.cooldown) or 60
)
local offset = math.random() * math.min(duration * 0.85, duration - 0.1)
cachedEntries[#cachedEntries + 1] = {
playerName = names[((index - 1) % #names) + 1],
class = classToken or ((spellEntry.classes and spellEntry.classes[1]) or "WARRIOR"),
spellEntry = spellEntry,
total = duration,
cycleStart = now - offset,
currentCharges = nil,
maxCharges = nil,
}
end
cache = {
signature = signature,
entries = cachedEntries,
}
self.demoModeData[trackerKey] = cache
end
local entries = {}
for _, entry in ipairs(cache.entries) do
local total = math.max(1, tonumber(entry.total) or 1)
local elapsed = math.max(0, now - (entry.cycleStart or now))
local phase = math.fmod(elapsed, total)
local remaining = total - phase
if elapsed > 0 and phase < 0.05 then
remaining = 0
end
entries[#entries + 1] = {
playerName = entry.playerName,
class = entry.class,
spellEntry = entry.spellEntry,
remaining = remaining,
total = total,
currentCharges = entry.currentCharges,
maxCharges = entry.maxCharges,
}
end
return entries
end
function HMGT:CollectTrackerTestEntries(tracker)
local playerName = self:NormalizePlayerName(UnitName("player")) or "Player"
local classToken = select(2, UnitClass("player"))
@@ -385,7 +557,7 @@ function HMGT:TriggerTrackerUpdate(reason)
if t0 and t1 then
local mod = HMGT[name]
local count = mod and mod.lastEntryCount or 0
self:Debug("verbose", "UIUpdate %s took %.2fms entries=%s", tostring(name), t1 - t0, tostring(count))
self:DebugScoped("verbose", "TrackerUI", "UIUpdate %s took %.2fms entries=%s", tostring(name), t1 - t0, tostring(count))
end
end