1408 lines
60 KiB
Lua
1408 lines
60 KiB
Lua
local addonname, shared = ...
|
|
---@cast shared HeimdallShared
|
|
---@cast addonname string
|
|
|
|
---@param str string
|
|
---@return table<string, boolean>
|
|
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<any, any>
|
|
---@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<any, any>
|
|
---@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<number, number>
|
|
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<number, table<number, boolean>>
|
|
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)
|
|
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
|
|
if not self.occupancy[r] or self.occupancy[r][c] then
|
|
canPlace = false
|
|
break
|
|
end
|
|
if not canPlace then break end
|
|
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,
|
|
40, 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()
|
|
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 title = configFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
|
title:SetText("Heimdall Config")
|
|
configFrame:Add(title, 1, 12)
|
|
|
|
-- 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, 5, 3)
|
|
|
|
local title = CreateFancyText("HeimdallSpotterConfigTitle", spotterConfigFrame.frame, "Spotter", { r, g, b, a })
|
|
spotterConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallSpotterConfigDebugButton",
|
|
spotterConfigFrame.frame, "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, "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, "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, "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, "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, "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, "Notify Channel",
|
|
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, "Zone Override",
|
|
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, "Throttle Time",
|
|
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, 9, 3)
|
|
|
|
local title = CreateFancyText("HeimdallWhoerConfigTitle", whoerConfigFrame.frame, "Whoer", { r, g, b, a })
|
|
whoerConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallWhoerConfigDebugButton",
|
|
whoerConfigFrame.frame, "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, "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, "Do Whisper", 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, "Notify Channel",
|
|
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, "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, "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, "Zone Notify For",
|
|
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, 3, 3)
|
|
|
|
local title = CreateFancyText("HeimdallMessengerConfigTitle", messengerConfigFrame.frame, "Messenger",
|
|
{ r, g, b, a })
|
|
messengerConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallMessengerConfigDebugButton",
|
|
messengerConfigFrame.frame, "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, "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, "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, 6, 3)
|
|
|
|
local title = CreateFancyText("HeimdallDeathReporterConfigTitle", deathReporterConfigFrame.frame,
|
|
"Death Reporter",
|
|
{ r, g, b, a })
|
|
deathReporterConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallDeathReporterConfigDebugButton",
|
|
deathReporterConfigFrame.frame, "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, "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, "Do Whisper", 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, "Throttle Time",
|
|
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, "Duel Throttle",
|
|
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 notifyChannel = CreateBasicSmallEditBox("HeimdallDeathReporterConfigNotifyChannel",
|
|
deathReporterConfigFrame.frame, "Notify Channel",
|
|
Heimdall_Data.config.deathReporter.notifyChannel,
|
|
function(self)
|
|
local text = self:GetText()
|
|
if string.match(text, "%S+") then
|
|
Heimdall_Data.config.deathReporter.notifyChannel = text
|
|
print("Notify channel set to", tostring(text))
|
|
else
|
|
print("Invalid channel name", tostring(text))
|
|
self:SetText(Heimdall_Data.config.deathReporter.notifyChannel)
|
|
end
|
|
end)
|
|
deathReporterConfigFrame:Add(notifyChannel, 2, 6)
|
|
|
|
local zoneOverride = CreateBasicSmallEditBox("HeimdallDeathReporterConfigZoneOverride",
|
|
deathReporterConfigFrame.frame, "Zone Override",
|
|
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, 7, 3)
|
|
|
|
local title = CreateFancyText("HeimdallInviterConfigTitle", inviterConfigFrame.frame, "Inviter", { r, g, b, a })
|
|
inviterConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallInviterConfigDebugButton",
|
|
inviterConfigFrame.frame, "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, "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, "All Assist", 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, "Agents Assist", 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, "Kick Offline", 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, "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, "Listening Channel",
|
|
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, "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, "Cleanup Interval",
|
|
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, "Afk Threshold",
|
|
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, 2, 3)
|
|
|
|
local title = CreateFancyText("HeimdallDuelerConfigTitle", duelerConfigFrame.frame, "Dueler", { r, g, b, a })
|
|
duelerConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallDuelerConfigDebugButton",
|
|
duelerConfigFrame.frame, "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, "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, "Decline Other", 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, 3, 3)
|
|
|
|
local title = CreateFancyText("HeimdallAgentTrackerConfigTitle", agentTrackerConfigFrame.frame, "Agent Tracker",
|
|
{ r, g, b, a })
|
|
agentTrackerConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallAgentTrackerConfigDebugButton",
|
|
agentTrackerConfigFrame.frame, "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, "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, "Master Channel",
|
|
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, 3, 3)
|
|
|
|
local title = CreateFancyText("HeimdallStinkyTrackerConfigTitle", stinkyTrackerConfigFrame.frame,
|
|
"Stinky Tracker",
|
|
{ r, g, b, a })
|
|
stinkyTrackerConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallStinkyTrackerConfigDebugButton",
|
|
stinkyTrackerConfigFrame.frame, "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, "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, "Master Channel",
|
|
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, 4, 3)
|
|
|
|
local title = CreateFancyText("HeimdallEmoterConfigTitle", emoterConfigFrame.frame, "Emoter",
|
|
{ r, g, b, a })
|
|
emoterConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallEmoterConfigDebugButton",
|
|
emoterConfigFrame.frame, "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, "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, "Master Channel",
|
|
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, "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, 4, 3)
|
|
|
|
local title = CreateFancyText("HeimdallEchoerConfigTitle", echoerConfigFrame.frame, "Echoer",
|
|
{ r, g, b, a })
|
|
echoerConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallEchoerConfigDebugButton",
|
|
echoerConfigFrame.frame, "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, "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, "Master Channel",
|
|
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, "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, 6, 3)
|
|
|
|
local title = CreateFancyText("HeimdallCommanderConfigTitle", commanderConfigFrame.frame, "Commander",
|
|
{ r, g, b, a })
|
|
commanderConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallCommanderConfigDebugButton",
|
|
commanderConfigFrame.frame, "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, "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, "Master Channel",
|
|
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, "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, "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, 4, 3)
|
|
|
|
local title = CreateFancyText("HeimdallMacroerConfigTitle", macroerConfigFrame.frame, "Macroer",
|
|
{ r, g, b, a })
|
|
macroerConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallMacroerConfigDebugButton",
|
|
macroerConfigFrame.frame, "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, "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, "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, 3, 3)
|
|
|
|
local title = CreateFancyText("HeimdallCombatAlerterConfigTitle", combatAlerterConfigFrame.frame,
|
|
"Combat Alerter",
|
|
{ r, g, b, a })
|
|
combatAlerterConfigFrame:Add(title, 1, 8)
|
|
local debugButton = CreateBasicButton("HeimdallCombatAlerterConfigDebugButton",
|
|
combatAlerterConfigFrame.frame, "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, "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, "Master Channel",
|
|
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
|
|
|
|
-- 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, 9, 3)
|
|
|
|
local title = CreateFancyText("HeimdallWhisperNotifyConfigTitle", whisperNotifyConfigFrame.frame,
|
|
"Whisper Notify",
|
|
{ r, g, b, a })
|
|
whisperNotifyConfigFrame:Add(title, 1, 12)
|
|
|
|
local whisperNotify = CreateBasicBigEditBox("HeimdallWhisperNotifyConfigWhisperNotify",
|
|
whisperNotifyConfigFrame.frame, "Whisper Notify",
|
|
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, 14, 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,
|
|
"Stinkies",
|
|
{ r, g, b, a })
|
|
stinkiesConfigFrame:Add(title, 1, 12)
|
|
|
|
local stinkies = CreateBasicBigEditBox("HeimdallStinkiesConfigStinkies",
|
|
stinkiesConfigFrame.frame, "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"
|