Implement basic structure for network
This commit is contained in:
16
Heimdall.lua
16
Heimdall.lua
@@ -19,6 +19,7 @@ local function init()
|
||||
---@field messenger HeimdallMessengerData
|
||||
---@field who HeimdallWhoData
|
||||
---@field stinkyTracker HeimdallStinkyTrackerData
|
||||
---@field networkNodes string[]
|
||||
---@field _L Localization
|
||||
---@field VERSION string
|
||||
---@field dumpTable fun(table: any, depth?: number): nil
|
||||
@@ -45,6 +46,7 @@ local function init()
|
||||
---@field MinimapTagger InitTable
|
||||
---@field BonkDetector InitTable
|
||||
---@field Noter InitTable
|
||||
---@field Network InitTable
|
||||
|
||||
--- Config ---
|
||||
---@class HeimdallConfig
|
||||
@@ -65,6 +67,7 @@ local function init()
|
||||
---@field sniffer HeimdallSnifferConfig
|
||||
---@field bonkDetector HeimdallBonkDetectorConfig
|
||||
---@field noter HeimdallNoterConfig
|
||||
---@field network HeimdallNetworkConfig
|
||||
---@field whisperNotify table<string, string>
|
||||
---@field stinkies table<string, boolean>
|
||||
---@field agents table<string, string>
|
||||
@@ -215,6 +218,12 @@ local function init()
|
||||
---@field debug boolean
|
||||
---@field masterChannel string
|
||||
|
||||
---@class HeimdallNetworkConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field members string[]
|
||||
---@field addonPrefix string
|
||||
|
||||
--- Data ---
|
||||
---@class HeimdallMessengerData
|
||||
---@field queue table<string, Message>
|
||||
@@ -431,6 +440,12 @@ local function init()
|
||||
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "noter", "masterChannel" }, "Agent"),
|
||||
lastNotes = shared.GetOrDefault(Heimdall_Data, { "config", "noter", "lastNotes" }, 5),
|
||||
},
|
||||
network = {
|
||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "network", "enabled" }, false),
|
||||
debug = shared.GetOrDefault(Heimdall_Data, { "config", "network", "debug" }, false),
|
||||
members = shared.GetOrDefault(Heimdall_Data, { "config", "network", "members" }, {}),
|
||||
addonPrefix = shared.GetOrDefault(Heimdall_Data, { "config", "network", "addonPrefix" }, "HEIMDALL_NETWORK"),
|
||||
}
|
||||
}
|
||||
|
||||
shared.raceMap = {
|
||||
@@ -546,6 +561,7 @@ local function init()
|
||||
shared.BonkDetector.Init()
|
||||
shared.Sniffer.Init()
|
||||
shared.Noter.Init()
|
||||
shared.Network.Init()
|
||||
print("Heimdall loaded!")
|
||||
end
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ Modules/DumpTable.lua
|
||||
Modules/Spotter.lua
|
||||
Modules/Whoer.lua
|
||||
Modules/Messenger.lua
|
||||
Modules/Network.lua
|
||||
Modules/DeathReporter.lua
|
||||
Modules/Inviter.lua
|
||||
Modules/Dueler.lua
|
||||
|
||||
@@ -1842,7 +1842,7 @@ function shared.Config.Init()
|
||||
local noterConfigFrame = GridFrame.new("HeimdallNoterConfig",
|
||||
UIParent, 12, 20)
|
||||
noterConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(noterConfigFrame, 5, 3)
|
||||
configFrame:Add(noterConfigFrame, 7, 3)
|
||||
|
||||
local title = CreateFancyText("HeimdallNoterConfigTitle", noterConfigFrame.frame,
|
||||
shared.L[Heimdall_Data.config.locale].config.noter,
|
||||
@@ -1897,6 +1897,62 @@ function shared.Config.Init()
|
||||
noterConfigFrame:Add(lastNotes, 2, 6)
|
||||
end
|
||||
|
||||
-- Network
|
||||
do
|
||||
local r, g, b, a = GetNextColor()
|
||||
local networkConfigFrame = GridFrame.new("HeimdallNetworkConfig",
|
||||
UIParent, 12, 20)
|
||||
networkConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(networkConfigFrame, 11, 3)
|
||||
|
||||
local title = CreateFancyText("HeimdallNetworkConfigTitle", networkConfigFrame.frame,
|
||||
shared.L[Heimdall_Data.config.locale].config.network,
|
||||
{ r, g, b, a })
|
||||
networkConfigFrame:Add(title, 1, 8)
|
||||
|
||||
local debugButton = CreateBasicButton("HeimdallNetworkConfigDebugButton",
|
||||
networkConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.debug, function()
|
||||
Heimdall_Data.config.network.debug = not Heimdall_Data.config.network.debug
|
||||
return Heimdall_Data.config.network.debug
|
||||
end)
|
||||
debugButton:UpdateColor(Heimdall_Data.config.network.debug)
|
||||
networkConfigFrame:Add(debugButton, 1, 4)
|
||||
|
||||
local enableButton = CreateBasicButton("HeimdallNetworkConfigEnableButton",
|
||||
networkConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.enabled, function()
|
||||
Heimdall_Data.config.network.enabled = not Heimdall_Data.config.network.enabled
|
||||
return Heimdall_Data.config.network.enabled
|
||||
end)
|
||||
enableButton:UpdateColor(Heimdall_Data.config.network.enabled)
|
||||
networkConfigFrame:Add(enableButton, 1, 12)
|
||||
|
||||
local addonPrefix = CreateBasicSmallEditBox("HeimdallNetworkConfigAddonPrefix",
|
||||
networkConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.addonPrefix,
|
||||
Heimdall_Data.config.network.addonPrefix,
|
||||
function(self)
|
||||
local text = self:GetText()
|
||||
if string.match(text, "%S+") then
|
||||
Heimdall_Data.config.network.addonPrefix = text
|
||||
print("Addon prefix set to", tostring(text))
|
||||
else
|
||||
print("Invalid addon prefix", tostring(text))
|
||||
self:SetText(Heimdall_Data.config.network.addonPrefix)
|
||||
end
|
||||
end)
|
||||
networkConfigFrame:Add(addonPrefix, 2, 6)
|
||||
|
||||
local members = CreateBasicBigEditBox("HeimdallNetworkConfigMembers",
|
||||
networkConfigFrame.frame, shared.L[Heimdall_Data.config.locale].config.members,
|
||||
table.concat(Heimdall_Data.config.network.members, ","),
|
||||
function(self)
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.network.members = StringToArray(text, ",")
|
||||
print("Members set to", table.concat(Heimdall_Data.config.network.members, ","))
|
||||
self:SetText(table.concat(Heimdall_Data.config.network.members, ","))
|
||||
end)
|
||||
networkConfigFrame:Add(members, 5, 6)
|
||||
end
|
||||
|
||||
-- Whisper Notify
|
||||
do
|
||||
local r, g, b, a = GetNextColor()
|
||||
|
||||
10
Modules/Network.lua
Normal file
10
Modules/Network.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
local addonname, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
---@cast addonname string
|
||||
local ModuleName = "Network"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Network = {}
|
||||
function shared.Network.Init()
|
||||
print("[Heimdall] Network module loaded")
|
||||
end
|
||||
6
_L.lua
6
_L.lua
@@ -81,6 +81,9 @@ shared.L = {
|
||||
assist = "Assist",
|
||||
kickOffline = "Kick Offline",
|
||||
lastNotes = "Last Notes",
|
||||
network = "Network",
|
||||
addonPrefix = "Addon Prefix",
|
||||
members = "Members",
|
||||
},
|
||||
},
|
||||
ru = {
|
||||
@@ -161,6 +164,9 @@ shared.L = {
|
||||
kickOffline = "Кик Оффлайн",
|
||||
bonkDetector = "Детектор Ударов",
|
||||
lastNotes = "Последние Заметки",
|
||||
network = "Сеть",
|
||||
addonPrefix = "Префикс Аддона",
|
||||
members = "Участники",
|
||||
},
|
||||
zones = {
|
||||
["Orgrimmar"] = "Оргриммар",
|
||||
|
||||
Reference in New Issue
Block a user