Fix up config to comply with meta

Update
This commit is contained in:
2025-05-04 23:33:14 +02:00
parent e676d53e97
commit c1885ce76a
12 changed files with 89 additions and 76 deletions

View File

@@ -140,6 +140,7 @@ local function init()
---@field kickOffline boolean
---@field cleanupInterval number
---@field afkThreshold number
---@field listeningChannel table<string, boolean>
---@class HeimdallDuelerConfig
---@field enabled boolean
@@ -234,6 +235,7 @@ local function init()
---@field enabled boolean
---@field debug boolean
---@field channels string[]
---@field lastNotes number
---@class HeimdallNetworkConfig
---@field enabled boolean
@@ -371,6 +373,7 @@ local function init()
kickOffline = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "kickOffline" }, false),
cleanupInterval = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "cleanupInterval" }, 10),
afkThreshold = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "afkThreshold" }, 300),
listeningChannel = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "listeningChannel" }, {}),
},
dueler = {
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "dueler", "enabled" }, false),

2
Meta

Submodule Meta updated: ba1f7e14bf...3f65afd97a

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local _, shared = ...
---@cast shared HeimdallShared
---@cast addonname string
---@param str string
---@return table<string, boolean>
@@ -149,15 +148,15 @@ GridFrame = {
rowspan = rowspan,
parent = self,
}
---@diagnostic disable-next-line: inject-field, redefined-local
frame.SetPos = function(self)
if not self.gridData then return end
local parent = self.gridData.parent
local x = (self.gridData.column - 1) * parent.cellWidth
local y = -(self.gridData.row * parent.cellHeight)
self:SetPoint("TOPLEFT", parent.frame, "TOPLEFT", x, y)
self:SetWidth(parent.cellWidth * self.gridData.colspan)
self:SetHeight(parent.cellHeight * self.gridData.rowspan)
---@diagnostic disable-next-line: inject-field
frame.SetPos = function(selff)
if not selff.gridData then return end
local parent = selff.gridData.parent
local x = (selff.gridData.column - 1) * parent.cellWidth
local y = -(selff.gridData.row * parent.cellHeight)
selff:SetPoint("TOPLEFT", parent.frame, "TOPLEFT", x, y)
selff:SetWidth(parent.cellWidth * selff.gridData.colspan)
selff:SetHeight(parent.cellHeight * selff.gridData.rowspan)
end
frame.SetPos(frame)
@@ -262,7 +261,7 @@ StaticGridFrame = {
return self
end,
---@param self StaticGridFrame
---@param frame Frame
---@param frame Region
---@param rowspan number
---@param colspan number
Add = function(self, frame, rowspan, colspan)
@@ -295,7 +294,9 @@ StaticGridFrame = {
frame:SetWidth(self.cellWidth * colspan)
frame:SetHeight(self.cellHeight * rowspan)
frame:SetPoint("TOPLEFT", self.frame, "TOPLEFT", x, y)
frame:SetParent(self.frame)
-- Region should have set parent...
---@diagnostic disable-next-line: undefined-field
if frame.SetParent then frame:SetParent(self.frame) end
for r = row, row + rowspan - 1 do
for c = col, col + colspan - 1 do
self.occupancy[r][c] = true
@@ -312,8 +313,8 @@ StaticGridFrame = {
self.frame:SetMovable(true)
self.frame:EnableMouse(true)
self.frame:RegisterForDrag("LeftButton")
self.frame:SetScript("OnDragStart", function(self) self:StartMoving() end)
self.frame:SetScript("OnDragStop", function(self) self:StopMovingOrSizing() end)
self.frame:SetScript("OnDragStart", function(selff) selff:StartMoving() end)
self.frame:SetScript("OnDragStop", function(selff) selff:StopMovingOrSizing() end)
end,
Recalculate = function(self)
for _, frame in pairs(self.frame:GetChildren()) do
@@ -460,18 +461,23 @@ function shared.Config.Init()
---@param name string
---@param parent Frame
---@param text string
---@param onDone fun(editBox: Frame)
---@param onDone fun(editBox: EditBox)
---@return GridFrame
local function CreateBasicSmallEditBox(name, parent, text, initialValue, onDone)
local container = GridFrame.new(name, parent, 1, 1)
---@type Frame
local editBoxFrame = CreateFrame("Frame", name .. "EditBoxFrame", container.frame)
---@type EditBox
local editBox = CreateFrame("EditBox", name .. "EditBox", editBoxFrame)
---@type Frame
local textFrame = CreateFrame("Frame", name .. "TextFrame", container.frame)
---@type FontString
local textElement = textFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
textElement:SetText(text)
editBox:SetAutoFocus(false)
editBox:SetFontObject("GameFontNormal")
editBox:SetText(Heimdall_Data.config.spotter.throttleTime)
editBox:SetText("")
editBox:SetBackdrop({
bgFile = "Interface/Tooltips/UI-Tooltip-Background",
edgeFile = "Interface/Tooltips/UI-Tooltip-Border",
@@ -500,12 +506,17 @@ function shared.Config.Init()
---@param name string
---@param parent Frame
---@param text string
---@param onDone fun(editBox: Frame)
---@param onDone fun(editBox: EditBox)
---@return GridFrame
local function CreateBasicBigEditBox(name, parent, text, initialValue, onDone)
local container = GridFrame.new(name, parent, 1, 100)
---@type Frame
local editBoxFrame = CreateFrame("Frame", name .. "EditBoxFrame", container.frame)
---@type EditBox
local editBox = CreateFrame("EditBox", name .. "EditBox", editBoxFrame)
---@type Frame
local textFrame = CreateFrame("Frame", name .. "TextFrame", container.frame)
---@type FontString
local textElement = textFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal")
textElement:SetText(text)
@@ -553,7 +564,7 @@ function shared.Config.Init()
configFrame.frame:SetScale(Heimdall_Data.config.scale)
else
print(string.format("Invalid scale: %s, please use numbers", text))
self:SetText(Heimdall_Data.config.scale)
self:SetText(tostring(Heimdall_Data.config.scale))
end
end
)
@@ -581,7 +592,7 @@ function shared.Config.Init()
shared._L("english", Heimdall_Data.config.locale),
function()
Heimdall_Data.config.locale = "en"
russian:UpdateColor(false)
if russian then russian:UpdateColor(false) end
return Heimdall_Data.config.locale == "en"
end
)
@@ -607,7 +618,7 @@ function shared.Config.Init()
spotterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(spotterConfigFrame, 9, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallSpotterConfigTitle",
spotterConfigFrame.frame,
shared._L("spotter", Heimdall_Data.config.locale),
@@ -743,7 +754,7 @@ function shared.Config.Init()
whoerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(whoerConfigFrame, 30, 6)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallWhoerConfigTitle",
whoerConfigFrame.frame,
shared._L("whoer", Heimdall_Data.config.locale),
@@ -862,7 +873,7 @@ function shared.Config.Init()
messengerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(messengerConfigFrame, 6, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallMessengerConfigTitle",
messengerConfigFrame.frame,
shared._L("messenger", Heimdall_Data.config.locale),
@@ -905,7 +916,7 @@ function shared.Config.Init()
print("Interval set to", tostring(text))
else
print("Invalid interval", tostring(text))
self:SetText(Heimdall_Data.config.messenger.interval)
self:SetText(tostring(Heimdall_Data.config.messenger.interval))
end
end
)
@@ -919,7 +930,7 @@ function shared.Config.Init()
deathReporterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(deathReporterConfigFrame, 10, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallDeathReporterConfigTitle",
deathReporterConfigFrame.frame,
shared._L("deathReporter", Heimdall_Data.config.locale),
@@ -974,7 +985,7 @@ function shared.Config.Init()
print("Throttle time set to", tostring(text))
else
print("Invalid throttle time", tostring(text))
self:SetText(Heimdall_Data.config.deathReporter.throttle)
self:SetText(tostring(Heimdall_Data.config.deathReporter.throttle))
end
end
)
@@ -1038,7 +1049,7 @@ function shared.Config.Init()
inviterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(inviterConfigFrame, 13, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallInviterConfigTitle",
inviterConfigFrame.frame,
shared._L("inviter", Heimdall_Data.config.locale),
@@ -1196,7 +1207,7 @@ function shared.Config.Init()
duelerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(duelerConfigFrame, 4, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallDuelerConfigTitle",
duelerConfigFrame.frame,
shared._L("dueler", Heimdall_Data.config.locale),
@@ -1247,7 +1258,7 @@ function shared.Config.Init()
agentTrackerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(agentTrackerConfigFrame, 5, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallAgentTrackerConfigTitle",
agentTrackerConfigFrame.frame,
shared._L("agentTracker", Heimdall_Data.config.locale),
@@ -1300,7 +1311,7 @@ function shared.Config.Init()
stinkyTrackerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(stinkyTrackerConfigFrame, 5, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallStinkyTrackerConfigTitle",
stinkyTrackerConfigFrame.frame,
shared._L("stinkyTracker", Heimdall_Data.config.locale),
@@ -1353,7 +1364,7 @@ function shared.Config.Init()
emoterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(emoterConfigFrame, 7, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallEmoterConfigTitle",
emoterConfigFrame.frame,
shared._L("emoter", Heimdall_Data.config.locale),
@@ -1424,7 +1435,7 @@ function shared.Config.Init()
echoerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(echoerConfigFrame, 7, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallEchoerConfigTitle",
echoerConfigFrame.frame,
shared._L("echoer", Heimdall_Data.config.locale),
@@ -1495,7 +1506,7 @@ function shared.Config.Init()
commanderConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(commanderConfigFrame, 10, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallCommanderConfigTitle",
commanderConfigFrame.frame,
shared._L("commander", Heimdall_Data.config.locale),
@@ -1578,7 +1589,7 @@ function shared.Config.Init()
macroerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(macroerConfigFrame, 6, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallMacroerConfigTitle",
macroerConfigFrame.frame,
shared._L("macroer", Heimdall_Data.config.locale),
@@ -1629,7 +1640,7 @@ function shared.Config.Init()
combatAlerterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(combatAlerterConfigFrame, 5, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallCombatAlerterConfigTitle",
combatAlerterConfigFrame.frame,
shared._L("combatAlerter", Heimdall_Data.config.locale),
@@ -1682,7 +1693,7 @@ function shared.Config.Init()
snifferConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(snifferConfigFrame, 8, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallSnifferConfigTitle",
snifferConfigFrame.frame,
shared._L("sniffer", Heimdall_Data.config.locale),
@@ -1783,7 +1794,7 @@ function shared.Config.Init()
bonkDetectorConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(bonkDetectorConfigFrame, 7, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallBonkDetectorConfigTitle",
bonkDetectorConfigFrame.frame,
shared._L("bonkDetector", Heimdall_Data.config.locale),
@@ -1855,7 +1866,7 @@ function shared.Config.Init()
minimapTaggerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(minimapTaggerConfigFrame, 18, 6)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallMinimapTaggerConfigTitle",
minimapTaggerConfigFrame.frame,
shared._L("minimapTagger", Heimdall_Data.config.locale),
@@ -1900,7 +1911,7 @@ function shared.Config.Init()
)
minimapTaggerConfigFrame:Add(channels, 2, 3)
local scale = CreateBasicSmallEditBox(
scale = CreateBasicSmallEditBox(
"HeimdallMinimapTaggerConfigScale",
minimapTaggerConfigFrame.frame,
shared._L("scale", Heimdall_Data.config.locale),
@@ -2223,7 +2234,7 @@ function shared.Config.Init()
noterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(noterConfigFrame, 7, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallNoterConfigTitle",
noterConfigFrame.frame,
shared._L("noter", Heimdall_Data.config.locale),
@@ -2296,7 +2307,7 @@ function shared.Config.Init()
networkConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(networkConfigFrame, 11, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallNetworkConfigTitle",
networkConfigFrame.frame,
shared._L("network", Heimdall_Data.config.locale),
@@ -2368,7 +2379,7 @@ function shared.Config.Init()
networkMessengerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(networkMessengerConfigFrame, 5, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallNetworkMessengerConfigTitle",
networkMessengerConfigFrame.frame,
shared._L("networkMessenger", Heimdall_Data.config.locale),
@@ -2426,7 +2437,7 @@ function shared.Config.Init()
achievementSnifferConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(achievementSnifferConfigFrame, 14, 3)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallAchievementSnifferConfigTitle",
achievementSnifferConfigFrame.frame,
shared._L("achievementSniffer", Heimdall_Data.config.locale),
@@ -2538,7 +2549,7 @@ function shared.Config.Init()
addonPrefixConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(addonPrefixConfigFrame, 5, 1)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallAddonPrefixConfigTitle",
addonPrefixConfigFrame.frame,
shared._L("addonPrefix", Heimdall_Data.config.locale),
@@ -2566,7 +2577,7 @@ function shared.Config.Init()
whisperNotifyConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(whisperNotifyConfigFrame, 14, 1)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallWhisperNotifyConfigTitle",
whisperNotifyConfigFrame.frame,
shared._L("whisperNotify", Heimdall_Data.config.locale),
@@ -2596,7 +2607,7 @@ function shared.Config.Init()
-- Why do 17 rows of content fit into a frame that is 14 rows?
-- I don't know, at this point I can't be fucked to fix it, the display is minimally functional
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallStinkiesConfigTitle",
stinkiesConfigFrame.frame,
shared._L("stinkies", Heimdall_Data.config.locale),
@@ -2624,7 +2635,7 @@ function shared.Config.Init()
channelLocaleConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
configFrame:Add(channelLocaleConfigFrame, 14, 1)
local title = CreateFancyText(
title = CreateFancyText(
"HeimdallChannelLocaleConfigTitle",
channelLocaleConfigFrame.frame,
shared._L("channelLocale", Heimdall_Data.config.locale),

View File

@@ -1,8 +1,7 @@
local addonname, shared = ...
local _, shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Configurator"
---@diagnostic disable-next-line: missing-fields
shared.Configurator = {}
function shared.Configurator.Init() print("[Heimdall] Configurator module loaded") end
function shared.Configurator.Init() print(string.format("[Heimdall] %s module loaded", ModuleName)) end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local _, shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "DeathReporter"
---@diagnostic disable-next-line: missing-fields
@@ -183,32 +182,33 @@ function shared.DeathReporter.Init()
-- print(string.format("[%s] Received combat log event", ModuleName))
-- end
if not Heimdall_Data.config.deathReporter.enabled then return end
local overkill, err = CLEUParser.GetOverkill(...)
local overkill, source, destination, spellName, sourceGUID, destinationGUID, err
overkill, err = CLEUParser.GetOverkill(...)
if not err and overkill > 0 then
local source, err = CLEUParser.GetSourceName(...)
source, err = CLEUParser.GetSourceName(...)
if err then
source = "unknown"
if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Error getting source name", ModuleName))
end
end
local destination, err = CLEUParser.GetDestName(...)
destination, err = CLEUParser.GetDestName(...)
if err then
destination = "unknown"
if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Error getting destination name", ModuleName))
end
end
local spellName, err = CLEUParser.GetSpellName(...)
spellName, err = CLEUParser.GetSpellName(...)
if err then
spellName = "unknown"
if Heimdall_Data.config.deathReporter.debug then
print(string.format("[%s] Error getting spell name", ModuleName))
end
end
local sourceGUID, err = CLEUParser.GetSourceGUID(...)
sourceGUID, err = CLEUParser.GetSourceGUID(...)
if err or not string.match(sourceGUID, "Player") then return end
local destinationGUID, err = CLEUParser.GetDestGUID(...)
destinationGUID, err = CLEUParser.GetDestGUID(...)
if err or not string.match(destinationGUID, "Player") then return end
RegisterDeath(source, destination, spellName)
end

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local _, shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Dueler"
---@diagnostic disable-next-line: missing-fields

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local _, shared = ...
---@cast shared HeimdallShared
---@cast addonname string
if not shared.dumpTable then
---@param table table

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local _, shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Echoer"
---@diagnostic disable-next-line: missing-fields
@@ -44,11 +43,11 @@ function shared.Echoer.Init()
if Heimdall_Data.config.echoer.debug then
print(string.format("[%s] Found echo command in message: %s", ModuleName, msg))
end
local msg = string.sub(msg, string.len(Heimdall_Data.config.echoer.prefix) + 1)
local echomsg = string.sub(msg, string.len(Heimdall_Data.config.echoer.prefix) + 1)
if Heimdall_Data.config.echoer.debug then
print(string.format("[%s] Echoing message: %s", ModuleName, msg))
print(string.format("[%s] Echoing message: %s", ModuleName, echomsg))
end
SendChatMessage(msg, "SAY")
SendChatMessage(echomsg, "SAY")
elseif Heimdall_Data.config.echoer.debug then
print(string.format("[%s] Message does not start with echo prefix", ModuleName))
end

View File

@@ -1,11 +1,11 @@
local addonname, shared = ...
local _, shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Inviter"
---@diagnostic disable-next-line: missing-fields
shared.Inviter = {}
function shared.Inviter.Init()
-- Fallback for old config
if type(Heimdall_Data.config.inviter.listeningChannel) == "string" then
Heimdall_Data.config.inviter.listeningChannel = {
[Heimdall_Data.config.inviter.listeningChannel] = true,
@@ -102,13 +102,18 @@ function shared.Inviter.Init()
local frame = FindPlayerRaidFrame(name)
if frame then
playerButtons[name] = frame
-- All of these are ELVUI specific so they won't be in our meta...
---@diagnostic disable-next-line: undefined-field
local button = framePool[frame.unit]
or CreateFrame(
"Button",
---@diagnostic disable-next-line: undefined-field
string.format("HeimdallKickButton%s", frame.unit, frame, "SecureActionButtonTemplate")
)
---@diagnostic disable-next-line: undefined-field
framePool[frame.unit] = button
---@diagnostic disable-next-line: undefined-field
button:SetSize(frame.UNIT_WIDTH / 2, frame.UNIT_HEIGHT / 2)
button:SetPoint("CENTER", frame, "CENTER", 0, 0)
button:SetNormalTexture("Interface\\Buttons\\UI-GroupLoot-KickIcon")

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local _, shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Macroer"
---@diagnostic disable-next-line: missing-fields
@@ -82,6 +81,7 @@ function shared.Macroer.Init()
end
local idx = FindOrCreateMacro("HeimdallTarget")
---@diagnostic disable-next-line: param-type-mismatch
local body = strjoin("\n", unpack(lines))
if Heimdall_Data.config.macroer.debug then
print(string.format("[%s] Updating macro with %d lines", ModuleName, #lines))

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local _, shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "Messenger"
---@diagnostic disable-next-line: missing-fields

View File

@@ -1,6 +1,5 @@
local addonname, shared = ...
local _, shared = ...
---@cast shared HeimdallShared
---@cast addonname string
local ModuleName = "MinimapTagger"
local HeimdallRoot = "Interface\\AddOns\\Heimdall\\"
local SoundRoot = HeimdallRoot .. "Sounds\\"