nightly commit

This commit is contained in:
Torsten Brendgen
2026-04-25 22:49:22 +02:00
parent feaa62309c
commit cf78405148
10 changed files with 368 additions and 226 deletions

View File

@@ -89,11 +89,9 @@ HMGT.MSG_RAID_TIMELINE_TEST = MSG_RAID_TIMELINE_TEST
-- ── Standardwerte ─────────────────────────────────────────────
local defaults = {
profile = {
debug = false,
debugLevel = "info",
devTools = {
enabled = false,
level = "error",
level = "info",
scope = "ALL",
window = {
width = 920,
@@ -102,131 +100,6 @@ local defaults = {
},
},
syncRemoteCharges = true,
interruptTracker = {
enabled = true,
demoMode = false,
testMode = false,
showBar = true,
showSpellTooltip = true,
locked = false,
posX = 200,
posY = -200,
anchorTo = "UIParent",
anchorCustom = "",
anchorPoint = "TOPLEFT",
anchorRelPoint= "TOPLEFT",
anchorX = 200,
anchorY = -200,
width = 250,
barHeight = 20,
barSpacing = 2,
barTexture = "Blizzard",
borderEnabled = false,
borderColor = { r = 1, g = 1, b = 1, a = 1 },
iconSize = 32,
iconSpacing = 2,
iconCols = 6,
iconOverlay = "sweep", -- "sweep" | "timer"
textAnchor = "below", -- "onIcon" | "above" | "below"
fontSize = 12,
font = "Friz Quadrata TT",
fontOutline = "OUTLINE",
growDirection = "DOWN",
showInSolo = true,
showInGroup = true,
showInRaid = true,
enabledSpells = {},
showPlayerName= true,
colorByClass = true,
showChargesOnIcon = false,
showOnlyReady = false,
readySoonSec = 0,
},
raidCooldownTracker = {
enabled = true,
demoMode = false,
testMode = false,
showBar = true,
showSpellTooltip = true,
locked = false,
posX = 500,
posY = -200,
anchorTo = "UIParent",
anchorCustom = "",
anchorPoint = "TOPLEFT",
anchorRelPoint= "TOPLEFT",
anchorX = 500,
anchorY = -200,
width = 250,
barHeight = 20,
barSpacing = 2,
barTexture = "Blizzard",
borderEnabled = false,
borderColor = { r = 1, g = 1, b = 1, a = 1 },
iconSize = 32,
iconSpacing = 2,
iconCols = 6,
iconOverlay = "sweep", -- "sweep" | "timer"
textAnchor = "below", -- "onIcon" | "above" | "below"
fontSize = 12,
font = "Friz Quadrata TT",
fontOutline = "OUTLINE",
growDirection = "DOWN",
showInSolo = true,
showInGroup = true,
showInRaid = true,
enabledSpells = {},
showPlayerName= true,
colorByClass = true,
showChargesOnIcon = false,
showOnlyReady = false,
readySoonSec = 0,
},
groupCooldownTracker = {
enabled = true,
demoMode = false,
testMode = false,
showBar = true,
showSpellTooltip = true,
locked = false,
attachToPartyFrame = false,
partyAttachSide = "RIGHT",
partyAttachOffsetX = 8,
partyAttachOffsetY = 0,
posX = 800,
posY = -200,
anchorTo = "UIParent",
anchorCustom = "",
anchorPoint = "TOPLEFT",
anchorRelPoint= "TOPLEFT",
anchorX = 800,
anchorY = -200,
width = 250,
barHeight = 20,
barSpacing = 2,
barTexture = "Blizzard",
borderEnabled = false,
borderColor = { r = 1, g = 1, b = 1, a = 1 },
iconSize = 32,
iconSpacing = 2,
iconCols = 6,
iconOverlay = "sweep",
textAnchor = "below",
fontSize = 12,
font = "Friz Quadrata TT",
fontOutline = "OUTLINE",
growDirection = "DOWN",
showInSolo = false,
showInGroup = true,
showInRaid = false,
enabledSpells = {},
showPlayerName= true,
colorByClass = true,
showChargesOnIcon = true,
showOnlyReady = false,
readySoonSec = 0,
includeSelfFrame = false,
},
trackers = {},
buffEndingAnnouncer = {
enabled = true,
@@ -291,8 +164,8 @@ HMGT.demoModeData = {}
HMGT.versionWarnings = {}
HMGT.versionWhisperWarnings = {}
HMGT.playerStatus = {}
HMGT.debugBuffer = {}
HMGT.debugBufferMax = 500
HMGT.devToolsBuffer = HMGT.devToolsBuffer or {}
HMGT.devToolsBufferMax = HMGT.devToolsBufferMax or 500
HMGT.enabledDebugScopes = {
General = true,
Debug = true,
@@ -332,7 +205,8 @@ local DEBUG_LEVELS = {
function HMGT:IsDebugScopeEnabled(scope)
local normalizedScope = tostring(scope or "General")
local selectedScope = self.db and self.db.profile and self.db.profile.debugScope or DEBUG_SCOPE_ALL
local settings = self.GetDevToolsSettings and self:GetDevToolsSettings() or nil
local selectedScope = settings and settings.scope or DEBUG_SCOPE_ALL
if selectedScope and selectedScope ~= DEBUG_SCOPE_ALL and normalizedScope ~= selectedScope then
return false
end
@@ -496,7 +370,11 @@ function HMGT:GetDebugLevelOptions()
end
function HMGT:GetConfiguredDebugLevel()
local configured = self.db and self.db.profile and self.db.profile.debugLevel or "info"
local settings = self.GetDevToolsSettings and self:GetDevToolsSettings() or nil
local configured = settings and settings.level or "info"
if configured == "trace" then
configured = "verbose"
end
if DEBUG_LEVELS[configured] then
return configured
end
@@ -524,9 +402,8 @@ function HMGT:GetDebugScopeOptions()
for scope in pairs(self.enabledDebugScopes or {}) do
addScope(scope)
end
for _, line in ipairs(self.debugBuffer or {}) do
local scope = tostring(line):match("^%d%d:%d%d:%d%d %[[^%]]+%]%[([^%]]+)%]")
addScope(scope)
for _, entry in ipairs(self.devToolsBuffer or {}) do
addScope(entry and entry.scope)
end
local names = {}
@@ -541,15 +418,19 @@ function HMGT:GetDebugScopeOptions()
end
function HMGT:GetFilteredDebugBuffer()
local selectedLevel = self:GetConfiguredDebugLevel()
local selectedScope = self.db and self.db.profile and self.db.profile.debugScope or DEBUG_SCOPE_ALL
local filtered = {}
for _, line in ipairs(self.debugBuffer or {}) do
local level, scope = tostring(line):match("^%d%d:%d%d:%d%d %[([^%]]+)%]%[([^%]]+)%]")
local normalizedLevel = tostring(level or "INFO"):lower()
local settings = self.GetDevToolsSettings and self:GetDevToolsSettings() or nil
local selectedScope = settings and settings.scope or DEBUG_SCOPE_ALL
for _, entry in ipairs(self.devToolsBuffer or {}) do
local scope = tostring(entry and entry.scope or "General")
local level = tostring(entry and entry.level or "info")
local scopeMatches = (not selectedScope or selectedScope == DEBUG_SCOPE_ALL or scope == selectedScope)
if scopeMatches and self:ShouldIncludeDebugLine(normalizedLevel) then
filtered[#filtered + 1] = line
if scopeMatches and self:ShouldIncludeDebugLine(level) then
if self.FormatDevToolsEntry then
filtered[#filtered + 1] = self:FormatDevToolsEntry(entry)
else
filtered[#filtered + 1] = tostring(entry and entry.message or "")
end
end
end
return filtered
@@ -877,17 +758,22 @@ function HMGT:DebugScoped(level, scope, fmt, ...)
if not ok then
message = tostring(fmt or "")
end
local line = string.format("%s [%s][%s] %s", date("%H:%M:%S"), string.upper(normalizedLevel), normalizedScope, tostring(message or ""))
self.debugBuffer = self.debugBuffer or {}
self.debugBuffer[#self.debugBuffer + 1] = line
local maxLines = tonumber(self.debugBufferMax) or 500
while #self.debugBuffer > maxLines do
table.remove(self.debugBuffer, 1)
if self.RecordDebugEntry then
self:RecordDebugEntry(normalizedLevel, normalizedScope, tostring(message or ""))
return
end
if self.debugWindow and self.debugWindow.IsShown and self.debugWindow:IsShown() and self.RefreshDebugWindow then
self:RefreshDebugWindow()
self.devToolsBuffer = self.devToolsBuffer or {}
self.devToolsBuffer[#self.devToolsBuffer + 1] = {
stamp = date("%H:%M:%S"),
level = normalizedLevel,
scope = normalizedScope,
message = tostring(message or ""),
kind = "debug",
}
local maxLines = tonumber(self.devToolsBufferMax) or 500
while #self.devToolsBuffer > maxLines do
table.remove(self.devToolsBuffer, 1)
end
end
@@ -1797,52 +1683,53 @@ end
function HMGT:MigrateProfileSettings()
local p = self.db and self.db.profile
if not p then return end
p.debug = false
if p.debugLevel ~= "error" and p.debugLevel ~= "info" and p.debugLevel ~= "verbose" then
p.debugLevel = "info"
end
if type(p.debugScope) ~= "string" or p.debugScope == "" then
p.debugScope = DEBUG_SCOPE_ALL
end
local oldDebugEnabled = p.debug == true
local oldDebugLevel = p.debugLevel
local oldDebugScope = p.debugScope
p.devTools = type(p.devTools) == "table" and p.devTools or {}
p.devTools.enabled = p.devTools.enabled == true
if p.devTools.level ~= "error" and p.devTools.level ~= "trace" then
p.devTools.level = "error"
p.devTools.enabled = p.devTools.enabled == true or oldDebugEnabled
if p.devTools.level == "trace" then
p.devTools.level = "verbose"
elseif p.devTools.level ~= "error" and p.devTools.level ~= "info" and p.devTools.level ~= "verbose" then
p.devTools.level = (oldDebugLevel == "error" or oldDebugLevel == "info" or oldDebugLevel == "verbose")
and oldDebugLevel
or "info"
end
if type(p.devTools.scope) ~= "string" or p.devTools.scope == "" then
p.devTools.scope = "ALL"
p.devTools.scope = (type(oldDebugScope) == "string" and oldDebugScope ~= "") and oldDebugScope or "ALL"
end
p.devTools.window = type(p.devTools.window) == "table" and p.devTools.window or {}
p.devTools.window.width = math.max(720, tonumber(p.devTools.window.width) or 920)
p.devTools.window.height = math.max(260, tonumber(p.devTools.window.height) or 420)
p.devTools.window.minimized = p.devTools.window.minimized == true
p.debug = nil
p.debugLevel = nil
p.debugScope = nil
p.syncRemoteCharges = true
if p.interruptTracker then
NormalizeBorderSettings(p.interruptTracker)
NormalizeAnchorSettings(p.interruptTracker)
NormalizeTrackerLayout(p.interruptTracker, false, true)
end
if p.raidCooldownTracker then
NormalizeBorderSettings(p.raidCooldownTracker)
NormalizeAnchorSettings(p.raidCooldownTracker)
NormalizeTrackerLayout(p.raidCooldownTracker, false, true)
end
if p.groupCooldownTracker then
NormalizeBorderSettings(p.groupCooldownTracker)
NormalizeAnchorSettings(p.groupCooldownTracker)
NormalizeTrackerLayout(p.groupCooldownTracker, true, true)
end
if type(p.trackers) ~= "table" then
p.trackers = {}
end
if #p.trackers == 0 and p.trackerModelVersion ~= TRACKER_MODEL_VERSION then
local legacyInterrupt = type(p.interruptTracker) == "table" and p.interruptTracker or {}
local legacyRaid = type(p.raidCooldownTracker) == "table" and p.raidCooldownTracker or {}
local legacyGroup = type(p.groupCooldownTracker) == "table" and p.groupCooldownTracker or {}
NormalizeBorderSettings(legacyInterrupt)
NormalizeAnchorSettings(legacyInterrupt)
NormalizeTrackerLayout(legacyInterrupt, false, true)
NormalizeBorderSettings(legacyRaid)
NormalizeAnchorSettings(legacyRaid)
NormalizeTrackerLayout(legacyRaid, false, true)
NormalizeBorderSettings(legacyGroup)
NormalizeAnchorSettings(legacyGroup)
NormalizeTrackerLayout(legacyGroup, true, true)
p.trackers = {
self:BuildTrackerConfigFromPreset("interruptTracker", 1, CopyTrackerFields({}, p.interruptTracker or {})),
self:BuildTrackerConfigFromPreset("raidCooldownTracker", 2, CopyTrackerFields({}, p.raidCooldownTracker or {})),
self:BuildTrackerConfigFromPreset("groupCooldownTracker", 3, CopyTrackerFields({}, p.groupCooldownTracker or {})),
self:BuildTrackerConfigFromPreset("interruptTracker", 1, CopyTrackerFields({}, legacyInterrupt)),
self:BuildTrackerConfigFromPreset("raidCooldownTracker", 2, CopyTrackerFields({}, legacyRaid)),
self:BuildTrackerConfigFromPreset("groupCooldownTracker", 3, CopyTrackerFields({}, legacyGroup)),
}
end
@@ -1864,6 +1751,9 @@ function HMGT:MigrateProfileSettings()
end
p.trackers = normalizedTrackers
p.trackerModelVersion = TRACKER_MODEL_VERSION
p.interruptTracker = nil
p.raidCooldownTracker = nil
p.groupCooldownTracker = nil
p.mapOverlay = p.mapOverlay or {}
NormalizeMapOverlaySettings(p.mapOverlay)
@@ -2820,7 +2710,7 @@ end
--- Gibt true zurück wenn ein Tracker laut seinen Einstellungen
--- im aktuellen Gruppen-Kontext angezeigt werden soll.
--- @param settings table db.profile.interruptTracker / raidCooldownTracker
--- @param settings table tracker config from db.profile.trackers
function HMGT:IsVisibleForCurrentGroup(settings)
if not settings.enabled then return false end
@@ -3056,6 +2946,116 @@ function HMGT:CreateLegacyMinimapButton()
end
end
local function CountTableEntries(tbl)
local count = 0
for _ in pairs(tbl or {}) do
count = count + 1
end
return count
end
function HMGT:GetHealthStatusLines()
local lines = {}
lines[#lines + 1] = "HMGT status"
lines[#lines + 1] = string.format(
"Version: addon=%s build=%s channel=%s protocol=%s",
tostring(self.ADDON_VERSION or "dev"),
tostring(self.BUILD_VERSION or self.ADDON_VERSION or "dev"),
tostring(self.RELEASE_CHANNEL or "stable"),
tostring(self.PROTOCOL_VERSION or "?")
)
local groupType = "solo"
local groupMembers = 1
if IsInRaid() then
groupType = "raid"
groupMembers = GetNumGroupMembers()
elseif IsInGroup() then
groupType = "party"
groupMembers = GetNumGroupMembers()
end
lines[#lines + 1] = string.format("Group: type=%s members=%d", groupType, tonumber(groupMembers) or 1)
local trackers = self:GetTrackerConfigs()
local enabledTrackers = 0
local normalTrackers = 0
local groupTrackers = 0
for _, tracker in ipairs(trackers) do
if tracker.enabled ~= false then
enabledTrackers = enabledTrackers + 1
end
if self:IsGroupTrackerConfig(tracker) then
groupTrackers = groupTrackers + 1
else
normalTrackers = normalTrackers + 1
end
end
lines[#lines + 1] = string.format(
"Trackers: total=%d enabled=%d normal=%d group=%d model=%s",
#trackers,
enabledTrackers,
normalTrackers,
groupTrackers,
tostring(self.db and self.db.profile and self.db.profile.trackerModelVersion or "?")
)
local profile = self.db and self.db.profile or {}
local legacyCount = 0
if profile.interruptTracker ~= nil then legacyCount = legacyCount + 1 end
if profile.raidCooldownTracker ~= nil then legacyCount = legacyCount + 1 end
if profile.groupCooldownTracker ~= nil then legacyCount = legacyCount + 1 end
lines[#lines + 1] = string.format("Legacy profile keys: %d", legacyCount)
local devSettings = self.GetDevToolsSettings and self:GetDevToolsSettings() or {}
lines[#lines + 1] = string.format(
"Debug: enabled=%s level=%s scope=%s lines=%d",
tostring(devSettings.enabled == true),
tostring(devSettings.level or "info"),
tostring(devSettings.scope or "ALL"),
#(self.devToolsBuffer or {})
)
local activeCooldownPlayers = CountTableEntries(self.activeCDs)
local playerDataCount = CountTableEntries(self.playerData)
lines[#lines + 1] = string.format(
"Tracker state: players=%d cooldownPlayers=%d pendingReliable=%d",
playerDataCount,
activeCooldownPlayers,
CountTableEntries(self.pendingReliableMessages)
)
local modules = {
Tracker = self.TrackerManager ~= nil,
AuraExpiry = self.AuraExpiry ~= nil,
MapOverlay = self.MapOverlay ~= nil,
RaidTimeline = self.RaidTimeline ~= nil,
Notes = self.Notes ~= nil,
}
local moduleParts = {}
for name, loaded in pairs(modules) do
moduleParts[#moduleParts + 1] = string.format("%s=%s", name, loaded and "loaded" or "missing")
end
table.sort(moduleParts)
lines[#lines + 1] = "Modules: " .. table.concat(moduleParts, ", ")
local bridge = _G.HMGT_Bridge
lines[#lines + 1] = string.format("Bridge: %s", bridge and "loaded" or "not loaded")
if bridge and type(bridge.GetStatusLines) == "function" then
local statusLines = bridge:GetStatusLines()
for index = 1, math.min(3, #(statusLines or {})) do
lines[#lines + 1] = "Bridge " .. tostring(index) .. ": " .. tostring(statusLines[index])
end
end
return lines
end
function HMGT:PrintHealthStatus()
for _, line in ipairs(self:GetHealthStatusLines()) do
self:Print(line)
end
end
function HMGT:SlashCommand(input)
input = input:trim():lower()
if input == "lock" then
@@ -3092,6 +3092,8 @@ function HMGT:SlashCommand(input)
else
self:Print("HMGT Bridge is not loaded.")
end
elseif input == "status" then
self:PrintHealthStatus()
elseif input == "debug" then
if self.ToggleDevToolsWindow then
self:ToggleDevToolsWindow()