Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
7eee3a13a6 | |||
263cf8e2e4 | |||
ccbf0f8dc2 | |||
63027c2dcf | |||
d46c874604 | |||
fd4f707b6c | |||
1168876dcc | |||
bdf5afe436 | |||
85ff907f05 | |||
7ae9db030b | |||
edf8a12865 | |||
d081eedd47 | |||
8532db5a25 | |||
26e783ee2e | |||
4bd237abef | |||
0ab14de0e2 | |||
a25b6a20d5 | |||
e85c14ea45 | |||
a564178ca2 | |||
b4a4011b18 | |||
3f3d252104 | |||
287be2a31c | |||
3ef0e4c935 | |||
ce92e8e12c | |||
03597d1b5e | |||
36ad9783e5 | |||
565db30125 | |||
017cbf01f8 | |||
b16cf762ac | |||
0057ac3a5c | |||
0edf0561d8 | |||
1129d787b5 | |||
8a24496801 | |||
6cb918c13c | |||
e3eefadb75 | |||
eab562b36d | |||
20a7c0eead | |||
f70c5adfcf |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -0,0 +1 @@
|
||||
scratch.lua
|
||||
|
@@ -1,5 +1,5 @@
|
||||
globals = { "CykaPersistentData", "CreateFrame", "GetItemInfo", "aura_env" }
|
||||
unused_args = false
|
||||
max_line_length = 150
|
||||
max_line_length = 500
|
||||
exclude_files = { "Meta/" }
|
||||
global = false
|
269
Heimdall.lua
269
Heimdall.lua
@@ -18,7 +18,8 @@ local function init()
|
||||
---@field classColors table<string, string>
|
||||
---@field messenger HeimdallMessengerData
|
||||
---@field who HeimdallWhoData
|
||||
---@field stinkyTracker HeimdallStinkyTrackerData
|
||||
---@field stinkyTracker StinkyTrackerData
|
||||
---@field agentTracker AgentTrackerData
|
||||
---@field networkNodes string[]
|
||||
---@field network HeimdallNetworkData
|
||||
---@field networkMessenger HeimdallNetworkMessengerData
|
||||
@@ -26,7 +27,7 @@ local function init()
|
||||
---@field _L fun(key: string, locale: string): string
|
||||
---@field _Locale Localization
|
||||
---@field VERSION string
|
||||
---@field dumpTable fun(table: any, depth?: number): nil
|
||||
---@field dump fun(table: any, msg?: string, depth?: number): nil
|
||||
---@field utf8len fun(input: string): number
|
||||
---@field padString fun(input: string, targetLength: number, left?: boolean): string
|
||||
---@field GetOrDefault fun(table: table<any, any>, keys: string[], default: any): any
|
||||
@@ -35,30 +36,31 @@ local function init()
|
||||
---@field Memoize fun(f: function): function
|
||||
---@field GetLocaleForChannel fun(channel: string): string
|
||||
---@field WhoQueryService WhoQueryService
|
||||
---@field Whoer InitTable|{ShouldNotifyForZone: fun(zone: string): boolean}
|
||||
---@field Messenger InitTable
|
||||
---@field Spotter InitTable
|
||||
---@field DeathReporter InitTable
|
||||
---@field Inviter InitTable
|
||||
---@field Dueler InitTable
|
||||
---@field Bully InitTable
|
||||
---@field AgentTracker InitTable
|
||||
---@field Emoter InitTable
|
||||
---@field Echoer InitTable
|
||||
---@field Macroer InitTable
|
||||
---@field Commander InitTable
|
||||
---@field StinkyTracker InitTable
|
||||
---@field CombatAlerter InitTable
|
||||
---@field Config InitTable
|
||||
---@field Sniffer InitTable
|
||||
---@field MinimapTagger InitTable
|
||||
---@field BonkDetector InitTable
|
||||
---@field Noter InitTable
|
||||
---@field Network InitTable
|
||||
---@field NetworkMessenger InitTable
|
||||
---@field StinkyCache InitTable
|
||||
---@field Configurator InitTable
|
||||
---@field AchievementSniffer InitTable
|
||||
---@field AchievementSniffer AchievementSniffer
|
||||
---@field AgentTracker AgentTracker
|
||||
---@field BonkDetector BonkDetector
|
||||
---@field Bully Bully
|
||||
---@field CombatAlerter CombatAlerter
|
||||
---@field Commander Commander
|
||||
---@field Config Config
|
||||
---@field Configurator Configurator
|
||||
---@field DeathReporter DeathReporter
|
||||
---@field Dueler Dueler
|
||||
---@field Echoer Echoer
|
||||
---@field Emoter Emoter
|
||||
---@field Inviter Inviter
|
||||
---@field Macroer Macroer
|
||||
---@field Messenger Messenger
|
||||
---@field MinimapTagger MinimapTagger
|
||||
---@field Network Network
|
||||
---@field NetworkMessenger NetworkMessenger
|
||||
---@field Noter Noter
|
||||
---@field Sniffer Sniffer
|
||||
---@field Spotter Spotter
|
||||
---@field StinkyCache StinkyCache
|
||||
---@field StinkyTracker StinkyTracker
|
||||
---@field Whoer Whoer
|
||||
---@field ChatSniffer ChatSniffer
|
||||
|
||||
--- Config ---
|
||||
---@class HeimdallConfig
|
||||
@@ -68,7 +70,6 @@ local function init()
|
||||
---@field deathReporter HeimdallDeathReporterConfig
|
||||
---@field inviter HeimdallInviterConfig
|
||||
---@field dueler HeimdallDuelerConfig
|
||||
---@field bully HeimdallBullyConfig
|
||||
---@field agentTracker HeimdallAgentTrackerConfig
|
||||
---@field emoter HeimdallEmoterConfig
|
||||
---@field echoer HeimdallEchoerConfig
|
||||
@@ -77,13 +78,13 @@ local function init()
|
||||
---@field stinkyTracker HeimdallStinkyTrackerConfig
|
||||
---@field combatAlerter HeimdallCombatAlerterConfig
|
||||
---@field sniffer HeimdallSnifferConfig
|
||||
---@field bonkDetector HeimdallBonkDetectorConfig
|
||||
---@field noter HeimdallNoterConfig
|
||||
---@field network HeimdallNetworkConfig
|
||||
---@field networkMessenger HeimdallNetworkMessengerConfig
|
||||
---@field configurator HeimdallConfiguratorConfig
|
||||
---@field stinkyCache HeimdallStinkyCacheConfig
|
||||
---@field achievementSniffer HeimdallAchievementSnifferConfig
|
||||
---@field chatSniffer HeimdallChatSnifferConfig
|
||||
---@field whisperNotify table<string, string>
|
||||
---@field addonPrefix string
|
||||
---@field stinkies table<string, boolean>
|
||||
@@ -94,203 +95,6 @@ local function init()
|
||||
---@field locale string
|
||||
---@field debug boolean
|
||||
|
||||
---@class HeimdallSpotterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field everyone boolean
|
||||
---@field hostile boolean
|
||||
---@field alliance boolean
|
||||
---@field stinky boolean
|
||||
---@field channels string[]
|
||||
---@field zoneOverride string?
|
||||
---@field throttleTime number
|
||||
|
||||
---@class HeimdallWhoConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field ignored table<string, boolean>
|
||||
---@field channels string[]
|
||||
---@field ttl number
|
||||
---@field doWhisper boolean
|
||||
---@field zoneNotifyFor table<string, boolean>
|
||||
---@field queries string
|
||||
|
||||
---@class HeimdallMessengerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field interval number
|
||||
|
||||
---@class HeimdallDeathReporterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field throttle number
|
||||
---@field doWhisper boolean
|
||||
---@field channels string[]
|
||||
---@field zoneOverride string?
|
||||
---@field duelThrottle number
|
||||
|
||||
---@class HeimdallInviterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field keyword string
|
||||
---@field allAssist boolean
|
||||
---@field agentsAssist boolean
|
||||
---@field throttle number
|
||||
---@field kickOffline boolean
|
||||
---@field cleanupInterval number
|
||||
---@field afkThreshold number
|
||||
---@field listeningChannel table<string, boolean>
|
||||
|
||||
---@class HeimdallDuelerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field declineOther boolean
|
||||
|
||||
---@class HeimdallBullyConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
|
||||
---@class HeimdallAgentTrackerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
|
||||
---@class HeimdallEmoterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field prefix string
|
||||
|
||||
---@class HeimdallEchoerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field prefix string
|
||||
|
||||
---@class HeimdallMacroerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field priority string[]
|
||||
|
||||
---@class HeimdallCommanderConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field commander string
|
||||
---@field commands table<string, boolean>
|
||||
|
||||
---@class HeimdallStinkyTrackerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
|
||||
---@class HeimdallCombatAlerterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
|
||||
---@class HeimdallSnifferConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field throttle number
|
||||
---@field zoneOverride string?
|
||||
---@field stinky boolean
|
||||
|
||||
---@class HeimdallMinimapTaggerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field throttle number
|
||||
---@field scale number
|
||||
---@field tagTTL number
|
||||
---@field tagSound boolean
|
||||
---@field tagSoundFile string
|
||||
---@field tagSoundThrottle number
|
||||
---@field tagTextureFile string
|
||||
---@field alertTTL number
|
||||
---@field alertSound boolean
|
||||
---@field alertSoundFile string
|
||||
---@field alertSoundThrottle number
|
||||
---@field alertTextureFile string
|
||||
---@field combatTTL number
|
||||
---@field combatSound boolean
|
||||
---@field combatSoundFile string
|
||||
---@field combatSoundThrottle number
|
||||
---@field combatTextureFile string
|
||||
---@field helpTTL number
|
||||
---@field helpSound boolean
|
||||
---@field helpSoundFile string
|
||||
---@field helpSoundThrottle number
|
||||
---@field helpTextureFile string
|
||||
|
||||
---@class HeimdallBonkDetectorConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field throttle number
|
||||
|
||||
---@class HeimdallNoterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field lastNotes number
|
||||
|
||||
---@class HeimdallNetworkConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field members string[]
|
||||
---@field updateInterval number
|
||||
|
||||
---@class HeimdallNetworkMessengerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field interval number
|
||||
|
||||
---@class HeimdallConfiguratorConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
|
||||
---@class HeimdallStinkyCacheConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field commander string
|
||||
---@field ttl number
|
||||
|
||||
---@class HeimdallAchievementSnifferConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
-----@field texture string
|
||||
-----@field offsetX number
|
||||
-----@field offsetY number
|
||||
---@field rescan boolean
|
||||
---@field scanInterval number
|
||||
-----@field iconScale number
|
||||
|
||||
--- Data ---
|
||||
---@class HeimdallMessengerData
|
||||
---@field queue table<string, Message>
|
||||
---@field ticker Timer?
|
||||
|
||||
---@class HeimdallNetworkMessengerData
|
||||
---@field queue table<string, Message>
|
||||
---@field ticker Timer?
|
||||
|
||||
---@class HeimdallWhoData
|
||||
---@field updateTicker number?
|
||||
---@field whoTicker number?
|
||||
---@field ignored table<string, boolean>
|
||||
|
||||
---@class HeimdallStinkyTrackerData
|
||||
---@field stinkies ReactiveValue
|
||||
|
||||
---@class HeimdallNetworkData
|
||||
---@field ticker number?
|
||||
|
||||
---@class HeimdallStinkyCacheData
|
||||
---@field stinkies table<string, {value: number, timestamp: number}>
|
||||
|
||||
shared.GetOrDefault = function(table, keys, default)
|
||||
local value = default
|
||||
if not table then return value end
|
||||
@@ -310,16 +114,13 @@ local function init()
|
||||
return value
|
||||
end
|
||||
|
||||
shared.messenger = {
|
||||
queue = {},
|
||||
}
|
||||
shared.who = {
|
||||
ignored = {},
|
||||
}
|
||||
|
||||
--/run Heimdall_Data.config.who.queries="g-\"БеспредеЛ\"|ally"
|
||||
Heimdall_Data.config = {
|
||||
debug = shared.GetOrDefault(Heimdall_Data, { "config", "debug" }, false),
|
||||
chatSniffer = {
|
||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "chatSniffer", "enabled" }, false),
|
||||
debug = shared.GetOrDefault(Heimdall_Data, { "config", "chatSniffer", "debug" }, false),
|
||||
},
|
||||
spotter = {
|
||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "enabled" }, true),
|
||||
debug = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "debug" }, false),
|
||||
@@ -418,6 +219,7 @@ local function init()
|
||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "enabled" }, false),
|
||||
debug = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "debug" }, false),
|
||||
channels = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "channels" }, { "Agent" }),
|
||||
ignoredTimeout = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "ignoredTimeout" }, 600),
|
||||
},
|
||||
combatAlerter = {
|
||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "combatAlerter", "enabled" }, false),
|
||||
@@ -670,7 +472,7 @@ local function init()
|
||||
shared.Memoize = function(f)
|
||||
local mem = {} -- memoizing table
|
||||
setmetatable(mem, { __mode = "kv" }) -- make it weak
|
||||
return function(x) -- new version of ’f’, with memoizing
|
||||
return function(x) -- new version of 'f', with memoizing
|
||||
if Heimdall_Data.config.debug then print(string.format("[Heimdall] Memoize %s", tostring(x))) end
|
||||
local r = mem[x]
|
||||
if r == nil then -- no previous result?
|
||||
@@ -737,6 +539,7 @@ local function init()
|
||||
shared.Configurator.Init()
|
||||
shared.StinkyCache.Init()
|
||||
shared.AchievementSniffer.Init()
|
||||
shared.ChatSniffer.Init()
|
||||
print("Heimdall loaded!")
|
||||
end
|
||||
|
||||
|
@@ -3,7 +3,7 @@
|
||||
## Version: 3.12.0
|
||||
## Notes: Watches over areas and alerts when hostiles spotted
|
||||
## Author: Cyka
|
||||
## SavedVariables: Heimdall_Data, Heimdall_Achievements
|
||||
## SavedVariables: Heimdall_Data, Heimdall_Achievements, Heimdall_Chat
|
||||
|
||||
_L.lua
|
||||
Modules/CLEUParser.lua
|
||||
@@ -33,4 +33,5 @@ Modules/NetworkMessenger.lua
|
||||
Modules/StinkyCache.lua
|
||||
Modules/Configurator.lua
|
||||
Modules/AchievementSniffer.lua
|
||||
Modules/ChatSniffer.lua
|
||||
Heimdall.lua
|
||||
|
2
Meta
2
Meta
Submodule Meta updated: e0b57e39fc...eee043a846
@@ -2,6 +2,16 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "AchievementSniffer"
|
||||
|
||||
---@class HeimdallAchievementSnifferConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
-----@field texture string
|
||||
-----@field offsetX number
|
||||
-----@field offsetY number
|
||||
---@field rescan boolean
|
||||
---@field scanInterval number
|
||||
-----@field iconScale number
|
||||
|
||||
-- local HeimdallRoot = "Interface\\AddOns\\Heimdall\\"
|
||||
-- local TextureRoot = HeimdallRoot .. "Texture\\"
|
||||
|
||||
@@ -74,9 +84,9 @@ local Achievements = {
|
||||
12448,
|
||||
}
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.AchievementSniffer = {}
|
||||
function shared.AchievementSniffer.Init()
|
||||
---@class AchievementSniffer
|
||||
shared.AchievementSniffer = {
|
||||
Init = function()
|
||||
if Heimdall_Data.config.achievementSniffer.debug then
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end
|
||||
@@ -289,5 +299,6 @@ function shared.AchievementSniffer.Init()
|
||||
end
|
||||
Tick()
|
||||
|
||||
print("[Heimdall] AchievementSniffer loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,9 +2,52 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "AgentTracker"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.AgentTracker = {}
|
||||
function shared.AgentTracker.Init()
|
||||
---@class AgentTrackerData
|
||||
---@field agents ReactiveValue<table<string, string>>
|
||||
|
||||
---@class HeimdallAgentTrackerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
|
||||
---@class AgentTracker
|
||||
shared.AgentTracker = {
|
||||
---@param name string
|
||||
---@return boolean
|
||||
Track = function(name)
|
||||
if not name then return false end
|
||||
local exists = shared.AgentTracker.IsAgent(name)
|
||||
if exists then return false end
|
||||
shared.agentTracker.agents[name] = date("%Y-%m-%dT%H:%M:%S")
|
||||
-- Heimdall_Data.config.agents[name] = date("%Y-%m-%dT%H:%M:%S")
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("[%s] Tracking new agent: %s", ModuleName, name))
|
||||
shared.dump(shared.agentTracker.agents)
|
||||
end
|
||||
return true
|
||||
end,
|
||||
---@param name string
|
||||
---@return boolean
|
||||
IsAgent = function(name)
|
||||
if not name then return false end
|
||||
return shared.agentTracker.agents[name] ~= nil
|
||||
end,
|
||||
---@param callback fun(agent: string)
|
||||
OnChange = function(callback) shared.agentTracker.agents:onChange(callback) end,
|
||||
---@param callback fun(agent: string)
|
||||
ForEach = function(callback)
|
||||
---@type table<string, string>
|
||||
local agents = shared.agentTracker.agents:get()
|
||||
for name, _ in pairs(agents) do
|
||||
callback(name)
|
||||
end
|
||||
end,
|
||||
---@return nil
|
||||
Init = function()
|
||||
shared.agentTracker = {
|
||||
agents = ReactiveValue.new(Heimdall_Data.config.agents),
|
||||
}
|
||||
|
||||
--/run Heimdall_Data.config.agents["Cyheuraeth"]=date("%Y-%m-%dT%H:%M:%S")
|
||||
---@type table<string, boolean>
|
||||
local channelRosterFrame = CreateFrame("Frame")
|
||||
@@ -37,21 +80,7 @@ function shared.AgentTracker.Init()
|
||||
local newAgents = 0
|
||||
for i = 1, count do
|
||||
name = GetChannelRosterInfo(index, i)
|
||||
if name then
|
||||
local isNewAgent = not Heimdall_Data.config.agents[name]
|
||||
Heimdall_Data.config.agents[name] = date("%Y-%m-%dT%H:%M:%S")
|
||||
if isNewAgent then newAgents = newAgents + 1 end
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(
|
||||
string.format(
|
||||
"[%s] %s agent: %s",
|
||||
ModuleName,
|
||||
isNewAgent and "Added new" or "Updated existing",
|
||||
name
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
shared.AgentTracker.Track(name)
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
@@ -89,19 +118,17 @@ function shared.AgentTracker.Init()
|
||||
end
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
|
||||
shared.dumpTable(Heimdall_Data.config.agentTracker)
|
||||
end
|
||||
|
||||
sender = string.match(sender, "^[^-]+")
|
||||
local isNewAgent = not Heimdall_Data.config.agents[sender]
|
||||
Heimdall_Data.config.agents[sender] = date("%Y-%m-%dT%H:%M:%S")
|
||||
local new = shared.AgentTracker.Track(sender)
|
||||
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
print(
|
||||
string.format(
|
||||
"[%s] %s agent from message: %s",
|
||||
ModuleName,
|
||||
isNewAgent and "Added new" or "Updated existing",
|
||||
new and "Added new" or "Updated existing",
|
||||
sender
|
||||
)
|
||||
)
|
||||
@@ -109,11 +136,9 @@ function shared.AgentTracker.Init()
|
||||
end)
|
||||
|
||||
if Heimdall_Data.config.agentTracker.debug then
|
||||
local count = 0
|
||||
for _ in pairs(Heimdall_Data.config.agents) do
|
||||
count = count + 1
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
shared.dump(shared.agentTracker.agents:get(), "Agents")
|
||||
end
|
||||
print(string.format("[%s] Module initialized - Tracking %d agents", ModuleName, count))
|
||||
end
|
||||
print("[Heimdall] AgentTracker loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,9 +2,16 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "BonkDetector"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.BonkDetector = {}
|
||||
function shared.BonkDetector.Init()
|
||||
---@class HeimdallBonkDetectorConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field throttle number
|
||||
|
||||
---@class BonkDetector
|
||||
shared.BonkDetector = {
|
||||
---@return nil
|
||||
Init = function()
|
||||
---@type table<string, number>
|
||||
local lastReportTime = {}
|
||||
|
||||
@@ -124,11 +131,12 @@ function shared.BonkDetector.Init()
|
||||
}
|
||||
if Heimdall_Data.config.bonkDetector.debug then
|
||||
print(string.format("[%s] Queuing bonk detector message", ModuleName))
|
||||
shared.dumpTable(message)
|
||||
shared.dump(message)
|
||||
end
|
||||
table.insert(shared.messenger.queue, message)
|
||||
end
|
||||
end)
|
||||
|
||||
print("[Heimdall] BonkDetector loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,9 +2,15 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Bully"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Bully = {}
|
||||
function shared.Bully.Init()
|
||||
---@class HeimdallBullyConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
|
||||
---@class Bully
|
||||
shared.Bully = {
|
||||
---@return nil
|
||||
Init = function()
|
||||
if Heimdall_Data.config.bully.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||
print("[Heimdall] Bully loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
49
Modules/ChatSniffer.lua
Normal file
49
Modules/ChatSniffer.lua
Normal file
@@ -0,0 +1,49 @@
|
||||
local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "ChatSniffer"
|
||||
|
||||
---@class HeimdallChatSnifferConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
|
||||
---@class ChatSniffer
|
||||
shared.ChatSniffer = {
|
||||
Init = function()
|
||||
Heimdall_Chat = Heimdall_Chat or {}
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("CHAT_MSG_SAY")
|
||||
frame:RegisterEvent("CHAT_MSG_YELL")
|
||||
frame:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||
frame:RegisterEvent("CHAT_MSG_WHISPER")
|
||||
frame:RegisterEvent("CHAT_MSG_CHANNEL_JOIN")
|
||||
frame:RegisterEvent("CHAT_MSG_CHANNEL_LEAVE")
|
||||
frame:RegisterEvent("CHAT_MSG_EMOTE")
|
||||
frame:RegisterEvent("CHAT_MSG_PARTY")
|
||||
frame:RegisterEvent("CHAT_MSG_PARTY_LEADER")
|
||||
frame:RegisterEvent("CHAT_MSG_RAID")
|
||||
frame:RegisterEvent("CHAT_MSG_RAID_LEADER")
|
||||
frame:RegisterEvent("CHAT_MSG_RAID_WARNING")
|
||||
frame:RegisterEvent("CHAT_MSG_SYSTEM")
|
||||
frame:RegisterEvent("CHAT_MSG_TEXT_EMOTE")
|
||||
frame:RegisterEvent("CHAT_MSG_YELL")
|
||||
frame:SetScript("OnEvent", function(self, event, msg, sender, language, channel)
|
||||
if not Heimdall_Data.config.chatSniffer.enabled then return end
|
||||
if not Heimdall_Data.config.chatSniffer.debug then
|
||||
shared.dump(string.format("[%s] got message", { event, msg, sender, language, channel }))
|
||||
end
|
||||
local timestamp = date("%Y-%m-%d %H:%M:%S")
|
||||
local log = string.format(
|
||||
"%s|%s|%s|%s|%s|%s",
|
||||
tostring(timestamp),
|
||||
tostring(event),
|
||||
tostring(sender),
|
||||
tostring(msg),
|
||||
tostring(language),
|
||||
tostring(channel)
|
||||
)
|
||||
Heimdall_Chat[#Heimdall_Chat + 1] = log
|
||||
end)
|
||||
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
@@ -2,9 +2,14 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "CombatAlerter"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.CombatAlerter = {}
|
||||
function shared.CombatAlerter.Init()
|
||||
---@class HeimdallCombatAlerterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
|
||||
---@class CombatAlerter
|
||||
shared.CombatAlerter = {
|
||||
Init = function()
|
||||
local alerted = {}
|
||||
local combatAlerterFrame = CreateFrame("Frame")
|
||||
combatAlerterFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||
@@ -53,7 +58,7 @@ function shared.CombatAlerter.Init()
|
||||
print(string.format("[%s] Combat event source: %s", ModuleName, source))
|
||||
end
|
||||
|
||||
if shared.stinkyTracker.stinkies and shared.stinkyTracker.stinkies[source] then
|
||||
if shared.StinkyTracker.IsStinky(source) then
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(
|
||||
string.format(
|
||||
@@ -106,7 +111,7 @@ function shared.CombatAlerter.Init()
|
||||
}
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("[%s] Queuing alert message", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
shared.dump(msg)
|
||||
end
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
end
|
||||
@@ -131,5 +136,6 @@ function shared.CombatAlerter.Init()
|
||||
end)
|
||||
|
||||
if Heimdall_Data.config.combatAlerter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||
print("[Heimdall] CombatAlerter loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,6 +2,13 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Commander"
|
||||
|
||||
---@class HeimdallCommanderConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field commander string
|
||||
---@field commands table<string, boolean>
|
||||
|
||||
local helpMessages = {
|
||||
ru = {
|
||||
"1) who - пишет вам никнеймы текущих врагов и локу.",
|
||||
@@ -31,9 +38,9 @@ local helpMessages = {
|
||||
},
|
||||
}
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Commander = {}
|
||||
function shared.Commander.Init()
|
||||
---@class Commander
|
||||
shared.Commander = {
|
||||
Init = function()
|
||||
---@param text string
|
||||
---@param size number
|
||||
---@return string[]
|
||||
@@ -103,6 +110,32 @@ function shared.Commander.Init()
|
||||
end
|
||||
return ret
|
||||
end
|
||||
-- This is really ugly, duplicating methods like this
|
||||
-- But I have no better idea
|
||||
-- We would have to drag reference channel all the way here
|
||||
-- And then in here do some kind of deciding based on the fucking channel locale
|
||||
-- That's also a nasty solution... I guess adding "kto" is better
|
||||
---@param arr table<string, Player>
|
||||
---@return string[]
|
||||
local function WhoRu(arr)
|
||||
local ret = {}
|
||||
for _, player in pairs(arr) do
|
||||
if shared.Whoer.ShouldNotifyForZone(player.zone) then
|
||||
shared.dump(player)
|
||||
ret[#ret + 1] = string.format(
|
||||
"%s/%s (%s) %s",
|
||||
player.name,
|
||||
shared._L(player.class, "ru"),
|
||||
shared._L(player.zone, "ru"),
|
||||
player.stinky and "(!!!!)" or ""
|
||||
)
|
||||
end
|
||||
end
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
print(string.format("[%s] Command result: %s", ModuleName, strjoin(", ", unpack(ret))))
|
||||
end
|
||||
return ret
|
||||
end
|
||||
---@param arr table<string, Player>
|
||||
---@return string[]
|
||||
local function WhoPartitioned(arr)
|
||||
@@ -116,10 +149,23 @@ function shared.Commander.Init()
|
||||
end
|
||||
---@param arr table<string, Player>
|
||||
---@return string[]
|
||||
local function WhoPartitionedRu(arr)
|
||||
local who = WhoRu(arr)
|
||||
local text = {}
|
||||
---@diagnostic disable-next-line: param-type-mismatch something wrong with luals, it's picking up the "wrong" unpack
|
||||
for _, line in pairs(Partition(strjoin(", ", unpack(who)), 200)) do
|
||||
text[#text + 1] = "кто: " .. line
|
||||
end
|
||||
return text
|
||||
end
|
||||
---@param arr table<string, Player>
|
||||
---@return string[]
|
||||
local function CountClass(arr)
|
||||
local ret = {}
|
||||
for _, player in pairs(arr) do
|
||||
if shared.Whoer.ShouldNotifyForZone(player.zone) then ret[player.class] = (ret[player.class] or 0) + 1 end
|
||||
if shared.Whoer.ShouldNotifyForZone(player.zone) then
|
||||
ret[player.class] = (ret[player.class] or 0) + 1
|
||||
end
|
||||
end
|
||||
local text = {}
|
||||
for class, count in pairs(ret) do
|
||||
@@ -152,12 +198,21 @@ function shared.Commander.Init()
|
||||
local function WhoPartitionedStinkies()
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
print(string.format("[%s] Executing: WhoPartitionedStinkies", ModuleName))
|
||||
shared.dumpTable(HeimdallStinkies)
|
||||
shared.dump(HeimdallStinkies)
|
||||
end
|
||||
local res = WhoPartitioned(HeimdallStinkies)
|
||||
if #res == 0 then return { "No stinkies found" } end
|
||||
return res
|
||||
end
|
||||
local function WhoPartitionedStinkiesRu()
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
print(string.format("[%s] Executing: WhoPartitionedStinkies", ModuleName))
|
||||
shared.dump(HeimdallStinkies)
|
||||
end
|
||||
local res = WhoPartitionedRu(HeimdallStinkies)
|
||||
if #res == 0 then return { "No stinkies found" } end
|
||||
return res
|
||||
end
|
||||
local function CountPartitionedStinkies()
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
print(string.format("[%s] Executing: CountPartitionedStinkies", ModuleName))
|
||||
@@ -234,12 +289,40 @@ function shared.Commander.Init()
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
print(string.format("[%s] Adding stinky: %s/%s", ModuleName, name, tostring(class)))
|
||||
end
|
||||
shared.stinkyTracker.stinkies[name] = {
|
||||
shared.StinkyTracker.Track({
|
||||
name = name,
|
||||
class = class or "unknown",
|
||||
seenAt = GetTime(),
|
||||
hostile = true,
|
||||
}
|
||||
})
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
print(string.format("[%s] Added stinky: %s/%s", ModuleName, name, tostring(class)))
|
||||
end
|
||||
end
|
||||
return {}
|
||||
end
|
||||
|
||||
---@param args string[]
|
||||
local function IgnoreMacroTarget(args)
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
---@diagnostic disable-next-line: param-type-mismatch something wrong with luals, it's picking up the "wrong" unpack
|
||||
print(string.format("[%s] Macroing: %s", ModuleName, strjoin(" ", unpack(args))))
|
||||
end
|
||||
if #args < 1 then
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
print(string.format("[%s] Invalid number of arguments for IgnoreMacroTarget", ModuleName))
|
||||
end
|
||||
return {}
|
||||
end
|
||||
table.remove(args, 1)
|
||||
|
||||
for i = 1, #args do
|
||||
local stinky = strtrim(args[i])
|
||||
local name = stinky:match("([^/]+)")
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
print(string.format("[%s] Ignoring stinky: %s", ModuleName, name))
|
||||
end
|
||||
shared.StinkyTracker.Ignore(name)
|
||||
end
|
||||
return {}
|
||||
end
|
||||
@@ -251,6 +334,7 @@ function shared.Commander.Init()
|
||||
|
||||
local commands = {
|
||||
{ keywordRe = "^who$", commanderOnly = false, callback = WhoPartitionedStinkies },
|
||||
{ keywordRe = "^кто$", commanderOnly = false, callback = WhoPartitionedStinkiesRu },
|
||||
{ keywordRe = "^howmany$", commanderOnly = false, callback = CountPartitionedStinkies },
|
||||
{ keywordRe = "^classes$", commanderOnly = false, callback = CountClassPartitionedStinkies },
|
||||
{ keywordRe = "^help$", commanderOnly = false, callback = HelpRu },
|
||||
@@ -259,6 +343,7 @@ function shared.Commander.Init()
|
||||
{ keywordRe = "^leavegroup$", commanderOnly = false, callback = LeaveGroup },
|
||||
{ keywordRe = "^follow$", commanderOnly = false, callback = FollowTarget },
|
||||
{ keywordRe = "^macro", commanderOnly = false, callback = MacroTarget },
|
||||
{ keywordRe = "^ignore", commanderOnly = false, callback = IgnoreMacroTarget },
|
||||
}
|
||||
|
||||
local commanderChannelFrame = CreateFrame("Frame")
|
||||
@@ -266,7 +351,7 @@ function shared.Commander.Init()
|
||||
commanderChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||
--if Heimdall_Data.config.commander.debug then
|
||||
-- print(string.format("[%s] Event received", ModuleName))
|
||||
-- shared.dumpTable(Heimdall_Data.config.commander)
|
||||
-- shared.dump(Heimdall_Data.config.commander)
|
||||
--end
|
||||
if not Heimdall_Data.config.commander.enabled then
|
||||
--if Heimdall_Data.config.commander.debug then
|
||||
@@ -300,18 +385,22 @@ function shared.Commander.Init()
|
||||
sender = string.match(sender, "^[^-]+")
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
print(string.format("[%s] Message from: %s", ModuleName, sender))
|
||||
shared.dumpTable(Heimdall_Data.config.commander)
|
||||
shared.dump(Heimdall_Data.config.commander)
|
||||
end
|
||||
|
||||
for _, command in ipairs(commands) do
|
||||
local enabled = Heimdall_Data.config.commander.commands[command.keywordRe] == true or false
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
print(string.format("[%s] Command match: %s = %s", ModuleName, command.keywordRe, tostring(enabled)))
|
||||
print(
|
||||
string.format("[%s] Command match: %s = %s", ModuleName, command.keywordRe, tostring(enabled))
|
||||
)
|
||||
end
|
||||
if
|
||||
enabled
|
||||
and (
|
||||
not command.commanderOnly
|
||||
-- if Heimdall_Data.config.commander.debug then print(string.format("[%s] Ignoring command, sender %s not commander %s", ModuleName, sender, Heimdall_Data.config.commander.commander)) end
|
||||
|
||||
or (command.commanderOnly and sender == Heimdall_Data.config.commander.commander)
|
||||
)
|
||||
then
|
||||
@@ -319,8 +408,8 @@ function shared.Commander.Init()
|
||||
---@diagnostic disable-next-line: redundant-parameter Currently luals does not support variadic functions as a @field
|
||||
local messages = command.callback({ strsplit(",", msg) })
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
print(string.format("[%s] Messages to send: %s", ModuleName, strjoin(", ", unpack(messages))))
|
||||
print(string.format("[%s] Messages to send: %s", ModuleName, #messages))
|
||||
shared.dump(messages)
|
||||
end
|
||||
for _, message in ipairs(messages) do
|
||||
---@type Message
|
||||
@@ -331,15 +420,19 @@ function shared.Commander.Init()
|
||||
}
|
||||
if Heimdall_Data.config.commander.debug then
|
||||
print(string.format("[%s] Queuing message", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
shared.dump(msg)
|
||||
end
|
||||
if Heimdall_Data.config.networkMessenger.enabled then
|
||||
shared.NetworkMessenger.Enqueue(returnmsg)
|
||||
elseif Heimdall_Data.config.messenger.enabled then
|
||||
shared.Messenger.Enqueue(returnmsg)
|
||||
end
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, returnmsg)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
print("[Heimdall] Commander module loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Config"
|
||||
|
||||
---@param str string
|
||||
---@return table<string, boolean>
|
||||
@@ -398,9 +399,9 @@ end
|
||||
--HeimdallTestFrame:SetWidth(512)
|
||||
--configFrame:Add(HeimdallTestFrame, 20, 12)
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Config = {}
|
||||
function shared.Config.Init()
|
||||
---@class Config
|
||||
shared.Config = {
|
||||
Init = function()
|
||||
configFrame.frame:SetScale(Heimdall_Data.config.scale)
|
||||
|
||||
local buttonColors = {
|
||||
@@ -570,7 +571,9 @@ function shared.Config.Init()
|
||||
)
|
||||
configFrame:Add(scale, 2, 2)
|
||||
local title = configFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
||||
title:SetText(string.format("%s - v%s", shared._L("heimdallConfig", Heimdall_Data.config.locale), shared.VERSION))
|
||||
title:SetText(
|
||||
string.format("%s - v%s", shared._L("heimdallConfig", Heimdall_Data.config.locale), shared.VERSION)
|
||||
)
|
||||
configFrame:Add(title, 2, 7)
|
||||
|
||||
local debug = CreateBasicButton(
|
||||
@@ -706,7 +709,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.spotter.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.spotter.channels)
|
||||
shared.dump(Heimdall_Data.config.spotter.channels)
|
||||
end
|
||||
)
|
||||
spotterConfigFrame:Add(channels, 2, 4)
|
||||
@@ -806,7 +809,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.who.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.who.channels)
|
||||
shared.dump(Heimdall_Data.config.who.channels)
|
||||
end
|
||||
)
|
||||
whoerConfigFrame:Add(channels, 2, 3)
|
||||
@@ -1018,7 +1021,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.deathReporter.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.deathReporter.channels)
|
||||
shared.dump(Heimdall_Data.config.deathReporter.channels)
|
||||
end
|
||||
)
|
||||
deathReporterConfigFrame:Add(channels, 2, 6)
|
||||
@@ -1143,7 +1146,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.inviter.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.inviter.channels)
|
||||
shared.dump(Heimdall_Data.config.inviter.channels)
|
||||
end
|
||||
)
|
||||
inviterConfigFrame:Add(channels, 2, 6)
|
||||
@@ -1298,7 +1301,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.agentTracker.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.agentTracker.channels)
|
||||
shared.dump(Heimdall_Data.config.agentTracker.channels)
|
||||
end
|
||||
)
|
||||
agentTrackerConfigFrame:Add(channels, 2, 6)
|
||||
@@ -1351,7 +1354,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.stinkyTracker.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.stinkyTracker.channels)
|
||||
shared.dump(Heimdall_Data.config.stinkyTracker.channels)
|
||||
end
|
||||
)
|
||||
stinkyTrackerConfigFrame:Add(channels, 2, 6)
|
||||
@@ -1404,7 +1407,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.emoter.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.emoter.channels)
|
||||
shared.dump(Heimdall_Data.config.emoter.channels)
|
||||
end
|
||||
)
|
||||
emoterConfigFrame:Add(channels, 2, 6)
|
||||
@@ -1475,7 +1478,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.echoer.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.echoer.channels)
|
||||
shared.dump(Heimdall_Data.config.echoer.channels)
|
||||
end
|
||||
)
|
||||
echoerConfigFrame:Add(channels, 2, 6)
|
||||
@@ -1546,7 +1549,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.commander.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.commander.channels)
|
||||
shared.dump(Heimdall_Data.config.commander.channels)
|
||||
end
|
||||
)
|
||||
commanderConfigFrame:Add(channels, 2, 6)
|
||||
@@ -1680,7 +1683,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.combatAlerter.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.combatAlerter.channels)
|
||||
shared.dump(Heimdall_Data.config.combatAlerter.channels)
|
||||
end
|
||||
)
|
||||
combatAlerterConfigFrame:Add(channels, 2, 6)
|
||||
@@ -1745,7 +1748,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.sniffer.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.sniffer.channels)
|
||||
shared.dump(Heimdall_Data.config.sniffer.channels)
|
||||
end
|
||||
)
|
||||
snifferConfigFrame:Add(channels, 2, 6)
|
||||
@@ -1835,7 +1838,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.bonkDetector.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.bonkDetector.channels)
|
||||
shared.dump(Heimdall_Data.config.bonkDetector.channels)
|
||||
end
|
||||
)
|
||||
bonkDetectorConfigFrame:Add(channels, 2, 6)
|
||||
@@ -1906,7 +1909,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.minimapTagger.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.minimapTagger.channels)
|
||||
shared.dump(Heimdall_Data.config.minimapTagger.channels)
|
||||
end
|
||||
)
|
||||
minimapTaggerConfigFrame:Add(channels, 2, 3)
|
||||
@@ -2275,7 +2278,7 @@ function shared.Config.Init()
|
||||
local text = self:GetText()
|
||||
Heimdall_Data.config.noter.channels = StringToArray(text, ",")
|
||||
print("Channels set to")
|
||||
shared.dumpTable(Heimdall_Data.config.noter.channels)
|
||||
shared.dump(Heimdall_Data.config.noter.channels)
|
||||
end
|
||||
)
|
||||
noterConfigFrame:Add(channels, 2, 6)
|
||||
@@ -2462,7 +2465,8 @@ function shared.Config.Init()
|
||||
achievementSnifferConfigFrame.frame,
|
||||
shared._L("enabled", Heimdall_Data.config.locale),
|
||||
function()
|
||||
Heimdall_Data.config.achievementSniffer.enabled = not Heimdall_Data.config.achievementSniffer.enabled
|
||||
Heimdall_Data.config.achievementSniffer.enabled =
|
||||
not Heimdall_Data.config.achievementSniffer.enabled
|
||||
return Heimdall_Data.config.achievementSniffer.enabled
|
||||
end
|
||||
)
|
||||
@@ -2656,9 +2660,50 @@ function shared.Config.Init()
|
||||
channelLocaleConfigFrame:Add(channelLocale, 8, 12)
|
||||
end
|
||||
|
||||
-- ChatSniffer
|
||||
do
|
||||
local r, g, b, a = GetNextColor()
|
||||
local chatSnifferConfigFrame = GridFrame.new("HeimdallChatSnifferConfig", UIParent, 12, 20)
|
||||
chatSnifferConfigFrame.frame:SetBackdropColor(r, g, b, 0.3)
|
||||
configFrame:Add(chatSnifferConfigFrame, 4, 1)
|
||||
|
||||
title = CreateFancyText(
|
||||
"HeimdallChatSnifferConfigTitle",
|
||||
chatSnifferConfigFrame.frame,
|
||||
shared._L("chatSniffer", Heimdall_Data.config.locale),
|
||||
{ r, g, b, a }
|
||||
)
|
||||
chatSnifferConfigFrame:Add(title, 1, 8)
|
||||
|
||||
local debugButton = CreateBasicButton(
|
||||
"HeimdallChatSnifferConfigDebugButton",
|
||||
chatSnifferConfigFrame.frame,
|
||||
shared._L("debug", Heimdall_Data.config.locale),
|
||||
function()
|
||||
Heimdall_Data.config.chatSniffer.debug = not Heimdall_Data.config.chatSniffer.debug
|
||||
return Heimdall_Data.config.chatSniffer.debug
|
||||
end
|
||||
)
|
||||
debugButton:UpdateColor(Heimdall_Data.config.chatSniffer.debug)
|
||||
chatSnifferConfigFrame:Add(debugButton, 1, 4)
|
||||
|
||||
local enableButton = CreateBasicButton(
|
||||
"HeimdallChatSnifferConfigEnableButton",
|
||||
chatSnifferConfigFrame.frame,
|
||||
shared._L("enabled", Heimdall_Data.config.locale),
|
||||
function()
|
||||
Heimdall_Data.config.chatSniffer.enabled = not Heimdall_Data.config.chatSniffer.enabled
|
||||
return Heimdall_Data.config.chatSniffer.enabled
|
||||
end
|
||||
)
|
||||
enableButton:UpdateColor(Heimdall_Data.config.chatSniffer.enabled)
|
||||
chatSnifferConfigFrame:Add(enableButton, 1, 12)
|
||||
end
|
||||
|
||||
configFrame.frame:Hide()
|
||||
print("[Heimdall] Config loaded")
|
||||
end
|
||||
end,
|
||||
}
|
||||
|
||||
SlashCmdList["HEIMDALL_CONFIG"] = function() configFrame.frame:Show() end
|
||||
SLASH_HEIMDALL_CONFIG1 = "/heimdall_config"
|
||||
|
@@ -2,6 +2,11 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Configurator"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Configurator = {}
|
||||
function shared.Configurator.Init() print(string.format("[Heimdall] %s module loaded", ModuleName)) end
|
||||
---@class HeimdallConfiguratorConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
|
||||
---@class Configurator
|
||||
shared.Configurator = {
|
||||
Init = function() print(string.format("[%s] Module initialized", ModuleName)) end,
|
||||
}
|
||||
|
@@ -2,9 +2,18 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "DeathReporter"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.DeathReporter = {}
|
||||
function shared.DeathReporter.Init()
|
||||
---@class HeimdallDeathReporterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field throttle number
|
||||
---@field doWhisper boolean
|
||||
---@field channels string[]
|
||||
---@field zoneOverride string?
|
||||
---@field duelThrottle number
|
||||
|
||||
---@class DeathReporter
|
||||
shared.DeathReporter = {
|
||||
Init = function()
|
||||
---@type table<string, number>
|
||||
local recentDeaths = {}
|
||||
---@type table<string, number>
|
||||
@@ -38,7 +47,8 @@ function shared.DeathReporter.Init()
|
||||
and GetTime() - recentDeaths[destination] < Heimdall_Data.config.deathReporter.throttle
|
||||
then
|
||||
if Heimdall_Data.config.deathReporter.debug then
|
||||
local timeLeft = Heimdall_Data.config.deathReporter.throttle - (GetTime() - recentDeaths[destination])
|
||||
local timeLeft = Heimdall_Data.config.deathReporter.throttle
|
||||
- (GetTime() - recentDeaths[destination])
|
||||
print(
|
||||
string.format(
|
||||
"[%s] Death report throttled for %s (%.1f seconds remaining)",
|
||||
@@ -168,7 +178,7 @@ function shared.DeathReporter.Init()
|
||||
}
|
||||
if Heimdall_Data.config.deathReporter.debug then
|
||||
print(string.format("[%s] Queuing death report message", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
shared.dump(msg)
|
||||
end
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
end
|
||||
@@ -222,7 +232,12 @@ function shared.DeathReporter.Init()
|
||||
if Heimdall_Data.config.deathReporter.debug then
|
||||
print(string.format("[%s] Received system message: %s", ModuleName, msg))
|
||||
print(
|
||||
string.format("[%s] Source: %s, Destination: %s", ModuleName, tostring(source), tostring(destination))
|
||||
string.format(
|
||||
"[%s] Source: %s, Destination: %s",
|
||||
ModuleName,
|
||||
tostring(source),
|
||||
tostring(destination)
|
||||
)
|
||||
)
|
||||
end
|
||||
if not source or not destination then return end
|
||||
@@ -248,5 +263,6 @@ function shared.DeathReporter.Init()
|
||||
)
|
||||
)
|
||||
end
|
||||
print("[Heimdall] DeathReporter loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,9 +2,14 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Dueler"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Dueler = {}
|
||||
function shared.Dueler.Init()
|
||||
---@class HeimdallDuelerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field declineOther boolean
|
||||
|
||||
---@class Dueler
|
||||
shared.Dueler = {
|
||||
Init = function()
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("DUEL_REQUESTED")
|
||||
frame:SetScript("OnEvent", function(self, event, sender)
|
||||
@@ -22,7 +27,7 @@ function shared.Dueler.Init()
|
||||
print(string.format("[%s] Checking if sender '%s' is in agents list", ModuleName, sender))
|
||||
end
|
||||
|
||||
local allow = Heimdall_Data.config.agents[sender]
|
||||
local allow = shared.AgentTracker.IsAgent(sender)
|
||||
if allow then
|
||||
if Heimdall_Data.config.dueler.debug then
|
||||
print(string.format("[%s] Accepting duel from trusted agent: %s", ModuleName, sender))
|
||||
@@ -36,7 +41,9 @@ function shared.Dueler.Init()
|
||||
CancelDuel()
|
||||
else
|
||||
if Heimdall_Data.config.dueler.debug then
|
||||
print(string.format("[%s] Leaving duel request from %s for manual response", ModuleName, sender))
|
||||
print(
|
||||
string.format("[%s] Leaving duel request from %s for manual response", ModuleName, sender)
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -51,5 +58,6 @@ function shared.Dueler.Init()
|
||||
)
|
||||
)
|
||||
end
|
||||
print("[Heimdall] Dueler loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -1,25 +1,31 @@
|
||||
local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
|
||||
if not shared.dumpTable then
|
||||
---@param table table
|
||||
if not shared.dump then
|
||||
---@param value any
|
||||
---@param msg string?
|
||||
---@param depth number?
|
||||
shared.dumpTable = function(table, depth)
|
||||
if not table then
|
||||
print(tostring(table))
|
||||
shared.dump = function(value, msg, depth)
|
||||
if not value then
|
||||
print(tostring(value))
|
||||
return
|
||||
end
|
||||
if type(value) ~= "table" then
|
||||
print(tostring(value))
|
||||
return
|
||||
end
|
||||
if msg then print(msg) end
|
||||
if depth == nil then depth = 0 end
|
||||
if depth > 200 then
|
||||
print("Error: Depth > 200 in dumpTable()")
|
||||
print("Error: Depth > 200 in dump()")
|
||||
return
|
||||
end
|
||||
for k, v in pairs(table) do
|
||||
for k, v in pairs(value) do
|
||||
if type(v) == "table" then
|
||||
print(string.rep(" ", depth) .. k .. ":")
|
||||
shared.dumpTable(v, depth + 1)
|
||||
print(string.rep(" ", depth) .. tostring(k) .. ":")
|
||||
shared.dump(v, msg, depth + 1)
|
||||
else
|
||||
print(string.rep(" ", depth) .. k .. ": ", v)
|
||||
print(string.rep(" ", depth) .. tostring(k) .. ": " .. tostring(v))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@@ -2,9 +2,15 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Echoer"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Echoer = {}
|
||||
function shared.Echoer.Init()
|
||||
---@class HeimdallEchoerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field prefix string
|
||||
|
||||
---@class Echoer
|
||||
shared.Echoer = {
|
||||
Init = function()
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||
frame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||
@@ -36,7 +42,7 @@ function shared.Echoer.Init()
|
||||
end
|
||||
if Heimdall_Data.config.echoer.debug then
|
||||
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
|
||||
shared.dumpTable(Heimdall_Data.config.echoer)
|
||||
shared.dump(Heimdall_Data.config.echoer)
|
||||
end
|
||||
|
||||
if string.find(msg, "^" .. Heimdall_Data.config.echoer.prefix) then
|
||||
@@ -54,5 +60,6 @@ function shared.Echoer.Init()
|
||||
end)
|
||||
|
||||
if Heimdall_Data.config.echoer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||
print("[Heimdall] Echoer loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,9 +2,15 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Emoter"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Emoter = {}
|
||||
function shared.Emoter.Init()
|
||||
---@class HeimdallEmoterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field prefix string
|
||||
|
||||
---@class Emoter
|
||||
shared.Emoter = {
|
||||
Init = function()
|
||||
local frame = CreateFrame("Frame")
|
||||
frame:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||
frame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||
@@ -37,7 +43,7 @@ function shared.Emoter.Init()
|
||||
|
||||
if Heimdall_Data.config.emoter.debug then
|
||||
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
|
||||
shared.dumpTable(Heimdall_Data.config.emoter)
|
||||
shared.dump(Heimdall_Data.config.emoter)
|
||||
end
|
||||
|
||||
if string.find(msg, "^" .. Heimdall_Data.config.emoter.prefix) then
|
||||
@@ -55,5 +61,6 @@ function shared.Emoter.Init()
|
||||
end)
|
||||
|
||||
if Heimdall_Data.config.emoter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||
print("[Heimdall] Emoter loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,9 +2,22 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Inviter"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Inviter = {}
|
||||
function shared.Inviter.Init()
|
||||
---@class HeimdallInviterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field keyword string
|
||||
---@field allAssist boolean
|
||||
---@field agentsAssist boolean
|
||||
---@field throttle number
|
||||
---@field kickOffline boolean
|
||||
---@field cleanupInterval number
|
||||
---@field afkThreshold number
|
||||
---@field listeningChannel table<string, boolean>
|
||||
|
||||
---@class Inviter
|
||||
shared.Inviter = {
|
||||
Init = function()
|
||||
-- Fallback for old config
|
||||
if type(Heimdall_Data.config.inviter.listeningChannel) == "string" then
|
||||
Heimdall_Data.config.inviter.listeningChannel = {
|
||||
@@ -35,29 +48,25 @@ function shared.Inviter.Init()
|
||||
|
||||
if Heimdall_Data.config.inviter.agentsAssist then
|
||||
if Heimdall_Data.config.inviter.debug then
|
||||
local agentCount = 0
|
||||
for _ in pairs(Heimdall_Data.config.agents) do
|
||||
agentCount = agentCount + 1
|
||||
end
|
||||
print(string.format("[%s] Processing %d agents for assistant promotion", ModuleName, agentCount))
|
||||
print(string.format("[%s] Processing agents for assistant promotion", ModuleName))
|
||||
end
|
||||
|
||||
for name, _ in pairs(Heimdall_Data.config.agents) do
|
||||
if UnitInParty(name) and not UnitIsGroupLeader(name) and not UnitIsRaidOfficer(name) then
|
||||
shared.AgentTracker.ForEach(function(agent)
|
||||
if UnitInParty(agent) and not UnitIsGroupLeader(agent) and not UnitIsRaidOfficer(agent) then
|
||||
if Heimdall_Data.config.inviter.debug then
|
||||
print(string.format("[%s] Promoting agent to assistant: %s", ModuleName, name))
|
||||
print(string.format("[%s] Promoting agent to assistant: %s", ModuleName, agent))
|
||||
end
|
||||
PromoteToAssistant(name, true)
|
||||
PromoteToAssistant(agent, true)
|
||||
elseif Heimdall_Data.config.inviter.debug then
|
||||
if not UnitInParty(name) then
|
||||
print(string.format("[%s] Agent not in party: %s", ModuleName, name))
|
||||
elseif UnitIsGroupLeader(name) then
|
||||
print(string.format("[%s] Agent is already leader: %s", ModuleName, name))
|
||||
elseif UnitIsRaidOfficer(name) then
|
||||
print(string.format("[%s] Agent is already assistant: %s", ModuleName, name))
|
||||
end
|
||||
if not UnitInParty(agent) then
|
||||
print(string.format("[%s] Agent not in party: %s", ModuleName, agent))
|
||||
elseif UnitIsGroupLeader(agent) then
|
||||
print(string.format("[%s] Agent is already leader: %s", ModuleName, agent))
|
||||
elseif UnitIsRaidOfficer(agent) then
|
||||
print(string.format("[%s] Agent is already assistant: %s", ModuleName, agent))
|
||||
end
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.inviter.debug then
|
||||
@@ -205,7 +214,7 @@ function shared.Inviter.Init()
|
||||
inviterChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||
--if Heimdall_Data.config.inviter.debug then
|
||||
-- print(string.format("[%s] Chat message received: %s", ModuleName, msg))
|
||||
-- shared.dumpTable(Heimdall_Data.config.inviter)
|
||||
-- shared.dump(Heimdall_Data.config.inviter)
|
||||
--end
|
||||
if not Heimdall_Data.config.inviter.enabled then return end
|
||||
local channelId = select(6, ...)
|
||||
@@ -229,7 +238,9 @@ function shared.Inviter.Init()
|
||||
return
|
||||
end
|
||||
if msg == Heimdall_Data.config.inviter.keyword then
|
||||
if Heimdall_Data.config.inviter.debug then print(string.format("[%s] Inviting %s", ModuleName, sender)) end
|
||||
if Heimdall_Data.config.inviter.debug then
|
||||
print(string.format("[%s] Inviting %s", ModuleName, sender))
|
||||
end
|
||||
InviteUnit(sender)
|
||||
else
|
||||
if Heimdall_Data.config.inviter.debug then
|
||||
@@ -259,5 +270,6 @@ function shared.Inviter.Init()
|
||||
)
|
||||
)
|
||||
end
|
||||
print("[Heimdall] Inviter loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,15 +2,14 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Macroer"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Macroer = {}
|
||||
function shared.Macroer.Init()
|
||||
---@class stinky
|
||||
---@field name string
|
||||
---@field class string
|
||||
---@field seenAt number
|
||||
---@field hostile boolean
|
||||
---@class HeimdallMacroerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field priority string[]
|
||||
|
||||
---@class Macroer
|
||||
shared.Macroer = {
|
||||
Init = function()
|
||||
local function FindOrCreateMacro(macroName)
|
||||
if Heimdall_Data.config.macroer.debug then
|
||||
print(string.format("[%s] Finding or creating macro: %s", ModuleName, macroName))
|
||||
@@ -27,7 +26,7 @@ function shared.Macroer.Init()
|
||||
return idx
|
||||
end
|
||||
|
||||
---@param stinkies table<string, stinky>
|
||||
---@param stinkies table<string, Stinky>
|
||||
local function FixMacro(stinkies)
|
||||
if Heimdall_Data.config.macroer.debug then
|
||||
print(string.format("[%s] Fixing macro with %d stinkies", ModuleName, #stinkies))
|
||||
@@ -53,7 +52,7 @@ function shared.Macroer.Init()
|
||||
|
||||
local sortedStinkies = {}
|
||||
for _, stinky in pairs(stinkies) do
|
||||
if not Heimdall_Data.config.agents[stinky.name] then sortedStinkies[#sortedStinkies + 1] = stinky end
|
||||
if not shared.AgentTracker.IsAgent(stinky.name) then sortedStinkies[#sortedStinkies + 1] = stinky end
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.macroer.debug then
|
||||
@@ -68,7 +67,7 @@ function shared.Macroer.Init()
|
||||
|
||||
if Heimdall_Data.config.macroer.debug then
|
||||
print(string.format("[%s] Sorted stinkies: %d", ModuleName, #sortedStinkies))
|
||||
shared.dumpTable(sortedStinkies)
|
||||
shared.dump(sortedStinkies)
|
||||
end
|
||||
local lines = { "/targetenemy" }
|
||||
for _, stinky in pairs(sortedStinkies) do
|
||||
@@ -89,13 +88,14 @@ function shared.Macroer.Init()
|
||||
EditMacro(idx, "HeimdallTarget", "INV_Misc_QuestionMark", body)
|
||||
end
|
||||
|
||||
shared.stinkyTracker.stinkies:onChange(function(value)
|
||||
shared.StinkyTracker.OnChange(function(stinkies)
|
||||
if Heimdall_Data.config.macroer.debug then
|
||||
print(string.format("[%s] Stinkies changed, updating macro", ModuleName))
|
||||
shared.dump(stinkies)
|
||||
end
|
||||
FixMacro(value)
|
||||
FixMacro(stinkies)
|
||||
end)
|
||||
|
||||
if Heimdall_Data.config.macroer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||
print("[Heimdall] Macroer loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,13 +2,28 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Messenger"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Messenger = {}
|
||||
function shared.Messenger.Init()
|
||||
---@class Message
|
||||
---@field message string
|
||||
---@field channel string
|
||||
---@field data string
|
||||
---@class HeimdallMessengerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field interval number
|
||||
|
||||
---@class HeimdallMessengerData
|
||||
---@field queue ReactiveValue<table<string, Message>>
|
||||
---@field ticker Timer?
|
||||
|
||||
---@class Message
|
||||
---@field message string
|
||||
---@field channel string
|
||||
---@field data string
|
||||
|
||||
---@class Messenger
|
||||
shared.Messenger = {
|
||||
---@param message Message
|
||||
Enqueue = function(message) table.insert(shared.messenger.queue, message) end,
|
||||
Init = function()
|
||||
shared.messenger = {
|
||||
queue = ReactiveValue.new({}),
|
||||
}
|
||||
|
||||
local function FindOrJoinChannel(channelName, password)
|
||||
local channelId = GetChannelName(channelName)
|
||||
@@ -29,84 +44,76 @@ function shared.Messenger.Init()
|
||||
return channelId
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
if not shared.messenger then shared.messenger = {} end
|
||||
if not shared.messenger.queue then shared.messenger.queue = {} end
|
||||
if not shared.messenger.ticker then
|
||||
local function DoMessage()
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Processing message queue - Size: %d", ModuleName, #shared.messenger.queue))
|
||||
end
|
||||
-- if Heimdall_Data.config.messenger.debug then
|
||||
-- print(
|
||||
-- string.format(
|
||||
-- "[%s] Processing message queue - Size: %d",
|
||||
-- ModuleName,
|
||||
-- #shared.messenger.queue:get()
|
||||
-- )
|
||||
-- )
|
||||
-- end
|
||||
|
||||
if not Heimdall_Data.config.messenger.enabled then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Module disabled, skipping message processing", ModuleName))
|
||||
end
|
||||
-- if Heimdall_Data.config.messenger.debug then
|
||||
-- print(string.format("[%s] Module disabled, skipping message processing", ModuleName))
|
||||
-- end
|
||||
return
|
||||
end
|
||||
|
||||
---@type Message
|
||||
local message = shared.messenger.queue[1]
|
||||
if not message then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Message queue empty", ModuleName))
|
||||
end
|
||||
-- if Heimdall_Data.config.messenger.debug then
|
||||
-- print(string.format("[%s] Message queue empty", ModuleName))
|
||||
-- end
|
||||
return
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(
|
||||
string.format(
|
||||
"[%s] Processing message - Channel: %s, Data: %s",
|
||||
ModuleName,
|
||||
message.channel or "nil",
|
||||
message.data or "nil"
|
||||
)
|
||||
)
|
||||
print(string.format("[%s] Message content: %s", ModuleName, message.message or "nil"))
|
||||
end
|
||||
if Heimdall_Data.config.messenger.debug then shared.dump(message, "[%s] Processing message:") end
|
||||
|
||||
if not message.message or message.message == "" then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Invalid message: empty content", ModuleName))
|
||||
shared.dump(message, string.format("[%s] Invalid message: empty content", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if not message.channel or message.channel == "" then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Invalid message: no channel specified", ModuleName))
|
||||
shared.dump(message, string.format("[%s] Invalid message: no channel specified", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if string.find(message.channel, "^C") then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Converting channel type from C to CHANNEL", ModuleName))
|
||||
shared.dump(
|
||||
message,
|
||||
string.format("[%s] Converting channel type from C to CHANNEL", ModuleName)
|
||||
)
|
||||
end
|
||||
message.channel = "CHANNEL"
|
||||
elseif string.find(message.channel, "^W") then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Converting channel type from W to WHISPER", ModuleName))
|
||||
shared.dump(
|
||||
message,
|
||||
string.format("[%s] Converting channel type from W to WHISPER", ModuleName)
|
||||
)
|
||||
end
|
||||
message.channel = "WHISPER"
|
||||
end
|
||||
|
||||
if message.channel == "CHANNEL" and message.data and string.match(message.data, "%D") then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(
|
||||
string.format(
|
||||
"[%s] Processing channel message: '%s' to '%s'",
|
||||
ModuleName,
|
||||
message.message,
|
||||
message.data
|
||||
)
|
||||
)
|
||||
shared.dump(message, string.format("[%s] Processing channel message:", ModuleName))
|
||||
end
|
||||
local channelId = GetChannelName(message.data)
|
||||
if channelId == 0 then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Channel not found, attempting to join: %s", ModuleName, message.data))
|
||||
shared.dump(message, string.format("[%s] Channel not found, joining:", ModuleName))
|
||||
end
|
||||
channelId = FindOrJoinChannel(message.data)
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
@@ -119,44 +126,36 @@ function shared.Messenger.Init()
|
||||
table.remove(shared.messenger.queue, 1)
|
||||
if not message.message or message.message == "" then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Skipping empty message", ModuleName))
|
||||
shared.dump(message, string.format("[%s] Skipping empty message", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
if not message.channel or message.channel == "" then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Skipping message with no channel", ModuleName))
|
||||
shared.dump(message, string.format("[%s] Skipping message with no channel", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
if not message.data or message.data == "" then
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Skipping message with no data", ModuleName))
|
||||
shared.dump(message, string.format("[%s] Skipping message with no data", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(
|
||||
string.format(
|
||||
"[%s] Sending message: '%s' to %s:%s",
|
||||
ModuleName,
|
||||
message.message,
|
||||
message.channel,
|
||||
message.data
|
||||
)
|
||||
)
|
||||
shared.dump(message, string.format("[%s] Sending message:", ModuleName))
|
||||
end
|
||||
if string.len(message.message) > 255 then
|
||||
print(string.format("[%s] Message too long!!!!: %s", ModuleName, message.message))
|
||||
shared.dump(message, string.format("[%s] Message too long!!!!: %s", ModuleName, message.message))
|
||||
return
|
||||
end
|
||||
SendChatMessage(message.message, message.channel, nil, message.data)
|
||||
end
|
||||
local function Tick()
|
||||
if Heimdall_Data.config.messenger.debug then
|
||||
print(string.format("[%s] Tick - Queue size: %d", ModuleName, #shared.messenger.queue))
|
||||
end
|
||||
-- if Heimdall_Data.config.messenger.debug then
|
||||
-- print(string.format("[%s] Tick - Queue size: %d", ModuleName, #shared.messenger.queue:get()))
|
||||
-- end
|
||||
DoMessage()
|
||||
shared.messenger.ticker = C_Timer.NewTimer(Heimdall_Data.config.messenger.interval, Tick, 1)
|
||||
end
|
||||
@@ -172,5 +171,6 @@ function shared.Messenger.Init()
|
||||
)
|
||||
)
|
||||
end
|
||||
print("[Heimdall] Messenger loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -1,14 +1,42 @@
|
||||
local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "MinimapTagger"
|
||||
|
||||
---@class HeimdallMinimapTaggerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field throttle number
|
||||
---@field scale number
|
||||
---@field tagTTL number
|
||||
---@field tagSound boolean
|
||||
---@field tagSoundFile string
|
||||
---@field tagSoundThrottle number
|
||||
---@field tagTextureFile string
|
||||
---@field alertTTL number
|
||||
---@field alertSound boolean
|
||||
---@field alertSoundFile string
|
||||
---@field alertSoundThrottle number
|
||||
---@field alertTextureFile string
|
||||
---@field combatTTL number
|
||||
---@field combatSound boolean
|
||||
---@field combatSoundFile string
|
||||
---@field combatSoundThrottle number
|
||||
---@field combatTextureFile string
|
||||
---@field helpTTL number
|
||||
---@field helpSound boolean
|
||||
---@field helpSoundFile string
|
||||
---@field helpSoundThrottle number
|
||||
---@field helpTextureFile string
|
||||
|
||||
local HeimdallRoot = "Interface\\AddOns\\Heimdall\\"
|
||||
local SoundRoot = HeimdallRoot .. "Sounds\\"
|
||||
local TextureRoot = HeimdallRoot .. "Texture\\"
|
||||
--/run local a=GetChannelName("Agent")local b,c=GetPlayerMapPosition("player")b,c=b*100,c*100;local d=string.format("I need help at %s (%s) [%s](%2.2f, %2.2f)",GetZoneText(),GetSubZoneText(),GetCurrentMapAreaID(),b,c)SendChatMessage(d,"CHANNEL",nil,a)
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.MinimapTagger = {}
|
||||
function shared.MinimapTagger.Init()
|
||||
---@class MinimapTagger
|
||||
shared.MinimapTagger = {
|
||||
Init = function()
|
||||
---@param x number
|
||||
---@param y number
|
||||
---@param frame Frame
|
||||
@@ -445,7 +473,7 @@ function shared.MinimapTagger.Init()
|
||||
end
|
||||
if Heimdall_Data.config.minimapTagger.debug then
|
||||
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
|
||||
shared.dumpTable(Heimdall_Data.config.minimapTagger)
|
||||
shared.dump(Heimdall_Data.config.minimapTagger)
|
||||
end
|
||||
|
||||
local doTag = true
|
||||
@@ -564,8 +592,6 @@ function shared.MinimapTagger.Init()
|
||||
--endregion
|
||||
end)
|
||||
|
||||
print("[Heimdall] MinimapTagger loaded")
|
||||
end
|
||||
|
||||
SlashCmdList["HEIMDALL_MINIMAPTAGGER"] = function(args) shared.MinimapTagger.Init() end
|
||||
SLASH_HEIMDALL_MINIMAPTAGGER1 = "/mf"
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,9 +2,18 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Network"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Network = {}
|
||||
function shared.Network.Init()
|
||||
---@class HeimdallNetworkConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field members string[]
|
||||
---@field updateInterval number
|
||||
|
||||
---@class HeimdallNetworkData
|
||||
---@field ticker Timer?
|
||||
|
||||
---@class Network
|
||||
shared.Network = {
|
||||
Init = function()
|
||||
if not shared.network then shared.network = {} end
|
||||
local updatePending = false
|
||||
|
||||
@@ -18,7 +27,9 @@ function shared.Network.Init()
|
||||
if name then
|
||||
friends[name] = connected
|
||||
if Heimdall_Data.config.network.debug then
|
||||
print(string.format("[%s] Friend %s is %s", ModuleName, name, connected and "online" or "offline"))
|
||||
print(
|
||||
string.format("[%s] Friend %s is %s", ModuleName, name, connected and "online" or "offline")
|
||||
)
|
||||
end
|
||||
else
|
||||
if Heimdall_Data.config.network.debug then
|
||||
@@ -50,7 +61,7 @@ function shared.Network.Init()
|
||||
end
|
||||
if Heimdall_Data.config.network.debug then
|
||||
print(string.format("[%s] Network nodes:", ModuleName))
|
||||
shared.dumpTable(shared.networkNodes)
|
||||
shared.dump(shared.networkNodes)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -69,5 +80,6 @@ function shared.Network.Init()
|
||||
end
|
||||
|
||||
NetworkTick()
|
||||
print("[Heimdall] Network module loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,13 +2,26 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "NetworkMessenger"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.NetworkMessenger = {}
|
||||
function shared.NetworkMessenger.Init()
|
||||
---@class HeimdallNetworkMessengerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field interval number
|
||||
|
||||
---@class HeimdallNetworkMessengerData
|
||||
---@field queue table<string, Message>
|
||||
---@field ticker Timer?
|
||||
|
||||
---@class NetworkMessenger
|
||||
shared.NetworkMessenger = {
|
||||
---@param message Message
|
||||
Enqueue = function(message) table.insert(shared.networkMessenger.queue, message) end,
|
||||
Init = function()
|
||||
RegisterAddonMessagePrefix(Heimdall_Data.config.addonPrefix)
|
||||
|
||||
if not shared.networkMessenger then shared.networkMessenger = {} end
|
||||
if not shared.networkMessenger.queue then shared.networkMessenger.queue = {} end
|
||||
shared.networkMessenger = {
|
||||
queue = ReactiveValue.new({}),
|
||||
}
|
||||
|
||||
if not shared.networkMessenger.ticker then
|
||||
local function DoMessage()
|
||||
--if Heimdall_Data.config.networkMessenger.debug then
|
||||
@@ -91,7 +104,8 @@ function shared.NetworkMessenger.Init()
|
||||
-- print(string.format("[%s] Queue check - Network messages pending: %d", ModuleName, queueSize))
|
||||
--end
|
||||
DoMessage()
|
||||
shared.networkMessenger.ticker = C_Timer.NewTimer(Heimdall_Data.config.networkMessenger.interval, Tick, 1)
|
||||
shared.networkMessenger.ticker =
|
||||
C_Timer.NewTimer(Heimdall_Data.config.networkMessenger.interval, Tick, 1)
|
||||
end
|
||||
Tick()
|
||||
end
|
||||
@@ -131,7 +145,7 @@ function shared.NetworkMessenger.Init()
|
||||
local parts = shared.Split(message, "|")
|
||||
if Heimdall_Data.config.networkMessenger.debug then
|
||||
print(string.format("[%s] Received message parts:", ModuleName))
|
||||
shared.dumpTable(parts)
|
||||
shared.dump(parts)
|
||||
end
|
||||
local command = strtrim(parts[1])
|
||||
if command == "message" then
|
||||
@@ -140,7 +154,13 @@ function shared.NetworkMessenger.Init()
|
||||
local target = strtrim(tostring(parts[4]))
|
||||
if Heimdall_Data.config.networkMessenger.debug then
|
||||
print(
|
||||
string.format("[%s] Received message command: %s %s %s", ModuleName, content, targetchannel, target)
|
||||
string.format(
|
||||
"[%s] Received message command: %s %s %s",
|
||||
ModuleName,
|
||||
content,
|
||||
targetchannel,
|
||||
target
|
||||
)
|
||||
)
|
||||
end
|
||||
---@type Message
|
||||
@@ -179,5 +199,6 @@ function shared.NetworkMessenger.Init()
|
||||
end
|
||||
end
|
||||
|
||||
print("[Heimdall] NetworkMessenger module loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,15 +2,21 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Noter"
|
||||
|
||||
---@class HeimdallNoterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field lastNotes number
|
||||
|
||||
---@class Note
|
||||
---@field source string
|
||||
---@field for string
|
||||
---@field date string
|
||||
---@field note string
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Noter = {}
|
||||
function shared.Noter.Init()
|
||||
---@class Noter
|
||||
shared.Noter = {
|
||||
Init = function()
|
||||
-- ---Hopefully this will not be necessary
|
||||
-- ---@param text string
|
||||
-- ---@param size number
|
||||
@@ -61,14 +67,16 @@ function shared.Noter.Init()
|
||||
local indices = shared.Split(range, "..")
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Indices for range deletion: %s", ModuleName, table.concat(indices, ", ")))
|
||||
shared.dumpTable(indices)
|
||||
shared.dump(indices)
|
||||
end
|
||||
local start = tonumber(indices[1])
|
||||
local finish = tonumber(indices[2])
|
||||
|
||||
if not start then
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Invalid start range for delete note: %s", ModuleName, tostring(start)))
|
||||
print(
|
||||
string.format("[%s] Invalid start range for delete note: %s", ModuleName, tostring(start))
|
||||
)
|
||||
end
|
||||
return
|
||||
end
|
||||
@@ -90,7 +98,7 @@ function shared.Noter.Init()
|
||||
else
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Deleting note %s at index %s", ModuleName, name, i))
|
||||
shared.dumpTable(Heimdall_Data.config.notes[name][i])
|
||||
shared.dump(Heimdall_Data.config.notes[name][i])
|
||||
end
|
||||
Heimdall_Data.config.notes[name][i] = nil
|
||||
end
|
||||
@@ -113,8 +121,11 @@ function shared.Noter.Init()
|
||||
data = channel,
|
||||
message = string.format("[%s][%d] %s: %s", note.source, index, note.date, note.note),
|
||||
}
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
if Heimdall_Data.config.networkMessenger.enabled then
|
||||
shared.NetworkMessenger.Enqueue(msg)
|
||||
elseif Heimdall_Data.config.messenger.enabled then
|
||||
shared.Messenger.Enqueue(msg)
|
||||
end
|
||||
end
|
||||
---@param name string
|
||||
---@param args string[]
|
||||
@@ -151,7 +162,7 @@ function shared.Noter.Init()
|
||||
local indices = shared.Split(range, "..")
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Indices for range printing: %s", ModuleName, table.concat(indices, ", ")))
|
||||
shared.dumpTable(indices)
|
||||
shared.dump(indices)
|
||||
end
|
||||
local start = tonumber(indices[1])
|
||||
local finish = tonumber(indices[2])
|
||||
@@ -177,7 +188,7 @@ function shared.Noter.Init()
|
||||
else
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Printing note %s at index %s", ModuleName, name, i))
|
||||
shared.dumpTable(Heimdall_Data.config.notes[name][i])
|
||||
shared.dump(Heimdall_Data.config.notes[name][i])
|
||||
end
|
||||
PrintNote(channel, i, Heimdall_Data.config.notes[name][i])
|
||||
end
|
||||
@@ -192,7 +203,7 @@ function shared.Noter.Init()
|
||||
if not Heimdall_Data.config.notes[name] then Heimdall_Data.config.notes[name] = {} end
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Adding note for: %s from: %s", ModuleName, name, sender))
|
||||
shared.dumpTable(args)
|
||||
shared.dump(args)
|
||||
end
|
||||
local msgparts = {}
|
||||
for i = 3, #args do
|
||||
@@ -213,7 +224,7 @@ function shared.Noter.Init()
|
||||
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Adding note", ModuleName))
|
||||
shared.dumpTable(note)
|
||||
shared.dump(note)
|
||||
end
|
||||
table.insert(Heimdall_Data.config.notes[name], note)
|
||||
end
|
||||
@@ -231,7 +242,7 @@ function shared.Noter.Init()
|
||||
noterChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||
--if Heimdall_Data.config.noter.debug then
|
||||
-- print(string.format("[%s] Event received", ModuleName))
|
||||
-- shared.dumpTable(Heimdall_Data.config.noter)
|
||||
-- shared.dump(Heimdall_Data.config.noter)
|
||||
--end
|
||||
if not Heimdall_Data.config.noter.enabled then
|
||||
--if Heimdall_Data.config.noter.debug then
|
||||
@@ -258,7 +269,7 @@ function shared.Noter.Init()
|
||||
sender = string.match(sender, "^[^-]+")
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Message from: %s", ModuleName, sender))
|
||||
shared.dumpTable(Heimdall_Data.config.noter)
|
||||
shared.dump(Heimdall_Data.config.noter)
|
||||
end
|
||||
|
||||
if not msg or msg == "" then
|
||||
@@ -271,7 +282,7 @@ function shared.Noter.Init()
|
||||
local args = { strsplit(" ", msg) }
|
||||
if Heimdall_Data.config.noter.debug then
|
||||
print(string.format("[%s] Arguments received: %s", ModuleName, table.concat(args, ", ")))
|
||||
shared.dumpTable(args)
|
||||
shared.dump(args)
|
||||
end
|
||||
local command = args[1]
|
||||
if command == "note" then
|
||||
@@ -291,5 +302,6 @@ function shared.Noter.Init()
|
||||
end
|
||||
end)
|
||||
|
||||
print("[Heimdall] Commander module loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -483,7 +483,7 @@ local function Init()
|
||||
-- S local clbk = test:onChange(function(value)
|
||||
-- S invocations = invocations + 1
|
||||
-- S print("test changed to")
|
||||
-- S dumpTable(value, 0)
|
||||
-- S dump(value, 0)
|
||||
-- S end)
|
||||
-- S test:set({1, 2, 3, 4})
|
||||
-- S assert(invocations == 1)
|
||||
@@ -516,7 +516,7 @@ local function Init()
|
||||
-- S test:once(function(value)
|
||||
-- S invocations = invocations + 1
|
||||
-- S print("test changed to")
|
||||
-- S dumpTable(value, 0)
|
||||
-- S dump(value, 0)
|
||||
-- S end)
|
||||
-- S test:set({3, 2, 1})
|
||||
-- S assert(invocations == 1)
|
||||
@@ -527,7 +527,7 @@ local function Init()
|
||||
-- S test:onChange(function(value)
|
||||
-- S invocations = invocations + 1
|
||||
-- S print("test changed to")
|
||||
-- S dumpTable(value, 0)
|
||||
-- S dump(value, 0)
|
||||
-- S end)
|
||||
-- S test:onAnyFieldChange(function(field, value)
|
||||
-- S invocations = invocations + 1
|
||||
|
@@ -2,15 +2,23 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Sniffer"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Sniffer = {}
|
||||
function shared.Sniffer.Init()
|
||||
---@class HeimdallSnifferConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field channels string[]
|
||||
---@field throttle number -- throttleTime in the original code, matching config name now
|
||||
---@field zoneOverride string?
|
||||
---@field stinky boolean
|
||||
|
||||
---@class Sniffer
|
||||
shared.Sniffer = {
|
||||
Init = function()
|
||||
if Heimdall_Data.config.sniffer.debug then print(string.format("[%s] Module initializing", ModuleName)) end
|
||||
local smellThrottle = {}
|
||||
local SmellStinky = function(stinky)
|
||||
if Heimdall_Data.config.sniffer.debug then
|
||||
print(string.format("%s: SmellStinky", ModuleName))
|
||||
shared.dumpTable(Heimdall_Data.config.sniffer)
|
||||
shared.dump(Heimdall_Data.config.sniffer)
|
||||
end
|
||||
if not Heimdall_Data.config.sniffer.enabled then return end
|
||||
if Heimdall_Data.config.sniffer.stinky and not shared.IsStinky(stinky) then
|
||||
@@ -19,7 +27,7 @@ function shared.Sniffer.Init()
|
||||
end
|
||||
return
|
||||
end
|
||||
if smellThrottle[stinky] and GetTime() - smellThrottle[stinky] < Heimdall_Data.config.sniffer.throttleTime then
|
||||
if smellThrottle[stinky] and GetTime() - smellThrottle[stinky] < Heimdall_Data.config.sniffer.throttle then
|
||||
if Heimdall_Data.config.sniffer.debug then print(string.format("%s: Throttled", ModuleName)) end
|
||||
return
|
||||
end
|
||||
@@ -36,7 +44,7 @@ function shared.Sniffer.Init()
|
||||
}
|
||||
if Heimdall_Data.config.sniffer.debug then
|
||||
print(string.format("[%s] Queuing sniffer message", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
shared.dump(msg)
|
||||
end
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
end
|
||||
@@ -79,5 +87,6 @@ function shared.Sniffer.Init()
|
||||
SmellStinky(destination)
|
||||
end)
|
||||
if Heimdall_Data.config.sniffer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||
print("[Heimdall] Sniffer loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,9 +2,20 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Spotter"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Spotter = {}
|
||||
function shared.Spotter.Init()
|
||||
---@class HeimdallSpotterConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field everyone boolean
|
||||
---@field hostile boolean
|
||||
---@field alliance boolean
|
||||
---@field stinky boolean
|
||||
---@field channels string[]
|
||||
---@field zoneOverride string?
|
||||
---@field throttleTime number
|
||||
|
||||
---@class Spotter
|
||||
shared.Spotter = {
|
||||
Init = function()
|
||||
local function FormatHP(hp)
|
||||
if hp > 1e9 then
|
||||
return string.format("%.1fB", hp / 1e9)
|
||||
@@ -31,7 +42,7 @@ function shared.Spotter.Init()
|
||||
print(string.format("[%s] Checking notification criteria for %s (%s)", ModuleName, name, faction))
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.agents[name] then
|
||||
if shared.AgentTracker.IsAgent(name) then
|
||||
if Heimdall_Data.config.spotter.debug then
|
||||
print(string.format("[%s] Skipping agent: %s", ModuleName, name))
|
||||
end
|
||||
@@ -102,7 +113,9 @@ function shared.Spotter.Init()
|
||||
if throttleTable[name] and time - throttleTable[name] < Heimdall_Data.config.spotter.throttleTime then
|
||||
if Heimdall_Data.config.spotter.debug then
|
||||
local remainingTime = Heimdall_Data.config.spotter.throttleTime - (time - throttleTable[name])
|
||||
print(string.format("[%s] Player %s throttled for %.1f more seconds", ModuleName, name, remainingTime))
|
||||
print(
|
||||
string.format("[%s] Player %s throttled for %.1f more seconds", ModuleName, name, remainingTime)
|
||||
)
|
||||
end
|
||||
return string.format("Throttled %s", tostring(name))
|
||||
end
|
||||
@@ -188,7 +201,7 @@ function shared.Spotter.Init()
|
||||
}
|
||||
if Heimdall_Data.config.spotter.debug then
|
||||
print(string.format("[%s] Queuing spotter message", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
shared.dump(msg)
|
||||
end
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
end
|
||||
@@ -220,5 +233,6 @@ function shared.Spotter.Init()
|
||||
end)
|
||||
|
||||
if Heimdall_Data.config.spotter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||
print("[Heimdall] Spotter loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -1,11 +1,19 @@
|
||||
local addonname, shared = ...
|
||||
local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
---@cast addonname string
|
||||
local ModuleName = "StinkyCache"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.StinkyCache = {}
|
||||
function shared.StinkyCache.Init()
|
||||
---@class HeimdallStinkyCacheConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field commander string
|
||||
---@field ttl number
|
||||
|
||||
---@class HeimdallStinkyCacheData
|
||||
---@field stinkies table<string, {value: number, timestamp: number}>
|
||||
|
||||
---@class StinkyCache
|
||||
shared.StinkyCache = {
|
||||
Init = function()
|
||||
shared.stinkyCache = {
|
||||
stinkies = {},
|
||||
}
|
||||
@@ -64,9 +72,12 @@ function shared.StinkyCache.Init()
|
||||
__index = function(self, key)
|
||||
local value = rawget(self, key)
|
||||
local now = GetTime()
|
||||
if value == nil or now - value.timestamp > Heimdall_Data.config.stinkyCache.ttl then AskCommander(key) end
|
||||
if value == nil or now - value.timestamp > Heimdall_Data.config.stinkyCache.ttl then
|
||||
AskCommander(key)
|
||||
end
|
||||
return rawget(self, key)
|
||||
end,
|
||||
})
|
||||
print("[Heimdall] StinkyCache module loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,16 +2,107 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "StinkyTracker"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.StinkyTracker = {}
|
||||
function shared.StinkyTracker.Init()
|
||||
---@class Stinky
|
||||
---@field name string
|
||||
---@field class string
|
||||
---@field seenAt number
|
||||
---@field hostile boolean
|
||||
|
||||
---@class HeimdallStinkyTrackerConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field ignoredTimeout number
|
||||
---@field channels string[]
|
||||
|
||||
---@class StinkyTrackerData
|
||||
---@field stinkies ReactiveValue<table<string, Stinky>>
|
||||
---@field ignored ReactiveValue<table<string, number>>
|
||||
|
||||
---@class StinkyTracker
|
||||
shared.StinkyTracker = {
|
||||
---@param stinky Stinky
|
||||
---@return boolean
|
||||
Track = function(stinky)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Request to track stinky: %s (%s)", ModuleName, stinky.name, stinky.class))
|
||||
end
|
||||
local ignored = shared.stinkyTracker.ignored[stinky.name]
|
||||
-- TODO: Add a config option for the ignored timeout
|
||||
if ignored and ignored > GetTime() - 60 then
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(
|
||||
string.format(
|
||||
"[%s] Stinky is ignored, not tracking: %s (%s)",
|
||||
ModuleName,
|
||||
stinky.name,
|
||||
stinky.class
|
||||
)
|
||||
)
|
||||
shared.dump(shared.stinkyTracker.ignored:get())
|
||||
shared.dump(shared.stinkyTracker.stinkies:get())
|
||||
end
|
||||
return false
|
||||
else
|
||||
-- Timed out or was never ignored
|
||||
shared.stinkyTracker.stinkies[stinky.name] = nil
|
||||
end
|
||||
|
||||
shared.stinkyTracker.stinkies[stinky.name] = stinky
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Stinky is now tracked: %s (%s)", ModuleName, stinky.name, stinky.class))
|
||||
shared.dump(shared.stinkyTracker.stinkies:get())
|
||||
shared.dump(shared.stinkyTracker.ignored:get())
|
||||
end
|
||||
return true
|
||||
end,
|
||||
|
||||
---@param name string
|
||||
---@return nil
|
||||
Ignore = function(name)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Request to ignore stinky: %s", ModuleName, name))
|
||||
end
|
||||
shared.stinkyTracker.ignored[name] = GetTime()
|
||||
shared.stinkyTracker.stinkies[name] = nil
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Stinky is now ignored: %s", ModuleName, name))
|
||||
shared.dump(shared.stinkyTracker.ignored:get())
|
||||
shared.dump(shared.stinkyTracker.stinkies:get())
|
||||
end
|
||||
end,
|
||||
|
||||
---@param name string
|
||||
---@return boolean
|
||||
IsStinky = function(name)
|
||||
if not shared.stinkyTracker.stinkies then return false end
|
||||
if not shared.stinkyTracker.stinkies[name] then return false end
|
||||
if shared.stinkyTracker.ignored[name] then return false end
|
||||
return true
|
||||
end,
|
||||
|
||||
---@param callback fun(stinkies: table<string, Stinky>)
|
||||
---@return nil
|
||||
OnChange = function(callback) shared.stinkyTracker.stinkies:onChange(callback) end,
|
||||
|
||||
---@param callback fun(name: string, stinky: Stinky)
|
||||
---@return nil
|
||||
ForEach = function(callback)
|
||||
---@type table<string, Stinky>
|
||||
local stinkies = shared.stinkyTracker.stinkies:get()
|
||||
for name, stinky in pairs(stinkies) do
|
||||
callback(name, stinky)
|
||||
end
|
||||
end,
|
||||
|
||||
Init = function()
|
||||
shared.stinkyTracker = {
|
||||
stinkies = ReactiveValue.new({}),
|
||||
ignored = ReactiveValue.new({}),
|
||||
}
|
||||
|
||||
local whoRegex = "([^ -/]+)-?%w*/(%w+)"
|
||||
---@param msg string
|
||||
---@return table<string, stinky>
|
||||
---@return table<string, Stinky>
|
||||
local function ParseWho(msg)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Parsing WHO message: '%s'", ModuleName, msg))
|
||||
@@ -34,7 +125,7 @@ function shared.StinkyTracker.Init()
|
||||
date("%H:%M:%S", time())
|
||||
)
|
||||
)
|
||||
shared.dumpTable(stinkies)
|
||||
shared.dump(stinkies)
|
||||
end
|
||||
end
|
||||
return stinkies
|
||||
@@ -42,7 +133,7 @@ function shared.StinkyTracker.Init()
|
||||
|
||||
local seeRegex = "I see %((%w+)%) ([^ -/]+)-?%w*/(%w+)"
|
||||
---@param msg string
|
||||
---@return table<string, stinky>
|
||||
---@return table<string, Stinky>
|
||||
local function ParseSee(msg)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Parsing SEE message: '%s'", ModuleName, msg))
|
||||
@@ -73,7 +164,7 @@ function shared.StinkyTracker.Init()
|
||||
date("%H:%M:%S", time())
|
||||
)
|
||||
)
|
||||
shared.dumpTable(stinkies)
|
||||
shared.dump(stinkies)
|
||||
end
|
||||
return stinkies
|
||||
end
|
||||
@@ -81,7 +172,7 @@ function shared.StinkyTracker.Init()
|
||||
local arrivedRegex = "([^ -/]+)-?%w*; c:([^;]+)"
|
||||
local arrivedRegexAlt = "([^ -/]+)-?%w*%(!!!!%); c:([^;]+)"
|
||||
---@param msg string
|
||||
---@return table<string, stinky>
|
||||
---@return table<string, Stinky>
|
||||
local function ParseArrived(msg)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Parsing arrived message: %s", ModuleName, msg))
|
||||
@@ -106,7 +197,7 @@ function shared.StinkyTracker.Init()
|
||||
stinkies[name] = stinky
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("%s: Found stinky in arrived: %s/%s", ModuleName, name, class))
|
||||
shared.dumpTable(stinkies)
|
||||
shared.dump(stinkies)
|
||||
end
|
||||
return stinkies
|
||||
end
|
||||
@@ -140,9 +231,10 @@ function shared.StinkyTracker.Init()
|
||||
end
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
|
||||
shared.dumpTable(Heimdall_Data.config.stinkyTracker)
|
||||
shared.dump(Heimdall_Data.config.stinkyTracker)
|
||||
end
|
||||
|
||||
local stinkies = {}
|
||||
if string.find(msg, "^who:") then
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Processing WHO message from %s", ModuleName, sender))
|
||||
@@ -150,16 +242,10 @@ function shared.StinkyTracker.Init()
|
||||
local whoStinkies = ParseWho(msg)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Found stinkies in WHO message", ModuleName))
|
||||
shared.dump(whoStinkies)
|
||||
end
|
||||
for name, stinky in pairs(whoStinkies) do
|
||||
if stinky.hostile then
|
||||
shared.stinkyTracker.stinkies[name] = stinky
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(
|
||||
string.format("[%s] Added hostile stinky from WHO: %s (%s)", ModuleName, name, stinky.class)
|
||||
)
|
||||
end
|
||||
end
|
||||
stinkies[name] = stinky
|
||||
end
|
||||
end
|
||||
if string.find(msg, "^I see") then
|
||||
@@ -169,22 +255,10 @@ function shared.StinkyTracker.Init()
|
||||
local seeStinkies = ParseSee(msg)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Found stinkies in SEE message", ModuleName))
|
||||
shared.dump(seeStinkies)
|
||||
end
|
||||
for name, stinky in pairs(seeStinkies) do
|
||||
if stinky.hostile then
|
||||
shared.stinkyTracker.stinkies[name] = stinky
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(
|
||||
string.format("[%s] Added hostile stinky from SEE: %s (%s)", ModuleName, name, stinky.class)
|
||||
)
|
||||
end
|
||||
end
|
||||
if not stinky.hostile then
|
||||
shared.stinkyTracker.stinkies[name] = nil
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Removed non-hostile stinky from SEE: %s", ModuleName, name))
|
||||
end
|
||||
end
|
||||
stinkies[name] = stinky
|
||||
end
|
||||
end
|
||||
if string.find(msg, "arrived to") or string.find(msg, "moved to") then
|
||||
@@ -194,11 +268,23 @@ function shared.StinkyTracker.Init()
|
||||
local arrivedStinkies = ParseArrived(msg)
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Found stinkies in ARRIVED message", ModuleName))
|
||||
shared.dump(arrivedStinkies)
|
||||
end
|
||||
for name, stinky in pairs(arrivedStinkies) do
|
||||
stinkies[name] = stinky
|
||||
end
|
||||
end
|
||||
|
||||
for name, stinky in pairs(stinkies) do
|
||||
if shared.stinkyTracker.ignored[name] then
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Ignoring stinky: %s (%s)", ModuleName, name, stinky.class))
|
||||
end
|
||||
shared.stinkyTracker.ignored[name] = nil
|
||||
else
|
||||
shared.stinkyTracker.stinkies[name] = stinky
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Added stinky from ARRIVED: %s (%s)", ModuleName, name, stinky.class))
|
||||
print(string.format("[%s] Added stinky: %s (%s)", ModuleName, name, stinky.class))
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -212,14 +298,14 @@ function shared.StinkyTracker.Init()
|
||||
print(string.format("[%s] Current total stinkies tracked: %d", ModuleName, count))
|
||||
end
|
||||
|
||||
for name, stinky in pairs(shared.stinkyTracker.stinkies) do
|
||||
if Heimdall_Data.config.agents[name] then
|
||||
shared.StinkyTracker.ForEach(function(name, stinky)
|
||||
if shared.AgentTracker.IsAgent(name) then
|
||||
shared.stinkyTracker.stinkies[name] = nil
|
||||
if Heimdall_Data.config.stinkyTracker.debug then
|
||||
print(string.format("[%s] Removed agent from stinkies: %s", ModuleName, name))
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
local targetFrame = CreateFrame("Frame")
|
||||
@@ -273,5 +359,6 @@ function shared.StinkyTracker.Init()
|
||||
end)
|
||||
|
||||
if Heimdall_Data.config.stinkyTracker.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||
print("[Heimdall] StinkyTracker loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
@@ -2,9 +2,24 @@ local _, shared = ...
|
||||
---@cast shared HeimdallShared
|
||||
local ModuleName = "Whoer"
|
||||
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
shared.Whoer = {}
|
||||
function shared.Whoer.Init()
|
||||
---@class HeimdallWhoConfig
|
||||
---@field enabled boolean
|
||||
---@field debug boolean
|
||||
---@field ignored table<string, boolean>
|
||||
---@field channels string[]
|
||||
---@field ttl number
|
||||
---@field doWhisper boolean
|
||||
---@field zoneNotifyFor table<string, boolean>
|
||||
---@field queries string
|
||||
|
||||
---@class HeimdallWhoData
|
||||
---@field updateTicker Timer?
|
||||
---@field whoTicker Timer?
|
||||
|
||||
local whoWaiting = false
|
||||
---@class Whoer
|
||||
shared.Whoer = {
|
||||
Init = function()
|
||||
if not Heimdall_Data.who then Heimdall_Data.who = {} end
|
||||
if not Heimdall_Data.who.data then Heimdall_Data.who.data = {} end
|
||||
|
||||
@@ -161,7 +176,7 @@ function shared.Whoer.Init()
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] WHO query: %s with %d filters", ModuleName, queryParts[1], #filters))
|
||||
end
|
||||
shared.dumpTable(filters)
|
||||
shared.dump(filters)
|
||||
return WHOQuery.new(queryParts[1], filters)
|
||||
end,
|
||||
---@param queryStr string
|
||||
@@ -184,12 +199,19 @@ function shared.Whoer.Init()
|
||||
print(string.format("[%s] ShouldNotifyForZone %s", ModuleName, inputZone))
|
||||
end
|
||||
for zone, _ in pairs(Heimdall_Data.config.who.zoneNotifyFor) do
|
||||
if Heimdall_Data.config.who.debug then print(string.format("[%s] Checking zone %s", ModuleName, zone)) end
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Checking zone %s", ModuleName, zone))
|
||||
end
|
||||
if zone == "*" then return true end
|
||||
if string.find(inputZone, zone) then
|
||||
if not Heimdall_Data.config.who.debug then
|
||||
print(
|
||||
string.format("[%s] ShouldNotifyForZone %s is true thanks to %s", ModuleName, inputZone, zone)
|
||||
string.format(
|
||||
"[%s] ShouldNotifyForZone %s is true thanks to %s",
|
||||
ModuleName,
|
||||
inputZone,
|
||||
zone
|
||||
)
|
||||
)
|
||||
end
|
||||
return true
|
||||
@@ -269,7 +291,11 @@ function shared.Whoer.Init()
|
||||
--if not Heimdall_Data.config.who.zoneNotifyFor[player.zone] then
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(
|
||||
string.format("[%s] Skipping notification - Zone '%s' not in notify list", ModuleName, player.zone)
|
||||
string.format(
|
||||
"[%s] Skipping notification - Zone '%s' not in notify list",
|
||||
ModuleName,
|
||||
player.zone
|
||||
)
|
||||
)
|
||||
end
|
||||
return string.format("Not notifying for zone %s", tostring(player.zone))
|
||||
@@ -295,9 +321,13 @@ function shared.Whoer.Init()
|
||||
}
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
shared.dump(msg)
|
||||
end
|
||||
if Heimdall_Data.config.networkMessenger.enabled then
|
||||
shared.NetworkMessenger.Enqueue(msg)
|
||||
elseif Heimdall_Data.config.messenger.enabled then
|
||||
shared.Messenger.Enqueue(msg)
|
||||
end
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
end
|
||||
|
||||
--if Heimdall_Data.config.who.doWhisper then
|
||||
@@ -354,9 +384,13 @@ function shared.Whoer.Init()
|
||||
}
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
shared.dump(msg)
|
||||
end
|
||||
if Heimdall_Data.config.networkMessenger.enabled then
|
||||
shared.NetworkMessenger.Enqueue(msg)
|
||||
elseif Heimdall_Data.config.messenger.enabled then
|
||||
shared.Messenger.Enqueue(msg)
|
||||
end
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
end
|
||||
|
||||
--if Heimdall_Data.config.who.doWhisper then
|
||||
@@ -405,10 +439,13 @@ function shared.Whoer.Init()
|
||||
}
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
shared.dump(msg)
|
||||
end
|
||||
if Heimdall_Data.config.networkMessenger.enabled then
|
||||
shared.NetworkMessenger.Enqueue(msg)
|
||||
elseif Heimdall_Data.config.messenger.enabled then
|
||||
shared.Messenger.Enqueue(msg)
|
||||
end
|
||||
--table.insert(shared.messenger.queue, msg)
|
||||
table.insert(shared.networkMessenger.queue, msg)
|
||||
end
|
||||
|
||||
--if Heimdall_Data.config.who.doWhisper then
|
||||
@@ -432,7 +469,9 @@ function shared.Whoer.Init()
|
||||
frame:SetScript("OnEvent", function(self, event, ...)
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] WHO list update received", ModuleName))
|
||||
print(string.format("[%s] Query index: %d/%d", ModuleName, whoQueryIdx, #shared.WhoQueryService.queries))
|
||||
print(
|
||||
string.format("[%s] Query index: %d/%d", ModuleName, whoQueryIdx, #shared.WhoQueryService.queries)
|
||||
)
|
||||
end
|
||||
|
||||
if not Heimdall_Data.config.who.enabled then
|
||||
@@ -460,7 +499,15 @@ function shared.Whoer.Init()
|
||||
local name, guild, level, race, class, zone = GetWhoInfo(i)
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(
|
||||
string.format("[%s] Processing result %d/%d: %s/%s/%s", ModuleName, i, results, name, class, zone)
|
||||
string.format(
|
||||
"[%s] Processing result %d/%d: %s/%s/%s",
|
||||
ModuleName,
|
||||
i,
|
||||
results,
|
||||
name,
|
||||
class,
|
||||
zone
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
@@ -470,13 +517,25 @@ function shared.Whoer.Init()
|
||||
for _, filter in pairs(filters) do
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(
|
||||
string.format("[%s] Running filter %s on %s/%s/%s", ModuleName, filter.key, name, class, zone)
|
||||
string.format(
|
||||
"[%s] Running filter %s on %s/%s/%s",
|
||||
ModuleName,
|
||||
filter.key,
|
||||
name,
|
||||
class,
|
||||
zone
|
||||
)
|
||||
)
|
||||
end
|
||||
if not filter.Run(name, guild, level, race, class, zone) then
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(
|
||||
string.format("[%s] Player %s filtered out by WHO filter %s", ModuleName, name, filter.key)
|
||||
string.format(
|
||||
"[%s] Player %s filtered out by WHO filter %s",
|
||||
ModuleName,
|
||||
name,
|
||||
filter.key
|
||||
)
|
||||
)
|
||||
end
|
||||
continue = true
|
||||
@@ -502,7 +561,9 @@ function shared.Whoer.Init()
|
||||
local player = HeimdallStinkies[name]
|
||||
if not player then
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] New player detected: %s (%s) in %s", ModuleName, name, class, zone))
|
||||
print(
|
||||
string.format("[%s] New player detected: %s (%s) in %s", ModuleName, name, class, zone)
|
||||
)
|
||||
end
|
||||
|
||||
player = Player.new(name, guild, race, class, zone)
|
||||
@@ -530,7 +591,14 @@ function shared.Whoer.Init()
|
||||
if player.firstSeen == "never" then
|
||||
player.firstSeen = timestamp
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] First time seeing player: %s at %s", ModuleName, name, timestamp))
|
||||
print(
|
||||
string.format(
|
||||
"[%s] First time seeing player: %s at %s",
|
||||
ModuleName,
|
||||
name,
|
||||
timestamp
|
||||
)
|
||||
)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -548,7 +616,12 @@ function shared.Whoer.Init()
|
||||
local err = Notify(player)
|
||||
if err then
|
||||
print(
|
||||
string.format("[%s] Error notifying for %s: %s", ModuleName, tostring(name), tostring(err))
|
||||
string.format(
|
||||
"[%s] Error notifying for %s: %s",
|
||||
ModuleName,
|
||||
tostring(name),
|
||||
tostring(err)
|
||||
)
|
||||
)
|
||||
end
|
||||
|
||||
@@ -571,7 +644,9 @@ function shared.Whoer.Init()
|
||||
)
|
||||
end
|
||||
local err = NotifyZoneChanged(player, zone)
|
||||
if err then print(string.format("Error notifying for %s: %s", tostring(name), tostring(err))) end
|
||||
if err then
|
||||
print(string.format("Error notifying for %s: %s", tostring(name), tostring(err)))
|
||||
end
|
||||
end
|
||||
player.zone = zone
|
||||
player.lastSeen = timestamp
|
||||
@@ -583,7 +658,8 @@ function shared.Whoer.Init()
|
||||
end
|
||||
-- Turns out WA cannot do this (
|
||||
-- aura_env.UpdateMacro()
|
||||
_G["FriendsFrameCloseButton"]:Click()
|
||||
-- No longer needed with the hook to friends frame show
|
||||
-- _G["FriendsFrameCloseButton"]:Click()
|
||||
end)
|
||||
|
||||
do
|
||||
@@ -610,7 +686,10 @@ function shared.Whoer.Init()
|
||||
local query = shared.WhoQueryService.queries[whoQueryIdx]
|
||||
if not query then
|
||||
if Heimdall_Data.config.who.debug then
|
||||
print(string.format("[%s] Error: No WHO query found to run at index %d", ModuleName, whoQueryIdx))
|
||||
print(
|
||||
string.format("[%s] Error: No WHO query found to run at index %d", ModuleName, whoQueryIdx)
|
||||
)
|
||||
whoQueryIdx = 1
|
||||
end
|
||||
return
|
||||
end
|
||||
@@ -633,8 +712,10 @@ function shared.Whoer.Init()
|
||||
whoQueryIdx = whoQueryIdx + 1
|
||||
if whoQueryIdx > #shared.WhoQueryService.queries then whoQueryIdx = 1 end
|
||||
lastQuery = query
|
||||
whoWaiting = true
|
||||
---@diagnostic disable-next-line: param-type-mismatch
|
||||
SetWhoToUI(1)
|
||||
SetWhoToUI(1)
|
||||
SendWho(query.query)
|
||||
end
|
||||
local function Tick()
|
||||
@@ -643,6 +724,12 @@ function shared.Whoer.Init()
|
||||
end
|
||||
Tick()
|
||||
end
|
||||
local original_FriendsFrame_OnEvent = FriendsFrame_OnEvent
|
||||
local function my_FriendsFrame_OnEvent(self, event, ...)
|
||||
if not (event == "WHO_LIST_UPDATE" and whoWaiting) then original_FriendsFrame_OnEvent(self, event, ...) end
|
||||
end
|
||||
FriendsFrame_OnEvent = my_FriendsFrame_OnEvent
|
||||
|
||||
print("[Heimdall] Whoer loaded")
|
||||
end
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end,
|
||||
}
|
||||
|
2
_L.lua
2
_L.lua
@@ -90,6 +90,7 @@ shared._Locale = {
|
||||
updateInterval = "Update Interval",
|
||||
networkMessenger = "Network Messenger",
|
||||
queries = "Who queries",
|
||||
chatSniffer = "Chat Sniffer",
|
||||
},
|
||||
ru = {
|
||||
bonkDetected = "%s ударил %s (%s)",
|
||||
@@ -175,6 +176,7 @@ shared._Locale = {
|
||||
updateInterval = "Интервал Обновления",
|
||||
networkMessenger = "Сетевой Мессенджер",
|
||||
queries = "Запросы Who",
|
||||
chatSniffer = "Сниффер Чата",
|
||||
["Orgrimmar"] = "Оргриммар",
|
||||
["Valley of Strength"] = "Долина Силы",
|
||||
["Valley of Trials"] = "Долина Испытаний",
|
||||
|
Reference in New Issue
Block a user