local addonname, shared = ... ---@cast shared HeimdallShared ---@cast addonname string ---@param str string ---@return table local function StringToMap(str, deliminer) if not str then return {} end local map = {} local parts = { strsplit(deliminer, str) } for _, line in ipairs(parts) do line = strtrim(line) if line ~= "" then map[line] = true end end return map end ---@param str string ---@return string[] local function StringToArray(str, deliminer) if not str then return {} end local ret = {} local array = { strsplit(deliminer, str) } for i, line in ipairs(array) do line = strtrim(line) if line ~= "" then ret[i] = line end end return ret end ---@param map table ---@param deliminer string ---@return string local function MapKeyToString(map, deliminer) local str = "" for k, _ in pairs(map) do str = str .. k .. deliminer end return str end ---@param map table ---@param deliminer string ---@return string local function MapValueToString(map, deliminer) local str = "" for _, v in pairs(map) do str = str .. tostring(v) .. deliminer end return str end ---@class GridFrame:Frame ---@field name string ---@field columns number ---@field frame Frame ---@field cellWidth number ---@field cellHeight number ---@field columnHeights table GridFrame = { ---@param name string ---@param parent Frame ---@param columns number ---@param cellHeight number ---@param size {w: number, h:number}? ---@return GridFrame new = function(name, parent, columns, cellHeight, size) local self = setmetatable({}, { __index = GridFrame }) self.frame = CreateFrame("Frame", name, parent) size = size or {} if size.w then self.frame:SetWidth(size.w) end if size.h then self.frame:SetHeight(size.h) end self.allowOverflow = false self.frame:SetPoint("CENTER", parent, "CENTER") self.frame:SetBackdrop({ bgFile = "Interface/Tooltips/UI-Tooltip-Background", tileSize = 64, tile = true }) self.frame:SetBackdropColor(0, 0, 0, 0.8) self.frame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1) self.columns = columns self.cellWidth = self.frame:GetWidth() / columns self.cellHeight = cellHeight self.columnHeights = {} for i = 1, columns do self.columnHeights[i] = 0 end return self end, ---@param self GridFrame ---@param frame Frame ---@param rowspan number ---@param colspan number Add = function(self, frame, rowspan, colspan) colspan = math.min(colspan, self.columns) local bestColumn = nil local bestRow = math.huge for startColumn = 1, self.columns - colspan + 1 do local currentMaxY = 0 for c = startColumn, startColumn + colspan - 1 do currentMaxY = math.max(currentMaxY, self.columnHeights[c]) end if currentMaxY < bestRow then bestRow = currentMaxY bestColumn = startColumn end end if bestColumn then frame:SetParent(self.frame) frame.gridData = { row = bestRow, column = bestColumn, colspan = colspan, rowspan = rowspan, parent = self } 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) end frame.SetPos(frame) for c = bestColumn, bestColumn + colspan - 1 do self.columnHeights[c] = self.columnHeights[c] + rowspan end else print("No available space in the grid.") end end, Recalculate = function(self) local children = { self.frame:GetChildren() } for _, child in pairs(children) do if child.gridData then child:SetPos() -- else -- print("Child has no grid data", child) end end end, SetWidth = function(self, width) self.frame:SetWidth(width) self.cellWidth = width / self.columns self:Recalculate() end, SetHeight = function(self, height) self.frame:SetHeight(height) local tallestRow = 0 for _, height in pairs(self.columnHeights) do tallestRow = math.max(tallestRow, height) end if tallestRow > 0 then self.cellHeight = height / tallestRow end self:Recalculate() end, SetPoint = function(self, point, relativeTo, relativePoint, offsetX, offsetY) self.frame:SetPoint(point, relativeTo, relativePoint, offsetX, offsetY) self:Recalculate() end, SetParent = function(self, parent) self.frame:SetParent(parent) self:Recalculate() end } ---@class StaticGridFrame ---@field name string ---@field rows number ---@field columns number ---@field frame Frame ---@field cellWidth number ---@field cellHeight number ---@field occupancy table> StaticGridFrame = { ---@param name string ---@param parent Frame ---@param rows number ---@param columns number ---@param size {w: number, h:number}? ---@return StaticGridFrame new = function(name, parent, rows, columns, size) local self = setmetatable({}, { __index = StaticGridFrame }) size = size or {} self.frame = CreateFrame("Frame", name, parent) self.frame:SetWidth(columns * 128) self.frame:SetHeight(rows * 128) self.frame:SetPoint("CENTER", UIParent, "CENTER") self.frame:SetBackdrop({ bgFile = "Interface/Tooltips/UI-Tooltip-Background", tileSize = 64, tile = true }) self.frame:SetBackdropColor(0, 0, 0, 0.8) self.frame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1) if size.w then self.frame:SetWidth(size.w) end if size.h then self.frame:SetHeight(size.h) end self.rows = rows self.columns = columns self.cellWidth = self.frame:GetWidth() / columns self.cellHeight = self.frame:GetHeight() / rows self.occupancy = {} for row = 1, rows do self.occupancy[row] = {} for column = 1, columns do self.occupancy[row][column] = false end end return self end, ---@param self StaticGridFrame ---@param frame Frame ---@param rowspan number ---@param colspan number Add = function(self, frame, rowspan, colspan) if rowspan > self.rows or colspan > self.columns then print("Rowspan or colspan exceeds grid dimensions.") return end for row = 1, self.rows do for col = 1, self.columns do if not self.occupancy[row][col] then local canPlace = true for r = row, row + rowspan - 1 do for c = col, col + colspan - 1 do -- Check if r or c is out of bounds or if the cell is occupied if r > self.rows or c > self.columns or self.occupancy[r][c] then canPlace = false break end end if not canPlace then break end end if canPlace then local x = (col - 1) * self.cellWidth local y = -(row - 1) * self.cellHeight frame.colspan = colspan frame.rowspan = rowspan frame:SetWidth(self.cellWidth * colspan) frame:SetHeight(self.cellHeight * rowspan) frame:SetPoint("TOPLEFT", self.frame, "TOPLEFT", x, y) frame:SetParent(self.frame) for r = row, row + rowspan - 1 do for c = col, col + colspan - 1 do self.occupancy[r][c] = true end end return end end end end print("No available space in the grid.") end, MakeMovable = function(self) 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) end, Recalculate = function(self) for _, frame in pairs(self.frame:GetChildren()) do if frame.colspan then frame:SetWidth(self.cellWidth * frame.colspan) end if frame.rowspan then frame:SetHeight(self.cellHeight * frame.rowspan) end end end, SetWidth = function(self, width) self.frame:SetWidth(width) self.cellWidth = width / self.columns self:Recalculate() end, SetHeight = function(self, height) self.frame:SetHeight(height) self.cellHeight = height / self.rows self:Recalculate() end, SetPoint = function(self, point, relativeTo, relativePoint, offsetX, offsetY) self.frame:SetPoint(point, relativeTo, relativePoint, offsetX, offsetY) self:Recalculate() end, SetParent = function(self, parent) self.frame:SetParent(parent) self:Recalculate() end } local configFrame = StaticGridFrame.new("HeimdallConfig", UIParent, 80, 12, { w = 1024 + 512, h = 1024 }) configFrame:MakeMovable() configFrame.frame:SetScript("OnKeyUp", function(self, key) if key == "ESCAPE" then self:Hide() end end) local colorIndex = 1 local colors = { { 1, 0, 0, 1 }, -- Red { 0, 1, 0, 1 }, -- Green { 0, 0, 1, 1 }, -- Blue { 1, 1, 0, 1 }, -- Yellow { 1, 0, 1, 1 }, -- Magenta { 0, 1, 1, 1 }, -- Cyan { 1, 1, 1, 1 }, -- White { 1, 0.5, 0, 1 }, -- Orange { 0.5, 0, 1, 1 }, -- Purple { 1, 0.5, 0.5, 1 }, -- Pink { 0.6, 0.4, 0.2, 1 }, -- Brown { 0.5, 1, 0.5, 1 }, -- Light Green { 1, 0.8, 0, 1 }, -- Dark Orange { 0.8, 0, 1, 1 }, -- Dark Purple { 0.13, 0.55, 0.13, 1 }, -- Olive Green { 0, 0, 0.5, 1 }, -- Navy Blue { 1, 0.5, 0.3, 1 }, -- Coral { 0, 0.5, 0.5, 1 }, -- Teal { 0.9, 0.7, 1, 1 }, -- Lavender { 0.5, 0, 0, 1 }, -- Maroon { 1, 0.84, 0, 1 }, -- Gold { 0.44, 0.52, 0.57, 1 }, -- Slate Gray { 1, 0.41, 0.71, 1 }, -- Hot Pink { 0.91, 0.48, 0.2, 1 } -- Burnt Sienna } local GetNextColor = function() local color = colors[colorIndex] colorIndex = colorIndex + 1 if colorIndex > #colors then colorIndex = 1 end return unpack(color) end --HeimdallTestFrame = GridFrame.new("HeimdallPartyFrame", UIParent, 12, 20, { w = 1024, h = 1024 }) --for i = 1, 10 do -- local frame = CreateFrame("Frame", "HeimdallPartyFrame" .. i, UIParent) -- frame:SetBackdrop({ -- bgFile = "Interface/Tooltips/UI-Tooltip-Background", -- tileSize = 64, -- tile = true -- }) -- frame:SetBackdropColor(unpack(colors[i % #colors + 1])) -- frame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1) -- HeimdallTestFrame:Add(frame, 4, 2) --end --HeimdallTestFrame:SetHeight(128) --HeimdallTestFrame:SetWidth(512) --configFrame:Add(HeimdallTestFrame, 20, 12) ---@diagnostic disable-next-line: missing-fields shared.Config = {} function shared.Config.Init() configFrame.frame:SetScale(Heimdall_Data.config.scale) local buttonColors = { enabled = { 0, 1, 0, 1 }, disabled = { 1, 0, 0, 1 } } local function CreateFancyText(name, parent, text, color) local r, g, b, a = unpack(color) local textFrame = CreateFrame("Frame", name .. "TextFrame", parent) local textElement = textFrame:CreateFontString(nil, "ARTWORK", "GameFontNormal") textElement:SetText(text) textElement:SetTextColor(r, g, b, a) textElement:SetPoint("CENTER", textFrame, "CENTER", 0, 0) textFrame:SetBackdrop({ bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = true, tileSize = 2, edgeSize = 12, }) textFrame:SetBackdropColor(r, g, b, 0.3) textFrame:SetBackdropBorderColor(r, g, b, 0.5) return textFrame end ---@param name string ---@param parent Frame ---@param onClick fun(): boolean local function CreateBasicButton(name, parent, text, onClick) local button = CreateFrame("Frame", name, parent) button:SetScript("OnMouseDown", function() local res = onClick() local color = res and buttonColors.enabled or buttonColors.disabled button:SetBackdropColor(unpack(color)) end) button:SetBackdrop({ bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = true, tileSize = 2, edgeSize = 12, insets = { left = 2, right = 2, top = 2, bottom = 2 } }) button.UpdateColor = function(self, state) local color = state and buttonColors.enabled or buttonColors.disabled self:SetBackdropColor(unpack(color)) end --spotterEnableButton:SetChecked(Heimdall_Data.config.spotter.enabled) local spotterEnableButtonLabel = button:CreateFontString(nil, "OVERLAY", "GameFontNormal") spotterEnableButtonLabel:SetText(text or "") spotterEnableButtonLabel:SetAllPoints(button) return button end ---@param name string ---@param parent Frame ---@param text string ---@param onDone fun(editBox: Frame) local function CreateBasicSmallEditBox(name, parent, text, initialValue, onDone) local container = GridFrame.new(name, parent, 1, 1) local editBoxFrame = CreateFrame("Frame", name .. "EditBoxFrame", container.frame) local editBox = CreateFrame("EditBox", name .. "EditBox", editBoxFrame) local textFrame = CreateFrame("Frame", name .. "TextFrame", container.frame) local textElement = textFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal") textElement:SetText(text) editBox:SetAutoFocus(false) editBox:SetFontObject("GameFontNormal") editBox:SetText(Heimdall_Data.config.spotter.throttleTime) editBox:SetBackdrop({ bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = true, tileSize = 2, edgeSize = 12, insets = { left = 2, right = 2, top = 2, bottom = 2 } }) editBox:SetBackdropColor(0.8, 0.8, 0.8, 1) editBox:SetBackdropBorderColor(0.5, 0.5, 0.5, 1) editBox:SetTextInsets(6, 6, 0, 0) editBox:SetScript("OnEnterPressed", function() editBox:ClearFocus() end) editBox:SetScript("OnEscapePressed", function() editBox:ClearFocus() end) editBox:SetScript("OnEditFocusLost", function() onDone(editBox) end) editBox:SetText(initialValue or "") container:Add(textFrame, 1, 1) container:Add(editBox, 2, 1) textElement:SetPoint("TOPLEFT", textFrame, "TOPLEFT", 2, -2) return container end ---@param name string ---@param parent Frame ---@param text string ---@param onDone fun(editBox: Frame) local function CreateBasicBigEditBox(name, parent, text, initialValue, onDone) local container = GridFrame.new(name, parent, 1, 100) local editBoxFrame = CreateFrame("Frame", name .. "EditBoxFrame", container.frame) local editBox = CreateFrame("EditBox", name .. "EditBox", editBoxFrame) local textFrame = CreateFrame("Frame", name .. "TextFrame", container.frame) local textElement = textFrame:CreateFontString(nil, "OVERLAY", "GameFontNormal") textElement:SetText(text) editBoxFrame:SetBackdrop({ bgFile = "Interface/Tooltips/UI-Tooltip-Background", edgeFile = "Interface/Tooltips/UI-Tooltip-Border", tile = true, tileSize = 2, edgeSize = 12, insets = { left = 2, right = 2, top = 2, bottom = 2 } }) editBoxFrame:SetBackdropColor(0.8, 0.8, 0.8, 1) editBoxFrame:SetBackdropBorderColor(0.5, 0.5, 0.5, 1) editBox:SetAllPoints(editBoxFrame) editBox:SetAutoFocus(false) editBox:SetFontObject("GameFontNormal") editBox:SetText(initialValue or "") editBox:SetTextInsets(6, 6, 6, 6) editBox:SetMultiLine(true) editBox:SetSize(280, 100) editBox:SetMaxLetters(100000) editBox:SetScript("OnEscapePressed", function() editBox:ClearFocus() end) editBox:SetScript("OnEditFocusLost", function() onDone(editBox) end) container:Add(textFrame, 1, 1) container:Add(editBoxFrame, 7, 1) textElement:SetPoint("TOPLEFT", textFrame, "TOPLEFT", 2, -2) return container end local scale = CreateBasicSmallEditBox("HeimdallConfigScale", configFrame.frame, "Scale", Heimdall_Data.config.scale, function(self) local text = self:GetText() if string.match(text, "^%d+%.*%d*$") then Heimdall_Data.config.scale = tonumber(text) configFrame.frame:SetScale(Heimdall_Data.config.scale) else print(string.format("Invalid scale: %s, please use numbers", text)) self:SetText(Heimdall_Data.config.scale) end end) configFrame:Add(scale, 2, 2) local title = configFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal") title:SetText(shared.L[Heimdall_Data.config.locale].config.heimdallConfig) configFrame:Add(title, 2, 8) local russian = nil local english = CreateBasicButton("HeimdallConfigEnglish", configFrame.frame, shared.L.en.config.english, function() Heimdall_Data.config.locale = "en" russian:UpdateColor(false) return Heimdall_Data.config.locale == "en" end) english:UpdateColor(Heimdall_Data.config.locale == "en") russian = CreateBasicButton("HeimdallConfigRussian", configFrame.frame, shared.L.ru.config.russian, function() Heimdall_Data.config.locale = "ru" english:UpdateColor(false) return Heimdall_Data.config.locale == "ru" end) russian:UpdateColor(Heimdall_Data.config.locale == "ru") configFrame:Add(english, 2, 1) configFrame:Add(russian, 2, 1) -- Spotter do local r, g, b, a = GetNextColor() local spotterConfigFrame = GridFrame.new("HeimdallSpotterConfig", UIParent, 12, 20) spotterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(spotterConfigFrame, 9, 3) local title = CreateFancyText("HeimdallSpotterConfigTitle", spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.spotter, { r, g, b, a }) spotterConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallSpotterConfigDebugButton", spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.spotter.debug = not Heimdall_Data.config.spotter.debug return Heimdall_Data.config.spotter.debug end) debugButton:UpdateColor(Heimdall_Data.config.spotter.debug) spotterConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallSpotterConfigEnableButton", spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.spotter.enabled = not Heimdall_Data.config.spotter.enabled return Heimdall_Data.config.spotter.enabled end) enableButton:UpdateColor(Heimdall_Data.config.spotter.enabled) spotterConfigFrame:Add(enableButton, 1, 6) local everyoneButton = CreateBasicButton("HeimdallSpotterConfigEveryoneButton", spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.everyone, function() Heimdall_Data.config.spotter.everyone = not Heimdall_Data.config.spotter.everyone return Heimdall_Data.config.spotter.everyone end) everyoneButton:UpdateColor(Heimdall_Data.config.spotter.everyone) spotterConfigFrame:Add(everyoneButton, 1, 6) local hostileButton = CreateBasicButton("HeimdallSpotterConfigHostileButton", spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.hostile, function() Heimdall_Data.config.spotter.hostile = not Heimdall_Data.config.spotter.hostile return Heimdall_Data.config.spotter.hostile end) hostileButton:UpdateColor(Heimdall_Data.config.spotter.hostile) spotterConfigFrame:Add(hostileButton, 1, 4) local allianceButton = CreateBasicButton("HeimdallSpotterConfigAllianceButton", spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.alliance, function() Heimdall_Data.config.spotter.alliance = not Heimdall_Data.config.spotter.alliance return Heimdall_Data.config.spotter.alliance end) allianceButton:UpdateColor(Heimdall_Data.config.spotter.alliance) spotterConfigFrame:Add(allianceButton, 1, 4) local stinkyButton = CreateBasicButton("HeimdallSpotterConfigStinkyButton", spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.stinky, function() Heimdall_Data.config.spotter.stinky = not Heimdall_Data.config.spotter.stinky return Heimdall_Data.config.spotter.stinky end) stinkyButton:UpdateColor(Heimdall_Data.config.spotter.stinky) spotterConfigFrame:Add(stinkyButton, 1, 4) local notifyChannel = CreateBasicSmallEditBox("HeimdallSpotterConfigNotifyChannel", spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.notifyChannel, Heimdall_Data.config.spotter.notifyChannel, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.spotter.notifyChannel = text print("Notify channel set to", tostring(text)) else print("Invalid channel name", tostring(text)) self:SetText(Heimdall_Data.config.spotter.notifyChannel) end end) spotterConfigFrame:Add(notifyChannel, 2, 4) local zoneOverride = CreateBasicSmallEditBox("HeimdallSpotterConfigZoneOverride", spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.zoneOverride, Heimdall_Data.config.spotter.zoneOverride, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.spotter.zoneOverride = text print("Zone override set to", tostring(text)) else print("Invalid zone override", tostring(text)) self:SetText(Heimdall_Data.config.spotter.zoneOverride) end end) spotterConfigFrame:Add(zoneOverride, 2, 4) local throttleTime = CreateBasicSmallEditBox("HeimdallSpotterConfigThrottleTime", spotterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.throttle, Heimdall_Data.config.spotter.throttleTime, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.spotter.throttleTime = tonumber(text) else print("Invalid throttle time", tostring(text)) self:SetText(Heimdall_Data.config.spotter.throttleTime) end end) spotterConfigFrame:Add(throttleTime, 2, 4) end -- Whoer do local r, g, b, a = GetNextColor() local whoerConfigFrame = GridFrame.new("HeimdallWhoerConfig", UIParent, 12, 20) whoerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(whoerConfigFrame, 16, 3) local title = CreateFancyText("HeimdallWhoerConfigTitle", whoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.whoer, { r, g, b, a }) whoerConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallWhoerConfigDebugButton", whoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.who.debug = not Heimdall_Data.config.who.debug return Heimdall_Data.config.who.debug end) debugButton:UpdateColor(Heimdall_Data.config.who.debug) whoerConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallWhoerConfigEnableButton", whoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.who.enabled = not Heimdall_Data.config.who.enabled return Heimdall_Data.config.who.enabled end) enableButton:UpdateColor(Heimdall_Data.config.who.enabled) whoerConfigFrame:Add(enableButton, 1, 6) local doWhisperButton = CreateBasicButton("HeimdallWhoerConfigDoWhisperButton", whoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.doWhisper, function() Heimdall_Data.config.who.doWhisper = not Heimdall_Data.config.who.doWhisper return Heimdall_Data.config.who.doWhisper end) doWhisperButton:UpdateColor(Heimdall_Data.config.who.doWhisper) whoerConfigFrame:Add(doWhisperButton, 1, 6) local notifyChannel = CreateBasicSmallEditBox("HeimdallWhoerConfigNotifyChannel", whoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.notifyChannel, Heimdall_Data.config.who.notifyChannel, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.who.notifyChannel = text print("Notify channel set to", tostring(text)) else print("Invalid channel name", tostring(text)) self:SetText(Heimdall_Data.config.who.notifyChannel) end end) whoerConfigFrame:Add(notifyChannel, 2, 6) local ttl = CreateBasicSmallEditBox("HeimdallWhoerConfigTTL", whoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.ttl, Heimdall_Data.config.who.ttl, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.who.ttl = tonumber(text) print("TTL set to", tostring(text)) else print("Invalid TTL", tostring(text)) self:SetText(Heimdall_Data.config.who.ttl) end end) whoerConfigFrame:Add(ttl, 2, 6) local ignored = CreateBasicBigEditBox("HeimdallWhoerConfigIgnored", whoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.ignored, MapKeyToString(Heimdall_Data.config.who.ignored or {}, "\n"), function(self) local ignored = StringToMap(self:GetText(), "\n") Heimdall_Data.config.who.ignored = ignored end) whoerConfigFrame:Add(ignored, 6, 6) local zoneNotifyFor = CreateBasicBigEditBox("HeimdallWhoerConfigZoneNotifyFor", whoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.zoneNotifyFor, MapKeyToString(Heimdall_Data.config.who.zoneNotifyFor or {}, "\n"), function(self) local zoneNotifyFor = StringToMap(self:GetText(), "\n") Heimdall_Data.config.who.zoneNotifyFor = zoneNotifyFor end) whoerConfigFrame:Add(zoneNotifyFor, 6, 6) end -- Messenger do local r, g, b, a = GetNextColor() local messengerConfigFrame = GridFrame.new("HeimdallMessengerConfig", UIParent, 12, 20) messengerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(messengerConfigFrame, 6, 3) local title = CreateFancyText("HeimdallMessengerConfigTitle", messengerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.messenger, { r, g, b, a }) messengerConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallMessengerConfigDebugButton", messengerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.messenger.debug = not Heimdall_Data.config.messenger.debug return Heimdall_Data.config.messenger.debug end) debugButton:UpdateColor(Heimdall_Data.config.messenger.debug) messengerConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallMessengerConfigEnableButton", messengerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.messenger.enabled = not Heimdall_Data.config.messenger.enabled return Heimdall_Data.config.messenger.enabled end) enableButton:UpdateColor(Heimdall_Data.config.messenger.enabled) messengerConfigFrame:Add(enableButton, 2, 6) local interval = CreateBasicSmallEditBox("HeimdallMessengerConfigInterval", messengerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.interval, Heimdall_Data.config.messenger.interval, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.messenger.interval = tonumber(text) print("Interval set to", tostring(text)) else print("Invalid interval", tostring(text)) self:SetText(Heimdall_Data.config.messenger.interval) end end) messengerConfigFrame:Add(interval, 2, 6) end -- Death Reporter do local r, g, b, a = GetNextColor() local deathReporterConfigFrame = GridFrame.new("HeimdallDeathReporterConfig", UIParent, 12, 20) deathReporterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(deathReporterConfigFrame, 10, 3) local title = CreateFancyText("HeimdallDeathReporterConfigTitle", deathReporterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.deathReporter, { r, g, b, a }) deathReporterConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallDeathReporterConfigDebugButton", deathReporterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.deathReporter.debug = not Heimdall_Data.config.deathReporter.debug return Heimdall_Data.config.deathReporter.debug end) debugButton:UpdateColor(Heimdall_Data.config.deathReporter.debug) deathReporterConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallDeathReporterConfigEnableButton", deathReporterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.deathReporter.enabled = not Heimdall_Data.config.deathReporter.enabled return Heimdall_Data.config.deathReporter.enabled end) enableButton:UpdateColor(Heimdall_Data.config.deathReporter.enabled) deathReporterConfigFrame:Add(enableButton, 1, 6) local doWhisperButton = CreateBasicButton("HeimdallDeathReporterConfigDoWhisperButton", deathReporterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.doWhisper, function() Heimdall_Data.config.deathReporter.doWhisper = not Heimdall_Data.config.deathReporter.doWhisper return Heimdall_Data.config.deathReporter.doWhisper end) doWhisperButton:UpdateColor(Heimdall_Data.config.deathReporter.doWhisper) deathReporterConfigFrame:Add(doWhisperButton, 1, 6) local throttleTime = CreateBasicSmallEditBox("HeimdallDeathReporterConfigThrottleTime", deathReporterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.throttle, Heimdall_Data.config.deathReporter.throttle, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.deathReporter.throttle = tonumber(text) print("Throttle time set to", tostring(text)) else print("Invalid throttle time", tostring(text)) self:SetText(Heimdall_Data.config.deathReporter.throttle) end end) deathReporterConfigFrame:Add(throttleTime, 2, 6) local duelThrottle = CreateBasicSmallEditBox("HeimdallDeathReporterConfigDuelThrottle", deathReporterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.duelThrottle, Heimdall_Data.config.deathReporter.duelThrottle, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.deathReporter.duelThrottle = tonumber(text) print("Duel throttle set to", tostring(text)) else print("Invalid duel throttle", tostring(text)) self:SetText(Heimdall_Data.config.deathReporter.duelThrottle) end end) deathReporterConfigFrame:Add(duelThrottle, 2, 6) local masterChannel = CreateBasicSmallEditBox("HeimdallDeathReporterConfigMasterChannel", deathReporterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, Heimdall_Data.config.deathReporter.masterChannel, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.deathReporter.masterChannel = text print("Master channel set to", tostring(text)) else print("Invalid channel name", tostring(text)) self:SetText(Heimdall_Data.config.deathReporter.masterChannel) end end) deathReporterConfigFrame:Add(masterChannel, 2, 6) local zoneOverride = CreateBasicSmallEditBox("HeimdallDeathReporterConfigZoneOverride", deathReporterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.zoneOverride, Heimdall_Data.config.deathReporter.zoneOverride, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.deathReporter.zoneOverride = text print("Zone override set to", tostring(text)) else print("Invalid zone override", tostring(text)) self:SetText(Heimdall_Data.config.deathReporter.zoneOverride) end end) deathReporterConfigFrame:Add(zoneOverride, 2, 6) end -- Inviter do local r, g, b, a = GetNextColor() local inviterConfigFrame = GridFrame.new("HeimdallInviterConfig", UIParent, 12, 20) inviterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(inviterConfigFrame, 13, 3) local title = CreateFancyText("HeimdallInviterConfigTitle", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.inviter, { r, g, b, a }) inviterConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallInviterConfigDebugButton", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.inviter.debug = not Heimdall_Data.config.inviter.debug return Heimdall_Data.config.inviter.debug end) debugButton:UpdateColor(Heimdall_Data.config.inviter.debug) inviterConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallInviterConfigEnableButton", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.inviter.enabled = not Heimdall_Data.config.inviter.enabled return Heimdall_Data.config.inviter.enabled end) enableButton:UpdateColor(Heimdall_Data.config.inviter.enabled) inviterConfigFrame:Add(enableButton, 1, 3) local allAssistButton = CreateBasicButton("HeimdallInviterConfigAllAssistButton", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.allAssist, function() Heimdall_Data.config.inviter.allAssist = not Heimdall_Data.config.inviter.allAssist return Heimdall_Data.config.inviter.allAssist end) allAssistButton:UpdateColor(Heimdall_Data.config.inviter.allAssist) inviterConfigFrame:Add(allAssistButton, 1, 3) local agentsAssist = CreateBasicButton("HeimdallInviterConfigAgentsAssistButton", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.agentsAssist, function() Heimdall_Data.config.inviter.agentsAssist = not Heimdall_Data.config.inviter.agentsAssist return Heimdall_Data.config.inviter.agentsAssist end) agentsAssist:UpdateColor(Heimdall_Data.config.inviter.agentsAssist) inviterConfigFrame:Add(agentsAssist, 1, 3) local kickOffline = CreateBasicButton("HeimdallInviterConfigKickOfflineButton", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.kickOffline, function() Heimdall_Data.config.inviter.kickOffline = not Heimdall_Data.config.inviter.kickOffline return Heimdall_Data.config.inviter.kickOffline end) kickOffline:UpdateColor(Heimdall_Data.config.inviter.kickOffline) inviterConfigFrame:Add(kickOffline, 1, 3) local throttle = CreateBasicSmallEditBox("HeimdallInviterConfigThrottle", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.throttle, Heimdall_Data.config.inviter.throttle, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.inviter.throttle = tonumber(text) print("Throttle time set to", tostring(text)) else print("Invalid throttle time", tostring(text)) self:SetText(Heimdall_Data.config.inviter.throttle) end end) inviterConfigFrame:Add(throttle, 2, 6) local listeningChannel = CreateBasicSmallEditBox("HeimdallInviterConfigListeningChannel", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, Heimdall_Data.config.inviter.listeningChannel, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.inviter.listeningChannel = text print("Listening channel set to", tostring(text)) else print("Invalid listening channel", tostring(text)) self:SetText(Heimdall_Data.config.inviter.listeningChannel) end end) inviterConfigFrame:Add(listeningChannel, 2, 6) local keyword = CreateBasicSmallEditBox("HeimdallInviterConfigKeywords", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.keyword, Heimdall_Data.config.inviter.keyword, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.inviter.keyword = text print("Keyword set to", tostring(text)) else print("Invalid keyword", tostring(text)) self:SetText(Heimdall_Data.config.inviter.keyword) end end) inviterConfigFrame:Add(keyword, 2, 6) local cleanupInterval = CreateBasicSmallEditBox("HeimdallInviterConfigCleanupInterval", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.cleanupInterval, Heimdall_Data.config.inviter.cleanupInterval, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.inviter.cleanupInterval = tonumber(text) print("Cleanup interval set to", tostring(text)) else print("Invalid cleanup interval", tostring(text)) self:SetText(Heimdall_Data.config.inviter.cleanupInterval) end end) inviterConfigFrame:Add(cleanupInterval, 2, 6) local afkThreshold = CreateBasicSmallEditBox("HeimdallInviterConfigAfkThreshold", inviterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.afkThreshold, Heimdall_Data.config.inviter.afkThreshold, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.inviter.afkThreshold = tonumber(text) print("Afk threshold set to", tostring(text)) end end) inviterConfigFrame:Add(afkThreshold, 2, 6) end -- Dueler do local r, g, b, a = GetNextColor() local duelerConfigFrame = GridFrame.new("HeimdallDuelerConfig", UIParent, 12, 20) duelerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(duelerConfigFrame, 4, 3) local title = CreateFancyText("HeimdallDuelerConfigTitle", duelerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.dueler, { r, g, b, a }) duelerConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallDuelerConfigDebugButton", duelerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.dueler.debug = not Heimdall_Data.config.dueler.debug return Heimdall_Data.config.dueler.debug end) debugButton:UpdateColor(Heimdall_Data.config.dueler.debug) duelerConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallInviterConfigEnableButton", duelerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.dueler.enabled = not Heimdall_Data.config.dueler.enabled return Heimdall_Data.config.dueler.enabled end) enableButton:UpdateColor(Heimdall_Data.config.dueler.enabled) duelerConfigFrame:Add(enableButton, 1, 6) local declineOther = CreateBasicButton("HeimdallDuelerConfigDeclineOtherButton", duelerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.declineOther, function() Heimdall_Data.config.dueler.declineOther = not Heimdall_Data.config.dueler.declineOther return Heimdall_Data.config.dueler.declineOther end) declineOther:UpdateColor(Heimdall_Data.config.dueler.declineOther) duelerConfigFrame:Add(declineOther, 1, 6) end -- Agent Tracker do local r, g, b, a = GetNextColor() local agentTrackerConfigFrame = GridFrame.new("HeimdallAgentTrackerConfig", UIParent, 12, 20) agentTrackerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(agentTrackerConfigFrame, 5, 3) local title = CreateFancyText("HeimdallAgentTrackerConfigTitle", agentTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.agentTracker, { r, g, b, a }) agentTrackerConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallAgentTrackerConfigDebugButton", agentTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.agentTracker.debug = not Heimdall_Data.config.agentTracker.debug return Heimdall_Data.config.agentTracker.debug end) debugButton:UpdateColor(Heimdall_Data.config.agentTracker.debug) agentTrackerConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallAgentTrackerConfigEnableButton", agentTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.agentTracker.enabled = not Heimdall_Data.config.agentTracker.enabled return Heimdall_Data.config.agentTracker.enabled end) enableButton:UpdateColor(Heimdall_Data.config.agentTracker.enabled) agentTrackerConfigFrame:Add(enableButton, 2, 6) local masterChannel = CreateBasicSmallEditBox("HeimdallAgentTrackerConfigMasterChannel", agentTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, Heimdall_Data.config.agentTracker.masterChannel, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.agentTracker.masterChannel = text print("Master channel set to", tostring(text)) else print("Invalid master channel", tostring(text)) self:SetText(Heimdall_Data.config.agentTracker.masterChannel) end end) agentTrackerConfigFrame:Add(masterChannel, 2, 6) end -- Stinky Tracker do local r, g, b, a = GetNextColor() local stinkyTrackerConfigFrame = GridFrame.new("HeimdallStinkyTrackerConfig", UIParent, 12, 20) stinkyTrackerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(stinkyTrackerConfigFrame, 5, 3) local title = CreateFancyText("HeimdallStinkyTrackerConfigTitle", stinkyTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.stinkyTracker, { r, g, b, a }) stinkyTrackerConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallStinkyTrackerConfigDebugButton", stinkyTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.stinkyTracker.debug = not Heimdall_Data.config.stinkyTracker.debug return Heimdall_Data.config.stinkyTracker.debug end) debugButton:UpdateColor(Heimdall_Data.config.stinkyTracker.debug) stinkyTrackerConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallStinkyTrackerConfigEnableButton", stinkyTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.stinkyTracker.enabled = not Heimdall_Data.config.stinkyTracker.enabled return Heimdall_Data.config.stinkyTracker.enabled end) enableButton:UpdateColor(Heimdall_Data.config.stinkyTracker.enabled) stinkyTrackerConfigFrame:Add(enableButton, 2, 6) local masterChannel = CreateBasicSmallEditBox("HeimdallStinkyTrackerConfigMasterChannel", stinkyTrackerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, Heimdall_Data.config.stinkyTracker.masterChannel, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.stinkyTracker.masterChannel = text print("Master channel set to", tostring(text)) else print("Invalid master channel", tostring(text)) self:SetText(Heimdall_Data.config.stinkyTracker.masterChannel) end end) stinkyTrackerConfigFrame:Add(masterChannel, 2, 6) end -- Emoter do local r, g, b, a = GetNextColor() local emoterConfigFrame = GridFrame.new("HeimdallEmoterConfig", UIParent, 12, 20) emoterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(emoterConfigFrame, 7, 3) local title = CreateFancyText("HeimdallEmoterConfigTitle", emoterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.emoter, { r, g, b, a }) emoterConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallEmoterConfigDebugButton", emoterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.emoter.debug = not Heimdall_Data.config.emoter.debug return Heimdall_Data.config.emoter.debug end) debugButton:UpdateColor(Heimdall_Data.config.emoter.debug) emoterConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallEmoterConfigEnableButton", emoterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.emoter.enabled = not Heimdall_Data.config.emoter.enabled return Heimdall_Data.config.emoter.enabled end) enableButton:UpdateColor(Heimdall_Data.config.emoter.enabled) emoterConfigFrame:Add(enableButton, 1, 12) local masterChannel = CreateBasicSmallEditBox("HeimdallEmoterConfigMasterChannel", emoterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, Heimdall_Data.config.emoter.masterChannel, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.emoter.masterChannel = text print("Master channel set to", tostring(text)) else print("Invalid master channel", tostring(text)) self:SetText(Heimdall_Data.config.emoter.masterChannel) end end) emoterConfigFrame:Add(masterChannel, 2, 6) local prefix = CreateBasicSmallEditBox("HeimdallEmoterConfigPrefix", emoterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.prefix, Heimdall_Data.config.emoter.prefix, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.emoter.prefix = text print("Prefix set to", tostring(text)) else print("Invalid prefix", tostring(text)) self:SetText(Heimdall_Data.config.emoter.prefix) end end) emoterConfigFrame:Add(prefix, 2, 6) end -- Echoer do local r, g, b, a = GetNextColor() local echoerConfigFrame = GridFrame.new("HeimdallEchoerConfig", UIParent, 12, 20) echoerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(echoerConfigFrame, 7, 3) local title = CreateFancyText("HeimdallEchoerConfigTitle", echoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.echoer, { r, g, b, a }) echoerConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallEchoerConfigDebugButton", echoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.echoer.debug = not Heimdall_Data.config.echoer.debug return Heimdall_Data.config.echoer.debug end) debugButton:UpdateColor(Heimdall_Data.config.echoer.debug) echoerConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallEmoterConfigEnableButton", echoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.echoer.enabled = not Heimdall_Data.config.echoer.enabled return Heimdall_Data.config.echoer.enabled end) enableButton:UpdateColor(Heimdall_Data.config.echoer.enabled) echoerConfigFrame:Add(enableButton, 1, 12) local masterChannel = CreateBasicSmallEditBox("HeimdallEmoterConfigMasterChannel", echoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, Heimdall_Data.config.echoer.masterChannel, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.echoer.masterChannel = text print("Master channel set to", tostring(text)) else print("Invalid master channel", tostring(text)) self:SetText(Heimdall_Data.config.echoer.masterChannel) end end) echoerConfigFrame:Add(masterChannel, 2, 6) local prefix = CreateBasicSmallEditBox("HeimdallEmoterConfigPrefix", echoerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.prefix, Heimdall_Data.config.echoer.prefix, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.echoer.prefix = text print("Prefix set to", tostring(text)) else print("Invalid prefix", tostring(text)) self:SetText(Heimdall_Data.config.echoer.prefix) end end) echoerConfigFrame:Add(prefix, 2, 6) end -- Commander do local r, g, b, a = GetNextColor() local commanderConfigFrame = GridFrame.new("HeimdallCommanderConfig", UIParent, 12, 20) commanderConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(commanderConfigFrame, 10, 3) local title = CreateFancyText("HeimdallCommanderConfigTitle", commanderConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.commander, { r, g, b, a }) commanderConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallCommanderConfigDebugButton", commanderConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.commander.debug = not Heimdall_Data.config.commander.debug return Heimdall_Data.config.commander.debug end) debugButton:UpdateColor(Heimdall_Data.config.commander.debug) commanderConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallCommanderConfigEnableButton", commanderConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.commander.enabled = not Heimdall_Data.config.commander.enabled return Heimdall_Data.config.commander.enabled end) enableButton:UpdateColor(Heimdall_Data.config.commander.enabled) commanderConfigFrame:Add(enableButton, 1, 12) local masterChannel = CreateBasicSmallEditBox("HeimdallCommanderConfigMasterChannel", commanderConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, Heimdall_Data.config.commander.masterChannel, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.commander.masterChannel = text print("Master channel set to", tostring(text)) else print("Invalid master channel", tostring(text)) self:SetText(Heimdall_Data.config.commander.masterChannel) end end) commanderConfigFrame:Add(masterChannel, 2, 6) local commander = CreateBasicSmallEditBox("HeimdallCommanderConfigCommander", commanderConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.commander, Heimdall_Data.config.commander.commander, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.commander.commander = text print("Commander set to", tostring(text)) else print("Invalid commander", tostring(text)) self:SetText(Heimdall_Data.config.commander.commander) end end) commanderConfigFrame:Add(commander, 2, 6) local commands = CreateBasicSmallEditBox("HeimdallCommanderConfigCommands", commanderConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.commands, MapKeyToString(Heimdall_Data.config.commander.commands, ", "), function(self) local text = self:GetText() Heimdall_Data.config.commander.commands = StringToMap(text, ",") end) commanderConfigFrame:Add(commands, 2, 12) end -- Macroer do local r, g, b, a = GetNextColor() local macroerConfigFrame = GridFrame.new("HeimdallMacroerConfig", UIParent, 12, 20) macroerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(macroerConfigFrame, 6, 3) local title = CreateFancyText("HeimdallMacroerConfigTitle", macroerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.macroer, { r, g, b, a }) macroerConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallMacroerConfigDebugButton", macroerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.macroer.debug = not Heimdall_Data.config.macroer.debug return Heimdall_Data.config.macroer.debug end) debugButton:UpdateColor(Heimdall_Data.config.macroer.debug) macroerConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallCommanderConfigEnableButton", macroerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.macroer.enabled = not Heimdall_Data.config.macroer.enabled return Heimdall_Data.config.macroer.enabled end) enableButton:UpdateColor(Heimdall_Data.config.macroer.enabled) macroerConfigFrame:Add(enableButton, 1, 12) local priority = CreateBasicSmallEditBox("HeimdallMacroerConfigPriority", macroerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.priority, table.concat(Heimdall_Data.config.macroer.priority, ", "), function(self) local text = self:GetText() Heimdall_Data.config.macroer.priority = StringToArray(text, ",") end) macroerConfigFrame:Add(priority, 2, 12) end -- Combat Alerter do local r, g, b, a = GetNextColor() local combatAlerterConfigFrame = GridFrame.new("HeimdallCombatAlerterConfig", UIParent, 12, 20) combatAlerterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(combatAlerterConfigFrame, 5, 3) local title = CreateFancyText("HeimdallCombatAlerterConfigTitle", combatAlerterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.combatAlerter, { r, g, b, a }) combatAlerterConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallCombatAlerterConfigDebugButton", combatAlerterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.combatAlerter.debug = not Heimdall_Data.config.combatAlerter.debug return Heimdall_Data.config.combatAlerter.debug end) debugButton:UpdateColor(Heimdall_Data.config.combatAlerter.debug) combatAlerterConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallCombatAlerterConfigEnableButton", combatAlerterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.combatAlerter.enabled = not Heimdall_Data.config.combatAlerter.enabled return Heimdall_Data.config.combatAlerter.enabled end) enableButton:UpdateColor(Heimdall_Data.config.combatAlerter.enabled) combatAlerterConfigFrame:Add(enableButton, 2, 6) local masterChannel = CreateBasicSmallEditBox("HeimdallCombatAlerterConfigMasterChannel", combatAlerterConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, Heimdall_Data.config.combatAlerter.masterChannel, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.combatAlerter.masterChannel = text print("Master channel set to", tostring(text)) else print("Invalid master channel", tostring(text)) self:SetText(Heimdall_Data.config.combatAlerter.masterChannel) end end) combatAlerterConfigFrame:Add(masterChannel, 2, 6) end -- Minimap Tagger do local r, g, b, a = GetNextColor() local minimapTaggerConfigFrame = GridFrame.new("HeimdallMinimapTaggerConfig", UIParent, 12, 20) minimapTaggerConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(minimapTaggerConfigFrame, 18, 6) local title = CreateFancyText("HeimdallMinimapTaggerConfigTitle", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.minimapTagger, { r, g, b, a }) minimapTaggerConfigFrame:Add(title, 1, 8) local debugButton = CreateBasicButton("HeimdallMinimapTaggerConfigDebugButton", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function() Heimdall_Data.config.minimapTagger.debug = not Heimdall_Data.config.minimapTagger.debug return Heimdall_Data.config.minimapTagger.debug end) debugButton:UpdateColor(Heimdall_Data.config.minimapTagger.debug) minimapTaggerConfigFrame:Add(debugButton, 1, 4) local enableButton = CreateBasicButton("HeimdallMinimapTaggerConfigEnableButton", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function() Heimdall_Data.config.minimapTagger.enabled = not Heimdall_Data.config.minimapTagger.enabled return Heimdall_Data.config.minimapTagger.enabled end) enableButton:UpdateColor(Heimdall_Data.config.minimapTagger.enabled) minimapTaggerConfigFrame:Add(enableButton, 2, 6) local masterChannel = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigMasterChannel", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.masterChannel, Heimdall_Data.config.minimapTagger.masterChannel, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.minimapTagger.masterChannel = text print("Master channel set to", tostring(text)) else print("Invalid master channel", tostring(text)) self:SetText(Heimdall_Data.config.minimapTagger.masterChannel) end end) minimapTaggerConfigFrame:Add(masterChannel, 2, 3) local scale = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigScale", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.scale, Heimdall_Data.config.minimapTagger.scale, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.minimapTagger.scale = tonumber(text) print("Scale set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(scale, 2, 3) --region Tag local tagSound = CreateBasicButton("HeimdallMinimapTaggerConfigTagSound", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.tagSound, function() Heimdall_Data.config.minimapTagger.tagSound = not Heimdall_Data.config.minimapTagger.tagSound return Heimdall_Data.config.minimapTagger.tagSound end) tagSound:UpdateColor(Heimdall_Data.config.minimapTagger.tagSound) minimapTaggerConfigFrame:Add(tagSound, 2, 1) local tagTTL = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigTagTTL", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.ttl, Heimdall_Data.config.minimapTagger.tagTTL, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.minimapTagger.tagTTL = tonumber(text) print("Tag TTL set to", tostring(text)) else print("Invalid tag TTL", tostring(text)) self:SetText(Heimdall_Data.config.minimapTagger.tagTTL) end end) minimapTaggerConfigFrame:Add(tagTTL, 2, 1) local tagSoundThrottle = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigTagSoundThrottle", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.soundThrottle, Heimdall_Data.config.minimapTagger.tagSoundThrottle, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.minimapTagger.tagSoundThrottle = tonumber(text) print("Tag sound throttle set to", tostring(text)) else print("Invalid tag sound throttle", tostring(text)) self:SetText(Heimdall_Data.config.minimapTagger.tagSoundThrottle) end end) minimapTaggerConfigFrame:Add(tagSoundThrottle, 2, 2) local tagSoundFile = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigTagSoundFile", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.soundFile, Heimdall_Data.config.minimapTagger.tagSoundFile, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.minimapTagger.tagSoundFile = text print("Tag sound file set to", tostring(text)) else print("Invalid tag sound file", tostring(text)) self:SetText(Heimdall_Data.config.minimapTagger.tagSoundFile) end end) minimapTaggerConfigFrame:Add(tagSoundFile, 2, 4) local tagTexture = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigTagTexture", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.textureFile, Heimdall_Data.config.minimapTagger.tagTextureFile, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.minimapTagger.tagTextureFile = text print("Tag texture file set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(tagTexture, 2, 4) --endregion --region Alert local alertSound = CreateBasicButton("HeimdallMinimapTaggerConfigAlertSound", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.alertSound, function() Heimdall_Data.config.minimapTagger.alertSound = not Heimdall_Data.config.minimapTagger.alertSound return Heimdall_Data.config.minimapTagger.alertSound end) alertSound:UpdateColor(Heimdall_Data.config.minimapTagger.alertSound) minimapTaggerConfigFrame:Add(alertSound, 2, 1) local alertTTL = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigAlertTTL", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.ttl, Heimdall_Data.config.minimapTagger.alertTTL, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.minimapTagger.alertTTL = tonumber(text) print("Alert TTL set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(alertTTL, 2, 1) local alertSoundThrottle = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigAlertSoundThrottle", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.soundThrottle, Heimdall_Data.config.minimapTagger.alertSoundThrottle, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.minimapTagger.alertSoundThrottle = tonumber(text) print("Alert sound throttle set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(alertSoundThrottle, 2, 2) local alertSoundFile = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigAlertSoundFile", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.soundFile, Heimdall_Data.config.minimapTagger.alertSoundFile, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.minimapTagger.alertSoundFile = text print("Alert sound file set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(alertSoundFile, 2, 4) local alertTexture = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigAlertTexture", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.textureFile, Heimdall_Data.config.minimapTagger.alertTextureFile, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.minimapTagger.alertTextureFile = text print("Alert texture file set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(alertTexture, 2, 4) --endregion --region Combat local combatSound = CreateBasicButton("HeimdallMinimapTaggerConfigCombatSound", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.combatSound, function() Heimdall_Data.config.minimapTagger.combatSound = not Heimdall_Data.config.minimapTagger.combatSound return Heimdall_Data.config.minimapTagger.combatSound end) combatSound:UpdateColor(Heimdall_Data.config.minimapTagger.combatSound) minimapTaggerConfigFrame:Add(combatSound, 2, 1) local combatTTL = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigCombatTTL", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.ttl, Heimdall_Data.config.minimapTagger.combatTTL, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.minimapTagger.combatTTL = tonumber(text) print("Combat TTL set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(combatTTL, 2, 1) local combatSoundThrottle = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigCombatSoundThrottle", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.soundThrottle, Heimdall_Data.config.minimapTagger.combatSoundThrottle, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.minimapTagger.combatSoundThrottle = tonumber(text) print("Combat sound throttle set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(combatSoundThrottle, 2, 2) local combatSoundFile = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigCombatSoundFile", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.soundFile, Heimdall_Data.config.minimapTagger.combatSoundFile, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.minimapTagger.combatSoundFile = text print("Combat sound file set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(combatSoundFile, 2, 4) local combatTexture = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigCombatTexture", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.textureFile, Heimdall_Data.config.minimapTagger.combatTextureFile, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.minimapTagger.combatTextureFile = text print("Combat texture file set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(combatTexture, 2, 4) --endregion --region Help local helpSound = CreateBasicButton("HeimdallMinimapTaggerConfigHelpSound", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.helpSound, function() Heimdall_Data.config.minimapTagger.helpSound = not Heimdall_Data.config.minimapTagger.helpSound return Heimdall_Data.config.minimapTagger.helpSound end) helpSound:UpdateColor(Heimdall_Data.config.minimapTagger.helpSound) minimapTaggerConfigFrame:Add(helpSound, 2, 1) local helpTTL = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigHelpTTL", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.ttl, Heimdall_Data.config.minimapTagger.helpTTL, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.minimapTagger.helpTTL = tonumber(text) print("Help TTL set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(helpTTL, 2, 1) local helpSoundThrottle = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigHelpSoundThrottle", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.soundThrottle, Heimdall_Data.config.minimapTagger.helpSoundThrottle, function(self) local text = self:GetText() if string.match(text, "%d+") then Heimdall_Data.config.minimapTagger.helpSoundThrottle = tonumber(text) print("Help sound throttle set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(helpSoundThrottle, 2, 2) local helpSoundFile = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigHelpSoundFile", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.soundFile, Heimdall_Data.config.minimapTagger.helpSoundFile, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.minimapTagger.helpSoundFile = text print("Help sound file set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(helpSoundFile, 2, 4) local helpTexture = CreateBasicSmallEditBox("HeimdallMinimapTaggerConfigHelpTexture", minimapTaggerConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.textureFile, Heimdall_Data.config.minimapTagger.helpTextureFile, function(self) local text = self:GetText() if string.match(text, "%S+") then Heimdall_Data.config.minimapTagger.helpTextureFile = text print("Help texture file set to", tostring(text)) end end) minimapTaggerConfigFrame:Add(helpTexture, 2, 4) --endregion end -- Whisper Notify do local r, g, b, a = GetNextColor() local whisperNotifyConfigFrame = GridFrame.new("HeimdallWhisperNotifyConfig", UIParent, 12, 20) whisperNotifyConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(whisperNotifyConfigFrame, 14, 3) local title = CreateFancyText("HeimdallWhisperNotifyConfigTitle", whisperNotifyConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.whisperNotify, { r, g, b, a }) whisperNotifyConfigFrame:Add(title, 1, 12) local whisperNotify = CreateBasicBigEditBox("HeimdallWhisperNotifyConfigWhisperNotify", whisperNotifyConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.whisperNotify, table.concat(Heimdall_Data.config.whisperNotify, "\n"), function(self) local text = self:GetText() Heimdall_Data.config.whisperNotify = StringToArray(text, "\n") end) whisperNotifyConfigFrame:Add(whisperNotify, 8, 12) end -- Stinkies do local r, g, b, a = GetNextColor() local stinkiesConfigFrame = GridFrame.new("HeimdallStinkiesConfig", UIParent, 12, 20) stinkiesConfigFrame.frame:SetBackdropColor(r, g, b, 0.3) configFrame:Add(stinkiesConfigFrame, 28, 6) -- 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("HeimdallStinkiesConfigTitle", stinkiesConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.stinkies, { r, g, b, a }) stinkiesConfigFrame:Add(title, 1, 12) local stinkies = CreateBasicBigEditBox("HeimdallStinkiesConfigStinkies", stinkiesConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.stinkies, MapKeyToString(Heimdall_Data.config.stinkies, ","), function(self) local text = self:GetText() Heimdall_Data.config.stinkies = StringToMap(text, ",") end) stinkiesConfigFrame:Add(stinkies, 16, 12) end --configFrame.frame:Hide() print("[Heimdall] Config loaded") end SlashCmdList["HEIMDALL_CONFIG"] = function() configFrame.frame:Show() end SLASH_HEIMDALL_CONFIG1 = "/heimdall_config" SLASH_HEIMDALL_CONFIG2 = "/hc"