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 |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1 +1 @@
|
|||||||
*.zip
|
scratch.lua
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
globals = { "CykaPersistentData", "CreateFrame", "GetItemInfo", "aura_env" }
|
globals = { "CykaPersistentData", "CreateFrame", "GetItemInfo", "aura_env" }
|
||||||
unused_args = false
|
unused_args = false
|
||||||
max_line_length = 150
|
max_line_length = 500
|
||||||
exclude_files = { "Meta/" }
|
exclude_files = { "Meta/" }
|
||||||
global = false
|
global = false
|
269
Heimdall.lua
269
Heimdall.lua
@@ -18,7 +18,8 @@ local function init()
|
|||||||
---@field classColors table<string, string>
|
---@field classColors table<string, string>
|
||||||
---@field messenger HeimdallMessengerData
|
---@field messenger HeimdallMessengerData
|
||||||
---@field who HeimdallWhoData
|
---@field who HeimdallWhoData
|
||||||
---@field stinkyTracker HeimdallStinkyTrackerData
|
---@field stinkyTracker StinkyTrackerData
|
||||||
|
---@field agentTracker AgentTrackerData
|
||||||
---@field networkNodes string[]
|
---@field networkNodes string[]
|
||||||
---@field network HeimdallNetworkData
|
---@field network HeimdallNetworkData
|
||||||
---@field networkMessenger HeimdallNetworkMessengerData
|
---@field networkMessenger HeimdallNetworkMessengerData
|
||||||
@@ -26,7 +27,7 @@ local function init()
|
|||||||
---@field _L fun(key: string, locale: string): string
|
---@field _L fun(key: string, locale: string): string
|
||||||
---@field _Locale Localization
|
---@field _Locale Localization
|
||||||
---@field VERSION string
|
---@field VERSION string
|
||||||
---@field dump fun(table: any, depth?: number): nil
|
---@field dump fun(table: any, msg?: string, depth?: number): nil
|
||||||
---@field utf8len fun(input: string): number
|
---@field utf8len fun(input: string): number
|
||||||
---@field padString fun(input: string, targetLength: number, left?: boolean): string
|
---@field padString fun(input: string, targetLength: number, left?: boolean): string
|
||||||
---@field GetOrDefault fun(table: table<any, any>, keys: string[], default: any): any
|
---@field GetOrDefault fun(table: table<any, any>, keys: string[], default: any): any
|
||||||
@@ -35,31 +36,31 @@ local function init()
|
|||||||
---@field Memoize fun(f: function): function
|
---@field Memoize fun(f: function): function
|
||||||
---@field GetLocaleForChannel fun(channel: string): string
|
---@field GetLocaleForChannel fun(channel: string): string
|
||||||
---@field WhoQueryService WhoQueryService
|
---@field WhoQueryService WhoQueryService
|
||||||
---@field Whoer InitTable|{ShouldNotifyForZone: fun(zone: string): boolean}
|
---@field AchievementSniffer AchievementSniffer
|
||||||
---@field Messenger InitTable
|
---@field AgentTracker AgentTracker
|
||||||
---@field Spotter InitTable
|
---@field BonkDetector BonkDetector
|
||||||
---@field DeathReporter InitTable
|
---@field Bully Bully
|
||||||
---@field Inviter InitTable
|
---@field CombatAlerter CombatAlerter
|
||||||
---@field Dueler InitTable
|
---@field Commander Commander
|
||||||
---@field Bully InitTable
|
---@field Config Config
|
||||||
---@field AgentTracker InitTable
|
---@field Configurator Configurator
|
||||||
---@field Emoter InitTable
|
---@field DeathReporter DeathReporter
|
||||||
---@field Echoer InitTable
|
---@field Dueler Dueler
|
||||||
---@field Macroer InitTable
|
---@field Echoer Echoer
|
||||||
---@field Commander InitTable
|
---@field Emoter Emoter
|
||||||
---@field StinkyTracker InitTable
|
---@field Inviter Inviter
|
||||||
---@field CombatAlerter InitTable
|
---@field Macroer Macroer
|
||||||
---@field Config InitTable
|
---@field Messenger Messenger
|
||||||
---@field Sniffer InitTable
|
---@field MinimapTagger MinimapTagger
|
||||||
---@field MinimapTagger InitTable
|
---@field Network Network
|
||||||
---@field BonkDetector InitTable
|
---@field NetworkMessenger NetworkMessenger
|
||||||
---@field Noter InitTable
|
---@field Noter Noter
|
||||||
---@field Network InitTable
|
---@field Sniffer Sniffer
|
||||||
---@field NetworkMessenger InitTable
|
---@field Spotter Spotter
|
||||||
---@field StinkyCache InitTable
|
---@field StinkyCache StinkyCache
|
||||||
---@field Configurator InitTable
|
---@field StinkyTracker StinkyTracker
|
||||||
---@field AchievementSniffer InitTable
|
---@field Whoer Whoer
|
||||||
---@field ChatSniffer InitTable
|
---@field ChatSniffer ChatSniffer
|
||||||
|
|
||||||
--- Config ---
|
--- Config ---
|
||||||
---@class HeimdallConfig
|
---@class HeimdallConfig
|
||||||
@@ -69,7 +70,6 @@ local function init()
|
|||||||
---@field deathReporter HeimdallDeathReporterConfig
|
---@field deathReporter HeimdallDeathReporterConfig
|
||||||
---@field inviter HeimdallInviterConfig
|
---@field inviter HeimdallInviterConfig
|
||||||
---@field dueler HeimdallDuelerConfig
|
---@field dueler HeimdallDuelerConfig
|
||||||
---@field bully HeimdallBullyConfig
|
|
||||||
---@field agentTracker HeimdallAgentTrackerConfig
|
---@field agentTracker HeimdallAgentTrackerConfig
|
||||||
---@field emoter HeimdallEmoterConfig
|
---@field emoter HeimdallEmoterConfig
|
||||||
---@field echoer HeimdallEchoerConfig
|
---@field echoer HeimdallEchoerConfig
|
||||||
@@ -78,13 +78,13 @@ local function init()
|
|||||||
---@field stinkyTracker HeimdallStinkyTrackerConfig
|
---@field stinkyTracker HeimdallStinkyTrackerConfig
|
||||||
---@field combatAlerter HeimdallCombatAlerterConfig
|
---@field combatAlerter HeimdallCombatAlerterConfig
|
||||||
---@field sniffer HeimdallSnifferConfig
|
---@field sniffer HeimdallSnifferConfig
|
||||||
---@field bonkDetector HeimdallBonkDetectorConfig
|
|
||||||
---@field noter HeimdallNoterConfig
|
---@field noter HeimdallNoterConfig
|
||||||
---@field network HeimdallNetworkConfig
|
---@field network HeimdallNetworkConfig
|
||||||
---@field networkMessenger HeimdallNetworkMessengerConfig
|
---@field networkMessenger HeimdallNetworkMessengerConfig
|
||||||
---@field configurator HeimdallConfiguratorConfig
|
---@field configurator HeimdallConfiguratorConfig
|
||||||
---@field stinkyCache HeimdallStinkyCacheConfig
|
---@field stinkyCache HeimdallStinkyCacheConfig
|
||||||
---@field achievementSniffer HeimdallAchievementSnifferConfig
|
---@field achievementSniffer HeimdallAchievementSnifferConfig
|
||||||
|
---@field chatSniffer HeimdallChatSnifferConfig
|
||||||
---@field whisperNotify table<string, string>
|
---@field whisperNotify table<string, string>
|
||||||
---@field addonPrefix string
|
---@field addonPrefix string
|
||||||
---@field stinkies table<string, boolean>
|
---@field stinkies table<string, boolean>
|
||||||
@@ -95,203 +95,6 @@ local function init()
|
|||||||
---@field locale string
|
---@field locale string
|
||||||
---@field debug boolean
|
---@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)
|
shared.GetOrDefault = function(table, keys, default)
|
||||||
local value = default
|
local value = default
|
||||||
if not table then return value end
|
if not table then return value end
|
||||||
@@ -311,16 +114,13 @@ local function init()
|
|||||||
return value
|
return value
|
||||||
end
|
end
|
||||||
|
|
||||||
shared.messenger = {
|
|
||||||
queue = {},
|
|
||||||
}
|
|
||||||
shared.who = {
|
|
||||||
ignored = {},
|
|
||||||
}
|
|
||||||
|
|
||||||
--/run Heimdall_Data.config.who.queries="g-\"БеспредеЛ\"|ally"
|
--/run Heimdall_Data.config.who.queries="g-\"БеспредеЛ\"|ally"
|
||||||
Heimdall_Data.config = {
|
Heimdall_Data.config = {
|
||||||
debug = shared.GetOrDefault(Heimdall_Data, { "config", "debug" }, false),
|
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 = {
|
spotter = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "enabled" }, true),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "enabled" }, true),
|
||||||
debug = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "debug" }, false),
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "debug" }, false),
|
||||||
@@ -419,6 +219,7 @@ local function init()
|
|||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "enabled" }, false),
|
||||||
debug = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "debug" }, false),
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "debug" }, false),
|
||||||
channels = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "channels" }, { "Agent" }),
|
channels = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "channels" }, { "Agent" }),
|
||||||
|
ignoredTimeout = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "ignoredTimeout" }, 600),
|
||||||
},
|
},
|
||||||
combatAlerter = {
|
combatAlerter = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "combatAlerter", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "combatAlerter", "enabled" }, false),
|
||||||
@@ -671,7 +472,7 @@ local function init()
|
|||||||
shared.Memoize = function(f)
|
shared.Memoize = function(f)
|
||||||
local mem = {} -- memoizing table
|
local mem = {} -- memoizing table
|
||||||
setmetatable(mem, { __mode = "kv" }) -- make it weak
|
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
|
if Heimdall_Data.config.debug then print(string.format("[Heimdall] Memoize %s", tostring(x))) end
|
||||||
local r = mem[x]
|
local r = mem[x]
|
||||||
if r == nil then -- no previous result?
|
if r == nil then -- no previous result?
|
||||||
|
BIN
Heimdall.zip
(Stored with Git LFS)
Normal file
BIN
Heimdall.zip
(Stored with Git LFS)
Normal file
Binary file not shown.
@@ -2,6 +2,16 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "AchievementSniffer"
|
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 HeimdallRoot = "Interface\\AddOns\\Heimdall\\"
|
||||||
-- local TextureRoot = HeimdallRoot .. "Texture\\"
|
-- local TextureRoot = HeimdallRoot .. "Texture\\"
|
||||||
|
|
||||||
@@ -74,9 +84,9 @@ local Achievements = {
|
|||||||
12448,
|
12448,
|
||||||
}
|
}
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class AchievementSniffer
|
||||||
shared.AchievementSniffer = {}
|
shared.AchievementSniffer = {
|
||||||
function shared.AchievementSniffer.Init()
|
Init = function()
|
||||||
if Heimdall_Data.config.achievementSniffer.debug then
|
if Heimdall_Data.config.achievementSniffer.debug then
|
||||||
print(string.format("[%s] Module initialized", ModuleName))
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end
|
||||||
@@ -289,5 +299,6 @@ function shared.AchievementSniffer.Init()
|
|||||||
end
|
end
|
||||||
Tick()
|
Tick()
|
||||||
|
|
||||||
print("[Heimdall] AchievementSniffer loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,9 +2,52 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "AgentTracker"
|
local ModuleName = "AgentTracker"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class AgentTrackerData
|
||||||
shared.AgentTracker = {}
|
---@field agents ReactiveValue<table<string, string>>
|
||||||
function shared.AgentTracker.Init()
|
|
||||||
|
---@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")
|
--/run Heimdall_Data.config.agents["Cyheuraeth"]=date("%Y-%m-%dT%H:%M:%S")
|
||||||
---@type table<string, boolean>
|
---@type table<string, boolean>
|
||||||
local channelRosterFrame = CreateFrame("Frame")
|
local channelRosterFrame = CreateFrame("Frame")
|
||||||
@@ -37,21 +80,7 @@ function shared.AgentTracker.Init()
|
|||||||
local newAgents = 0
|
local newAgents = 0
|
||||||
for i = 1, count do
|
for i = 1, count do
|
||||||
name = GetChannelRosterInfo(index, i)
|
name = GetChannelRosterInfo(index, i)
|
||||||
if name then
|
shared.AgentTracker.Track(name)
|
||||||
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
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if Heimdall_Data.config.agentTracker.debug then
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
@@ -89,19 +118,17 @@ function shared.AgentTracker.Init()
|
|||||||
end
|
end
|
||||||
if Heimdall_Data.config.agentTracker.debug then
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
|
print(string.format("[%s] Processing message from master channel: %s", ModuleName, sender))
|
||||||
shared.dump(Heimdall_Data.config.agentTracker)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
sender = string.match(sender, "^[^-]+")
|
sender = string.match(sender, "^[^-]+")
|
||||||
local isNewAgent = not Heimdall_Data.config.agents[sender]
|
local new = shared.AgentTracker.Track(sender)
|
||||||
Heimdall_Data.config.agents[sender] = date("%Y-%m-%dT%H:%M:%S")
|
|
||||||
|
|
||||||
if Heimdall_Data.config.agentTracker.debug then
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
print(
|
print(
|
||||||
string.format(
|
string.format(
|
||||||
"[%s] %s agent from message: %s",
|
"[%s] %s agent from message: %s",
|
||||||
ModuleName,
|
ModuleName,
|
||||||
isNewAgent and "Added new" or "Updated existing",
|
new and "Added new" or "Updated existing",
|
||||||
sender
|
sender
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -109,11 +136,9 @@ function shared.AgentTracker.Init()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
if Heimdall_Data.config.agentTracker.debug then
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
local count = 0
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
for _ in pairs(Heimdall_Data.config.agents) do
|
shared.dump(shared.agentTracker.agents:get(), "Agents")
|
||||||
count = count + 1
|
|
||||||
end
|
end
|
||||||
print(string.format("[%s] Module initialized - Tracking %d agents", ModuleName, count))
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
print("[Heimdall] AgentTracker loaded")
|
}
|
||||||
end
|
|
||||||
|
@@ -2,9 +2,16 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "BonkDetector"
|
local ModuleName = "BonkDetector"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallBonkDetectorConfig
|
||||||
shared.BonkDetector = {}
|
---@field enabled boolean
|
||||||
function shared.BonkDetector.Init()
|
---@field debug boolean
|
||||||
|
---@field channels string[]
|
||||||
|
---@field throttle number
|
||||||
|
|
||||||
|
---@class BonkDetector
|
||||||
|
shared.BonkDetector = {
|
||||||
|
---@return nil
|
||||||
|
Init = function()
|
||||||
---@type table<string, number>
|
---@type table<string, number>
|
||||||
local lastReportTime = {}
|
local lastReportTime = {}
|
||||||
|
|
||||||
@@ -130,5 +137,6 @@ function shared.BonkDetector.Init()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
print("[Heimdall] BonkDetector loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,9 +2,15 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Bully"
|
local ModuleName = "Bully"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallBullyConfig
|
||||||
shared.Bully = {}
|
---@field enabled boolean
|
||||||
function shared.Bully.Init()
|
---@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
|
if Heimdall_Data.config.bully.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||||
print("[Heimdall] Bully loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,9 +2,13 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "ChatSniffer"
|
local ModuleName = "ChatSniffer"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallChatSnifferConfig
|
||||||
shared.ChatSniffer = {}
|
---@field enabled boolean
|
||||||
function shared.ChatSniffer.Init()
|
---@field debug boolean
|
||||||
|
|
||||||
|
---@class ChatSniffer
|
||||||
|
shared.ChatSniffer = {
|
||||||
|
Init = function()
|
||||||
Heimdall_Chat = Heimdall_Chat or {}
|
Heimdall_Chat = Heimdall_Chat or {}
|
||||||
local frame = CreateFrame("Frame")
|
local frame = CreateFrame("Frame")
|
||||||
frame:RegisterEvent("CHAT_MSG_SAY")
|
frame:RegisterEvent("CHAT_MSG_SAY")
|
||||||
@@ -23,6 +27,10 @@ function shared.ChatSniffer.Init()
|
|||||||
frame:RegisterEvent("CHAT_MSG_TEXT_EMOTE")
|
frame:RegisterEvent("CHAT_MSG_TEXT_EMOTE")
|
||||||
frame:RegisterEvent("CHAT_MSG_YELL")
|
frame:RegisterEvent("CHAT_MSG_YELL")
|
||||||
frame:SetScript("OnEvent", function(self, event, msg, sender, language, channel)
|
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 timestamp = date("%Y-%m-%d %H:%M:%S")
|
||||||
local log = string.format(
|
local log = string.format(
|
||||||
"%s|%s|%s|%s|%s|%s",
|
"%s|%s|%s|%s|%s|%s",
|
||||||
@@ -36,5 +44,6 @@ function shared.ChatSniffer.Init()
|
|||||||
Heimdall_Chat[#Heimdall_Chat + 1] = log
|
Heimdall_Chat[#Heimdall_Chat + 1] = log
|
||||||
end)
|
end)
|
||||||
|
|
||||||
print("[Heimdall] ChatSniffer loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,9 +2,14 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "CombatAlerter"
|
local ModuleName = "CombatAlerter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallCombatAlerterConfig
|
||||||
shared.CombatAlerter = {}
|
---@field enabled boolean
|
||||||
function shared.CombatAlerter.Init()
|
---@field debug boolean
|
||||||
|
---@field channels string[]
|
||||||
|
|
||||||
|
---@class CombatAlerter
|
||||||
|
shared.CombatAlerter = {
|
||||||
|
Init = function()
|
||||||
local alerted = {}
|
local alerted = {}
|
||||||
local combatAlerterFrame = CreateFrame("Frame")
|
local combatAlerterFrame = CreateFrame("Frame")
|
||||||
combatAlerterFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
combatAlerterFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||||
@@ -53,7 +58,7 @@ function shared.CombatAlerter.Init()
|
|||||||
print(string.format("[%s] Combat event source: %s", ModuleName, source))
|
print(string.format("[%s] Combat event source: %s", ModuleName, source))
|
||||||
end
|
end
|
||||||
|
|
||||||
if shared.stinkyTracker.stinkies and shared.stinkyTracker.stinkies[source] then
|
if shared.StinkyTracker.IsStinky(source) then
|
||||||
if Heimdall_Data.config.combatAlerter.debug then
|
if Heimdall_Data.config.combatAlerter.debug then
|
||||||
print(
|
print(
|
||||||
string.format(
|
string.format(
|
||||||
@@ -131,5 +136,6 @@ function shared.CombatAlerter.Init()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
if Heimdall_Data.config.combatAlerter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
if Heimdall_Data.config.combatAlerter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||||
print("[Heimdall] CombatAlerter loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,6 +2,13 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Commander"
|
local ModuleName = "Commander"
|
||||||
|
|
||||||
|
---@class HeimdallCommanderConfig
|
||||||
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
|
---@field channels string[]
|
||||||
|
---@field commander string
|
||||||
|
---@field commands table<string, boolean>
|
||||||
|
|
||||||
local helpMessages = {
|
local helpMessages = {
|
||||||
ru = {
|
ru = {
|
||||||
"1) who - пишет вам никнеймы текущих врагов и локу.",
|
"1) who - пишет вам никнеймы текущих врагов и локу.",
|
||||||
@@ -31,9 +38,9 @@ local helpMessages = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class Commander
|
||||||
shared.Commander = {}
|
shared.Commander = {
|
||||||
function shared.Commander.Init()
|
Init = function()
|
||||||
---@param text string
|
---@param text string
|
||||||
---@param size number
|
---@param size number
|
||||||
---@return string[]
|
---@return string[]
|
||||||
@@ -103,6 +110,32 @@ function shared.Commander.Init()
|
|||||||
end
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
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>
|
---@param arr table<string, Player>
|
||||||
---@return string[]
|
---@return string[]
|
||||||
local function WhoPartitioned(arr)
|
local function WhoPartitioned(arr)
|
||||||
@@ -116,10 +149,23 @@ function shared.Commander.Init()
|
|||||||
end
|
end
|
||||||
---@param arr table<string, Player>
|
---@param arr table<string, Player>
|
||||||
---@return string[]
|
---@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 function CountClass(arr)
|
||||||
local ret = {}
|
local ret = {}
|
||||||
for _, player in pairs(arr) do
|
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
|
end
|
||||||
local text = {}
|
local text = {}
|
||||||
for class, count in pairs(ret) do
|
for class, count in pairs(ret) do
|
||||||
@@ -158,6 +204,15 @@ function shared.Commander.Init()
|
|||||||
if #res == 0 then return { "No stinkies found" } end
|
if #res == 0 then return { "No stinkies found" } end
|
||||||
return res
|
return res
|
||||||
end
|
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()
|
local function CountPartitionedStinkies()
|
||||||
if Heimdall_Data.config.commander.debug then
|
if Heimdall_Data.config.commander.debug then
|
||||||
print(string.format("[%s] Executing: CountPartitionedStinkies", ModuleName))
|
print(string.format("[%s] Executing: CountPartitionedStinkies", ModuleName))
|
||||||
@@ -234,12 +289,40 @@ function shared.Commander.Init()
|
|||||||
if Heimdall_Data.config.commander.debug then
|
if Heimdall_Data.config.commander.debug then
|
||||||
print(string.format("[%s] Adding stinky: %s/%s", ModuleName, name, tostring(class)))
|
print(string.format("[%s] Adding stinky: %s/%s", ModuleName, name, tostring(class)))
|
||||||
end
|
end
|
||||||
shared.stinkyTracker.stinkies[name] = {
|
shared.StinkyTracker.Track({
|
||||||
name = name,
|
name = name,
|
||||||
class = class or "unknown",
|
class = class or "unknown",
|
||||||
seenAt = GetTime(),
|
seenAt = GetTime(),
|
||||||
hostile = true,
|
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
|
end
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
@@ -251,6 +334,7 @@ function shared.Commander.Init()
|
|||||||
|
|
||||||
local commands = {
|
local commands = {
|
||||||
{ keywordRe = "^who$", commanderOnly = false, callback = WhoPartitionedStinkies },
|
{ keywordRe = "^who$", commanderOnly = false, callback = WhoPartitionedStinkies },
|
||||||
|
{ keywordRe = "^кто$", commanderOnly = false, callback = WhoPartitionedStinkiesRu },
|
||||||
{ keywordRe = "^howmany$", commanderOnly = false, callback = CountPartitionedStinkies },
|
{ keywordRe = "^howmany$", commanderOnly = false, callback = CountPartitionedStinkies },
|
||||||
{ keywordRe = "^classes$", commanderOnly = false, callback = CountClassPartitionedStinkies },
|
{ keywordRe = "^classes$", commanderOnly = false, callback = CountClassPartitionedStinkies },
|
||||||
{ keywordRe = "^help$", commanderOnly = false, callback = HelpRu },
|
{ keywordRe = "^help$", commanderOnly = false, callback = HelpRu },
|
||||||
@@ -259,6 +343,7 @@ function shared.Commander.Init()
|
|||||||
{ keywordRe = "^leavegroup$", commanderOnly = false, callback = LeaveGroup },
|
{ keywordRe = "^leavegroup$", commanderOnly = false, callback = LeaveGroup },
|
||||||
{ keywordRe = "^follow$", commanderOnly = false, callback = FollowTarget },
|
{ keywordRe = "^follow$", commanderOnly = false, callback = FollowTarget },
|
||||||
{ keywordRe = "^macro", commanderOnly = false, callback = MacroTarget },
|
{ keywordRe = "^macro", commanderOnly = false, callback = MacroTarget },
|
||||||
|
{ keywordRe = "^ignore", commanderOnly = false, callback = IgnoreMacroTarget },
|
||||||
}
|
}
|
||||||
|
|
||||||
local commanderChannelFrame = CreateFrame("Frame")
|
local commanderChannelFrame = CreateFrame("Frame")
|
||||||
@@ -306,12 +391,16 @@ function shared.Commander.Init()
|
|||||||
for _, command in ipairs(commands) do
|
for _, command in ipairs(commands) do
|
||||||
local enabled = Heimdall_Data.config.commander.commands[command.keywordRe] == true or false
|
local enabled = Heimdall_Data.config.commander.commands[command.keywordRe] == true or false
|
||||||
if Heimdall_Data.config.commander.debug then
|
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
|
end
|
||||||
if
|
if
|
||||||
enabled
|
enabled
|
||||||
and (
|
and (
|
||||||
not command.commanderOnly
|
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)
|
or (command.commanderOnly and sender == Heimdall_Data.config.commander.commander)
|
||||||
)
|
)
|
||||||
then
|
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
|
---@diagnostic disable-next-line: redundant-parameter Currently luals does not support variadic functions as a @field
|
||||||
local messages = command.callback({ strsplit(",", msg) })
|
local messages = command.callback({ strsplit(",", msg) })
|
||||||
if Heimdall_Data.config.commander.debug then
|
if Heimdall_Data.config.commander.debug then
|
||||||
---@diagnostic disable-next-line: param-type-mismatch
|
print(string.format("[%s] Messages to send: %s", ModuleName, #messages))
|
||||||
print(string.format("[%s] Messages to send: %s", ModuleName, strjoin(", ", unpack(messages))))
|
shared.dump(messages)
|
||||||
end
|
end
|
||||||
for _, message in ipairs(messages) do
|
for _, message in ipairs(messages) do
|
||||||
---@type Message
|
---@type Message
|
||||||
@@ -333,13 +422,17 @@ function shared.Commander.Init()
|
|||||||
print(string.format("[%s] Queuing message", ModuleName))
|
print(string.format("[%s] Queuing message", ModuleName))
|
||||||
shared.dump(msg)
|
shared.dump(msg)
|
||||||
end
|
end
|
||||||
--table.insert(shared.messenger.queue, msg)
|
if Heimdall_Data.config.networkMessenger.enabled then
|
||||||
table.insert(shared.networkMessenger.queue, returnmsg)
|
shared.NetworkMessenger.Enqueue(returnmsg)
|
||||||
|
elseif Heimdall_Data.config.messenger.enabled then
|
||||||
|
shared.Messenger.Enqueue(returnmsg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
print("[Heimdall] Commander module loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
local _, shared = ...
|
local _, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
|
local ModuleName = "Config"
|
||||||
|
|
||||||
---@param str string
|
---@param str string
|
||||||
---@return table<string, boolean>
|
---@return table<string, boolean>
|
||||||
@@ -398,9 +399,9 @@ end
|
|||||||
--HeimdallTestFrame:SetWidth(512)
|
--HeimdallTestFrame:SetWidth(512)
|
||||||
--configFrame:Add(HeimdallTestFrame, 20, 12)
|
--configFrame:Add(HeimdallTestFrame, 20, 12)
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class Config
|
||||||
shared.Config = {}
|
shared.Config = {
|
||||||
function shared.Config.Init()
|
Init = function()
|
||||||
configFrame.frame:SetScale(Heimdall_Data.config.scale)
|
configFrame.frame:SetScale(Heimdall_Data.config.scale)
|
||||||
|
|
||||||
local buttonColors = {
|
local buttonColors = {
|
||||||
@@ -570,7 +571,9 @@ function shared.Config.Init()
|
|||||||
)
|
)
|
||||||
configFrame:Add(scale, 2, 2)
|
configFrame:Add(scale, 2, 2)
|
||||||
local title = configFrame.frame:CreateFontString(nil, "ARTWORK", "GameFontNormal")
|
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)
|
configFrame:Add(title, 2, 7)
|
||||||
|
|
||||||
local debug = CreateBasicButton(
|
local debug = CreateBasicButton(
|
||||||
@@ -2462,7 +2465,8 @@ function shared.Config.Init()
|
|||||||
achievementSnifferConfigFrame.frame,
|
achievementSnifferConfigFrame.frame,
|
||||||
shared._L("enabled", Heimdall_Data.config.locale),
|
shared._L("enabled", Heimdall_Data.config.locale),
|
||||||
function()
|
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
|
return Heimdall_Data.config.achievementSniffer.enabled
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
@@ -2656,9 +2660,50 @@ function shared.Config.Init()
|
|||||||
channelLocaleConfigFrame:Add(channelLocale, 8, 12)
|
channelLocaleConfigFrame:Add(channelLocale, 8, 12)
|
||||||
end
|
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()
|
configFrame.frame:Hide()
|
||||||
print("[Heimdall] Config loaded")
|
print("[Heimdall] Config loaded")
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
SlashCmdList["HEIMDALL_CONFIG"] = function() configFrame.frame:Show() end
|
SlashCmdList["HEIMDALL_CONFIG"] = function() configFrame.frame:Show() end
|
||||||
SLASH_HEIMDALL_CONFIG1 = "/heimdall_config"
|
SLASH_HEIMDALL_CONFIG1 = "/heimdall_config"
|
||||||
|
@@ -2,6 +2,11 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Configurator"
|
local ModuleName = "Configurator"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallConfiguratorConfig
|
||||||
shared.Configurator = {}
|
---@field enabled boolean
|
||||||
function shared.Configurator.Init() print(string.format("[Heimdall] %s module loaded", ModuleName)) end
|
---@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
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "DeathReporter"
|
local ModuleName = "DeathReporter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallDeathReporterConfig
|
||||||
shared.DeathReporter = {}
|
---@field enabled boolean
|
||||||
function shared.DeathReporter.Init()
|
---@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>
|
---@type table<string, number>
|
||||||
local recentDeaths = {}
|
local recentDeaths = {}
|
||||||
---@type table<string, number>
|
---@type table<string, number>
|
||||||
@@ -38,7 +47,8 @@ function shared.DeathReporter.Init()
|
|||||||
and GetTime() - recentDeaths[destination] < Heimdall_Data.config.deathReporter.throttle
|
and GetTime() - recentDeaths[destination] < Heimdall_Data.config.deathReporter.throttle
|
||||||
then
|
then
|
||||||
if Heimdall_Data.config.deathReporter.debug 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(
|
print(
|
||||||
string.format(
|
string.format(
|
||||||
"[%s] Death report throttled for %s (%.1f seconds remaining)",
|
"[%s] Death report throttled for %s (%.1f seconds remaining)",
|
||||||
@@ -222,7 +232,12 @@ function shared.DeathReporter.Init()
|
|||||||
if Heimdall_Data.config.deathReporter.debug then
|
if Heimdall_Data.config.deathReporter.debug then
|
||||||
print(string.format("[%s] Received system message: %s", ModuleName, msg))
|
print(string.format("[%s] Received system message: %s", ModuleName, msg))
|
||||||
print(
|
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
|
end
|
||||||
if not source or not destination then return end
|
if not source or not destination then return end
|
||||||
@@ -248,5 +263,6 @@ function shared.DeathReporter.Init()
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
print("[Heimdall] DeathReporter loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,9 +2,14 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Dueler"
|
local ModuleName = "Dueler"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallDuelerConfig
|
||||||
shared.Dueler = {}
|
---@field enabled boolean
|
||||||
function shared.Dueler.Init()
|
---@field debug boolean
|
||||||
|
---@field declineOther boolean
|
||||||
|
|
||||||
|
---@class Dueler
|
||||||
|
shared.Dueler = {
|
||||||
|
Init = function()
|
||||||
local frame = CreateFrame("Frame")
|
local frame = CreateFrame("Frame")
|
||||||
frame:RegisterEvent("DUEL_REQUESTED")
|
frame:RegisterEvent("DUEL_REQUESTED")
|
||||||
frame:SetScript("OnEvent", function(self, event, sender)
|
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))
|
print(string.format("[%s] Checking if sender '%s' is in agents list", ModuleName, sender))
|
||||||
end
|
end
|
||||||
|
|
||||||
local allow = Heimdall_Data.config.agents[sender]
|
local allow = shared.AgentTracker.IsAgent(sender)
|
||||||
if allow then
|
if allow then
|
||||||
if Heimdall_Data.config.dueler.debug then
|
if Heimdall_Data.config.dueler.debug then
|
||||||
print(string.format("[%s] Accepting duel from trusted agent: %s", ModuleName, sender))
|
print(string.format("[%s] Accepting duel from trusted agent: %s", ModuleName, sender))
|
||||||
@@ -36,7 +41,9 @@ function shared.Dueler.Init()
|
|||||||
CancelDuel()
|
CancelDuel()
|
||||||
else
|
else
|
||||||
if Heimdall_Data.config.dueler.debug then
|
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
|
end
|
||||||
end
|
end
|
||||||
@@ -51,5 +58,6 @@ function shared.Dueler.Init()
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
print("[Heimdall] Dueler loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -3,8 +3,9 @@ local _, shared = ...
|
|||||||
|
|
||||||
if not shared.dump then
|
if not shared.dump then
|
||||||
---@param value any
|
---@param value any
|
||||||
|
---@param msg string?
|
||||||
---@param depth number?
|
---@param depth number?
|
||||||
shared.dump = function(value, depth)
|
shared.dump = function(value, msg, depth)
|
||||||
if not value then
|
if not value then
|
||||||
print(tostring(value))
|
print(tostring(value))
|
||||||
return
|
return
|
||||||
@@ -13,6 +14,7 @@ if not shared.dump then
|
|||||||
print(tostring(value))
|
print(tostring(value))
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
if msg then print(msg) end
|
||||||
if depth == nil then depth = 0 end
|
if depth == nil then depth = 0 end
|
||||||
if depth > 200 then
|
if depth > 200 then
|
||||||
print("Error: Depth > 200 in dump()")
|
print("Error: Depth > 200 in dump()")
|
||||||
@@ -21,7 +23,7 @@ if not shared.dump then
|
|||||||
for k, v in pairs(value) do
|
for k, v in pairs(value) do
|
||||||
if type(v) == "table" then
|
if type(v) == "table" then
|
||||||
print(string.rep(" ", depth) .. tostring(k) .. ":")
|
print(string.rep(" ", depth) .. tostring(k) .. ":")
|
||||||
shared.dump(v, depth + 1)
|
shared.dump(v, msg, depth + 1)
|
||||||
else
|
else
|
||||||
print(string.rep(" ", depth) .. tostring(k) .. ": " .. tostring(v))
|
print(string.rep(" ", depth) .. tostring(k) .. ": " .. tostring(v))
|
||||||
end
|
end
|
||||||
|
@@ -2,9 +2,15 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Echoer"
|
local ModuleName = "Echoer"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallEchoerConfig
|
||||||
shared.Echoer = {}
|
---@field enabled boolean
|
||||||
function shared.Echoer.Init()
|
---@field debug boolean
|
||||||
|
---@field channels string[]
|
||||||
|
---@field prefix string
|
||||||
|
|
||||||
|
---@class Echoer
|
||||||
|
shared.Echoer = {
|
||||||
|
Init = function()
|
||||||
local frame = CreateFrame("Frame")
|
local frame = CreateFrame("Frame")
|
||||||
frame:RegisterEvent("CHAT_MSG_CHANNEL")
|
frame:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||||
frame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
frame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||||
@@ -54,5 +60,6 @@ function shared.Echoer.Init()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
if Heimdall_Data.config.echoer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
if Heimdall_Data.config.echoer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||||
print("[Heimdall] Echoer loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,9 +2,15 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Emoter"
|
local ModuleName = "Emoter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallEmoterConfig
|
||||||
shared.Emoter = {}
|
---@field enabled boolean
|
||||||
function shared.Emoter.Init()
|
---@field debug boolean
|
||||||
|
---@field channels string[]
|
||||||
|
---@field prefix string
|
||||||
|
|
||||||
|
---@class Emoter
|
||||||
|
shared.Emoter = {
|
||||||
|
Init = function()
|
||||||
local frame = CreateFrame("Frame")
|
local frame = CreateFrame("Frame")
|
||||||
frame:RegisterEvent("CHAT_MSG_CHANNEL")
|
frame:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||||
frame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
frame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||||
@@ -55,5 +61,6 @@ function shared.Emoter.Init()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
if Heimdall_Data.config.emoter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
if Heimdall_Data.config.emoter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||||
print("[Heimdall] Emoter loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,9 +2,22 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Inviter"
|
local ModuleName = "Inviter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallInviterConfig
|
||||||
shared.Inviter = {}
|
---@field enabled boolean
|
||||||
function shared.Inviter.Init()
|
---@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
|
-- Fallback for old config
|
||||||
if type(Heimdall_Data.config.inviter.listeningChannel) == "string" then
|
if type(Heimdall_Data.config.inviter.listeningChannel) == "string" then
|
||||||
Heimdall_Data.config.inviter.listeningChannel = {
|
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.agentsAssist then
|
||||||
if Heimdall_Data.config.inviter.debug then
|
if Heimdall_Data.config.inviter.debug then
|
||||||
local agentCount = 0
|
print(string.format("[%s] Processing agents for assistant promotion", ModuleName))
|
||||||
for _ in pairs(Heimdall_Data.config.agents) do
|
|
||||||
agentCount = agentCount + 1
|
|
||||||
end
|
|
||||||
print(string.format("[%s] Processing %d agents for assistant promotion", ModuleName, agentCount))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
for name, _ in pairs(Heimdall_Data.config.agents) do
|
shared.AgentTracker.ForEach(function(agent)
|
||||||
if UnitInParty(name) and not UnitIsGroupLeader(name) and not UnitIsRaidOfficer(name) then
|
if UnitInParty(agent) and not UnitIsGroupLeader(agent) and not UnitIsRaidOfficer(agent) then
|
||||||
if Heimdall_Data.config.inviter.debug 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
|
end
|
||||||
PromoteToAssistant(name, true)
|
PromoteToAssistant(agent, true)
|
||||||
elseif Heimdall_Data.config.inviter.debug then
|
elseif Heimdall_Data.config.inviter.debug then
|
||||||
if not UnitInParty(name) then
|
if not UnitInParty(agent) then
|
||||||
print(string.format("[%s] Agent not in party: %s", ModuleName, name))
|
print(string.format("[%s] Agent not in party: %s", ModuleName, agent))
|
||||||
elseif UnitIsGroupLeader(name) then
|
elseif UnitIsGroupLeader(agent) then
|
||||||
print(string.format("[%s] Agent is already leader: %s", ModuleName, name))
|
print(string.format("[%s] Agent is already leader: %s", ModuleName, agent))
|
||||||
elseif UnitIsRaidOfficer(name) then
|
elseif UnitIsRaidOfficer(agent) then
|
||||||
print(string.format("[%s] Agent is already assistant: %s", ModuleName, name))
|
print(string.format("[%s] Agent is already assistant: %s", ModuleName, agent))
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
if Heimdall_Data.config.inviter.debug then
|
if Heimdall_Data.config.inviter.debug then
|
||||||
@@ -229,7 +238,9 @@ function shared.Inviter.Init()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
if msg == Heimdall_Data.config.inviter.keyword then
|
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)
|
InviteUnit(sender)
|
||||||
else
|
else
|
||||||
if Heimdall_Data.config.inviter.debug then
|
if Heimdall_Data.config.inviter.debug then
|
||||||
@@ -259,5 +270,6 @@ function shared.Inviter.Init()
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
print("[Heimdall] Inviter loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,15 +2,14 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Macroer"
|
local ModuleName = "Macroer"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallMacroerConfig
|
||||||
shared.Macroer = {}
|
---@field enabled boolean
|
||||||
function shared.Macroer.Init()
|
---@field debug boolean
|
||||||
---@class stinky
|
---@field priority string[]
|
||||||
---@field name string
|
|
||||||
---@field class string
|
|
||||||
---@field seenAt number
|
|
||||||
---@field hostile boolean
|
|
||||||
|
|
||||||
|
---@class Macroer
|
||||||
|
shared.Macroer = {
|
||||||
|
Init = function()
|
||||||
local function FindOrCreateMacro(macroName)
|
local function FindOrCreateMacro(macroName)
|
||||||
if Heimdall_Data.config.macroer.debug then
|
if Heimdall_Data.config.macroer.debug then
|
||||||
print(string.format("[%s] Finding or creating macro: %s", ModuleName, macroName))
|
print(string.format("[%s] Finding or creating macro: %s", ModuleName, macroName))
|
||||||
@@ -27,7 +26,7 @@ function shared.Macroer.Init()
|
|||||||
return idx
|
return idx
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param stinkies table<string, stinky>
|
---@param stinkies table<string, Stinky>
|
||||||
local function FixMacro(stinkies)
|
local function FixMacro(stinkies)
|
||||||
if Heimdall_Data.config.macroer.debug then
|
if Heimdall_Data.config.macroer.debug then
|
||||||
print(string.format("[%s] Fixing macro with %d stinkies", ModuleName, #stinkies))
|
print(string.format("[%s] Fixing macro with %d stinkies", ModuleName, #stinkies))
|
||||||
@@ -53,7 +52,7 @@ function shared.Macroer.Init()
|
|||||||
|
|
||||||
local sortedStinkies = {}
|
local sortedStinkies = {}
|
||||||
for _, stinky in pairs(stinkies) do
|
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
|
end
|
||||||
|
|
||||||
if Heimdall_Data.config.macroer.debug then
|
if Heimdall_Data.config.macroer.debug then
|
||||||
@@ -89,13 +88,14 @@ function shared.Macroer.Init()
|
|||||||
EditMacro(idx, "HeimdallTarget", "INV_Misc_QuestionMark", body)
|
EditMacro(idx, "HeimdallTarget", "INV_Misc_QuestionMark", body)
|
||||||
end
|
end
|
||||||
|
|
||||||
shared.stinkyTracker.stinkies:onChange(function(value)
|
shared.StinkyTracker.OnChange(function(stinkies)
|
||||||
if Heimdall_Data.config.macroer.debug then
|
if Heimdall_Data.config.macroer.debug then
|
||||||
print(string.format("[%s] Stinkies changed, updating macro", ModuleName))
|
print(string.format("[%s] Stinkies changed, updating macro", ModuleName))
|
||||||
|
shared.dump(stinkies)
|
||||||
end
|
end
|
||||||
FixMacro(value)
|
FixMacro(stinkies)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
if Heimdall_Data.config.macroer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
if Heimdall_Data.config.macroer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||||
print("[Heimdall] Macroer loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,13 +2,28 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Messenger"
|
local ModuleName = "Messenger"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallMessengerConfig
|
||||||
shared.Messenger = {}
|
---@field enabled boolean
|
||||||
function shared.Messenger.Init()
|
---@field debug boolean
|
||||||
---@class Message
|
---@field interval number
|
||||||
---@field message string
|
|
||||||
---@field channel string
|
---@class HeimdallMessengerData
|
||||||
---@field data string
|
---@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 function FindOrJoinChannel(channelName, password)
|
||||||
local channelId = GetChannelName(channelName)
|
local channelId = GetChannelName(channelName)
|
||||||
@@ -29,84 +44,76 @@ function shared.Messenger.Init()
|
|||||||
return channelId
|
return channelId
|
||||||
end
|
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
|
if not shared.messenger.ticker then
|
||||||
local function DoMessage()
|
local function DoMessage()
|
||||||
if Heimdall_Data.config.messenger.debug then
|
-- if Heimdall_Data.config.messenger.debug then
|
||||||
print(string.format("[%s] Processing message queue - Size: %d", ModuleName, #shared.messenger.queue))
|
-- print(
|
||||||
end
|
-- string.format(
|
||||||
|
-- "[%s] Processing message queue - Size: %d",
|
||||||
|
-- ModuleName,
|
||||||
|
-- #shared.messenger.queue:get()
|
||||||
|
-- )
|
||||||
|
-- )
|
||||||
|
-- end
|
||||||
|
|
||||||
if not Heimdall_Data.config.messenger.enabled then
|
if not Heimdall_Data.config.messenger.enabled then
|
||||||
if Heimdall_Data.config.messenger.debug then
|
-- if Heimdall_Data.config.messenger.debug then
|
||||||
print(string.format("[%s] Module disabled, skipping message processing", ModuleName))
|
-- print(string.format("[%s] Module disabled, skipping message processing", ModuleName))
|
||||||
end
|
-- end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
---@type Message
|
---@type Message
|
||||||
local message = shared.messenger.queue[1]
|
local message = shared.messenger.queue[1]
|
||||||
if not message then
|
if not message then
|
||||||
if Heimdall_Data.config.messenger.debug then
|
-- if Heimdall_Data.config.messenger.debug then
|
||||||
print(string.format("[%s] Message queue empty", ModuleName))
|
-- print(string.format("[%s] Message queue empty", ModuleName))
|
||||||
end
|
-- end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if Heimdall_Data.config.messenger.debug then
|
if Heimdall_Data.config.messenger.debug then shared.dump(message, "[%s] Processing message:") end
|
||||||
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 not message.message or message.message == "" then
|
if not message.message or message.message == "" then
|
||||||
if Heimdall_Data.config.messenger.debug 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
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not message.channel or message.channel == "" then
|
if not message.channel or message.channel == "" then
|
||||||
if Heimdall_Data.config.messenger.debug 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
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if string.find(message.channel, "^C") then
|
if string.find(message.channel, "^C") then
|
||||||
if Heimdall_Data.config.messenger.debug 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
|
end
|
||||||
message.channel = "CHANNEL"
|
message.channel = "CHANNEL"
|
||||||
elseif string.find(message.channel, "^W") then
|
elseif string.find(message.channel, "^W") then
|
||||||
if Heimdall_Data.config.messenger.debug 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
|
end
|
||||||
message.channel = "WHISPER"
|
message.channel = "WHISPER"
|
||||||
end
|
end
|
||||||
|
|
||||||
if message.channel == "CHANNEL" and message.data and string.match(message.data, "%D") then
|
if message.channel == "CHANNEL" and message.data and string.match(message.data, "%D") then
|
||||||
if Heimdall_Data.config.messenger.debug then
|
if Heimdall_Data.config.messenger.debug then
|
||||||
print(
|
shared.dump(message, string.format("[%s] Processing channel message:", ModuleName))
|
||||||
string.format(
|
|
||||||
"[%s] Processing channel message: '%s' to '%s'",
|
|
||||||
ModuleName,
|
|
||||||
message.message,
|
|
||||||
message.data
|
|
||||||
)
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
local channelId = GetChannelName(message.data)
|
local channelId = GetChannelName(message.data)
|
||||||
if channelId == 0 then
|
if channelId == 0 then
|
||||||
if Heimdall_Data.config.messenger.debug 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
|
end
|
||||||
channelId = FindOrJoinChannel(message.data)
|
channelId = FindOrJoinChannel(message.data)
|
||||||
if Heimdall_Data.config.messenger.debug then
|
if Heimdall_Data.config.messenger.debug then
|
||||||
@@ -119,44 +126,36 @@ function shared.Messenger.Init()
|
|||||||
table.remove(shared.messenger.queue, 1)
|
table.remove(shared.messenger.queue, 1)
|
||||||
if not message.message or message.message == "" then
|
if not message.message or message.message == "" then
|
||||||
if Heimdall_Data.config.messenger.debug 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
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not message.channel or message.channel == "" then
|
if not message.channel or message.channel == "" then
|
||||||
if Heimdall_Data.config.messenger.debug 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
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if not message.data or message.data == "" then
|
if not message.data or message.data == "" then
|
||||||
if Heimdall_Data.config.messenger.debug 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
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if Heimdall_Data.config.messenger.debug then
|
if Heimdall_Data.config.messenger.debug then
|
||||||
print(
|
shared.dump(message, string.format("[%s] Sending message:", ModuleName))
|
||||||
string.format(
|
|
||||||
"[%s] Sending message: '%s' to %s:%s",
|
|
||||||
ModuleName,
|
|
||||||
message.message,
|
|
||||||
message.channel,
|
|
||||||
message.data
|
|
||||||
)
|
|
||||||
)
|
|
||||||
end
|
end
|
||||||
if string.len(message.message) > 255 then
|
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
|
return
|
||||||
end
|
end
|
||||||
SendChatMessage(message.message, message.channel, nil, message.data)
|
SendChatMessage(message.message, message.channel, nil, message.data)
|
||||||
end
|
end
|
||||||
local function Tick()
|
local function Tick()
|
||||||
if Heimdall_Data.config.messenger.debug then
|
-- if Heimdall_Data.config.messenger.debug then
|
||||||
print(string.format("[%s] Tick - Queue size: %d", ModuleName, #shared.messenger.queue))
|
-- print(string.format("[%s] Tick - Queue size: %d", ModuleName, #shared.messenger.queue:get()))
|
||||||
end
|
-- end
|
||||||
DoMessage()
|
DoMessage()
|
||||||
shared.messenger.ticker = C_Timer.NewTimer(Heimdall_Data.config.messenger.interval, Tick, 1)
|
shared.messenger.ticker = C_Timer.NewTimer(Heimdall_Data.config.messenger.interval, Tick, 1)
|
||||||
end
|
end
|
||||||
@@ -172,5 +171,6 @@ function shared.Messenger.Init()
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
print("[Heimdall] Messenger loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -1,14 +1,42 @@
|
|||||||
local _, shared = ...
|
local _, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "MinimapTagger"
|
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 HeimdallRoot = "Interface\\AddOns\\Heimdall\\"
|
||||||
local SoundRoot = HeimdallRoot .. "Sounds\\"
|
local SoundRoot = HeimdallRoot .. "Sounds\\"
|
||||||
local TextureRoot = HeimdallRoot .. "Texture\\"
|
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)
|
--/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
|
---@class MinimapTagger
|
||||||
shared.MinimapTagger = {}
|
shared.MinimapTagger = {
|
||||||
function shared.MinimapTagger.Init()
|
Init = function()
|
||||||
---@param x number
|
---@param x number
|
||||||
---@param y number
|
---@param y number
|
||||||
---@param frame Frame
|
---@param frame Frame
|
||||||
@@ -564,8 +592,6 @@ function shared.MinimapTagger.Init()
|
|||||||
--endregion
|
--endregion
|
||||||
end)
|
end)
|
||||||
|
|
||||||
print("[Heimdall] MinimapTagger loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
SlashCmdList["HEIMDALL_MINIMAPTAGGER"] = function(args) shared.MinimapTagger.Init() end
|
|
||||||
SLASH_HEIMDALL_MINIMAPTAGGER1 = "/mf"
|
|
||||||
|
@@ -2,9 +2,18 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Network"
|
local ModuleName = "Network"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallNetworkConfig
|
||||||
shared.Network = {}
|
---@field enabled boolean
|
||||||
function shared.Network.Init()
|
---@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
|
if not shared.network then shared.network = {} end
|
||||||
local updatePending = false
|
local updatePending = false
|
||||||
|
|
||||||
@@ -18,7 +27,9 @@ function shared.Network.Init()
|
|||||||
if name then
|
if name then
|
||||||
friends[name] = connected
|
friends[name] = connected
|
||||||
if Heimdall_Data.config.network.debug then
|
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
|
end
|
||||||
else
|
else
|
||||||
if Heimdall_Data.config.network.debug then
|
if Heimdall_Data.config.network.debug then
|
||||||
@@ -69,5 +80,6 @@ function shared.Network.Init()
|
|||||||
end
|
end
|
||||||
|
|
||||||
NetworkTick()
|
NetworkTick()
|
||||||
print("[Heimdall] Network module loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,13 +2,26 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "NetworkMessenger"
|
local ModuleName = "NetworkMessenger"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallNetworkMessengerConfig
|
||||||
shared.NetworkMessenger = {}
|
---@field enabled boolean
|
||||||
function shared.NetworkMessenger.Init()
|
---@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)
|
RegisterAddonMessagePrefix(Heimdall_Data.config.addonPrefix)
|
||||||
|
|
||||||
if not shared.networkMessenger then shared.networkMessenger = {} end
|
shared.networkMessenger = {
|
||||||
if not shared.networkMessenger.queue then shared.networkMessenger.queue = {} end
|
queue = ReactiveValue.new({}),
|
||||||
|
}
|
||||||
|
|
||||||
if not shared.networkMessenger.ticker then
|
if not shared.networkMessenger.ticker then
|
||||||
local function DoMessage()
|
local function DoMessage()
|
||||||
--if Heimdall_Data.config.networkMessenger.debug then
|
--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))
|
-- print(string.format("[%s] Queue check - Network messages pending: %d", ModuleName, queueSize))
|
||||||
--end
|
--end
|
||||||
DoMessage()
|
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
|
end
|
||||||
Tick()
|
Tick()
|
||||||
end
|
end
|
||||||
@@ -140,7 +154,13 @@ function shared.NetworkMessenger.Init()
|
|||||||
local target = strtrim(tostring(parts[4]))
|
local target = strtrim(tostring(parts[4]))
|
||||||
if Heimdall_Data.config.networkMessenger.debug then
|
if Heimdall_Data.config.networkMessenger.debug then
|
||||||
print(
|
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
|
end
|
||||||
---@type Message
|
---@type Message
|
||||||
@@ -179,5 +199,6 @@ function shared.NetworkMessenger.Init()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
print("[Heimdall] NetworkMessenger module loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,15 +2,21 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Noter"
|
local ModuleName = "Noter"
|
||||||
|
|
||||||
|
---@class HeimdallNoterConfig
|
||||||
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
|
---@field channels string[]
|
||||||
|
---@field lastNotes number
|
||||||
|
|
||||||
---@class Note
|
---@class Note
|
||||||
---@field source string
|
---@field source string
|
||||||
---@field for string
|
---@field for string
|
||||||
---@field date string
|
---@field date string
|
||||||
---@field note string
|
---@field note string
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class Noter
|
||||||
shared.Noter = {}
|
shared.Noter = {
|
||||||
function shared.Noter.Init()
|
Init = function()
|
||||||
-- ---Hopefully this will not be necessary
|
-- ---Hopefully this will not be necessary
|
||||||
-- ---@param text string
|
-- ---@param text string
|
||||||
-- ---@param size number
|
-- ---@param size number
|
||||||
@@ -68,7 +74,9 @@ function shared.Noter.Init()
|
|||||||
|
|
||||||
if not start then
|
if not start then
|
||||||
if Heimdall_Data.config.noter.debug 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
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -113,8 +121,11 @@ function shared.Noter.Init()
|
|||||||
data = channel,
|
data = channel,
|
||||||
message = string.format("[%s][%d] %s: %s", note.source, index, note.date, note.note),
|
message = string.format("[%s][%d] %s: %s", note.source, index, note.date, note.note),
|
||||||
}
|
}
|
||||||
--table.insert(shared.messenger.queue, msg)
|
if Heimdall_Data.config.networkMessenger.enabled then
|
||||||
table.insert(shared.networkMessenger.queue, msg)
|
shared.NetworkMessenger.Enqueue(msg)
|
||||||
|
elseif Heimdall_Data.config.messenger.enabled then
|
||||||
|
shared.Messenger.Enqueue(msg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
---@param name string
|
---@param name string
|
||||||
---@param args string[]
|
---@param args string[]
|
||||||
@@ -291,5 +302,6 @@ function shared.Noter.Init()
|
|||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
print("[Heimdall] Commander module loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,9 +2,17 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Sniffer"
|
local ModuleName = "Sniffer"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallSnifferConfig
|
||||||
shared.Sniffer = {}
|
---@field enabled boolean
|
||||||
function shared.Sniffer.Init()
|
---@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
|
if Heimdall_Data.config.sniffer.debug then print(string.format("[%s] Module initializing", ModuleName)) end
|
||||||
local smellThrottle = {}
|
local smellThrottle = {}
|
||||||
local SmellStinky = function(stinky)
|
local SmellStinky = function(stinky)
|
||||||
@@ -19,13 +27,11 @@ function shared.Sniffer.Init()
|
|||||||
end
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local now = GetTime()
|
if smellThrottle[stinky] and GetTime() - smellThrottle[stinky] < Heimdall_Data.config.sniffer.throttle then
|
||||||
local throttle = smellThrottle[stinky] or 0
|
|
||||||
if now - throttle < Heimdall_Data.config.sniffer.throttle then
|
|
||||||
if Heimdall_Data.config.sniffer.debug then print(string.format("%s: Throttled", ModuleName)) end
|
if Heimdall_Data.config.sniffer.debug then print(string.format("%s: Throttled", ModuleName)) end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
smellThrottle[stinky] = now
|
smellThrottle[stinky] = GetTime()
|
||||||
|
|
||||||
for _, channel in pairs(Heimdall_Data.config.sniffer.channels) do
|
for _, channel in pairs(Heimdall_Data.config.sniffer.channels) do
|
||||||
local locale = shared.GetLocaleForChannel(channel)
|
local locale = shared.GetLocaleForChannel(channel)
|
||||||
@@ -81,5 +87,6 @@ function shared.Sniffer.Init()
|
|||||||
SmellStinky(destination)
|
SmellStinky(destination)
|
||||||
end)
|
end)
|
||||||
if Heimdall_Data.config.sniffer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
if Heimdall_Data.config.sniffer.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||||
print("[Heimdall] Sniffer loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,9 +2,20 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Spotter"
|
local ModuleName = "Spotter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallSpotterConfig
|
||||||
shared.Spotter = {}
|
---@field enabled boolean
|
||||||
function shared.Spotter.Init()
|
---@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)
|
local function FormatHP(hp)
|
||||||
if hp > 1e9 then
|
if hp > 1e9 then
|
||||||
return string.format("%.1fB", hp / 1e9)
|
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))
|
print(string.format("[%s] Checking notification criteria for %s (%s)", ModuleName, name, faction))
|
||||||
end
|
end
|
||||||
|
|
||||||
if Heimdall_Data.config.agents[name] then
|
if shared.AgentTracker.IsAgent(name) then
|
||||||
if Heimdall_Data.config.spotter.debug then
|
if Heimdall_Data.config.spotter.debug then
|
||||||
print(string.format("[%s] Skipping agent: %s", ModuleName, name))
|
print(string.format("[%s] Skipping agent: %s", ModuleName, name))
|
||||||
end
|
end
|
||||||
@@ -102,7 +113,9 @@ function shared.Spotter.Init()
|
|||||||
if throttleTable[name] and time - throttleTable[name] < Heimdall_Data.config.spotter.throttleTime then
|
if throttleTable[name] and time - throttleTable[name] < Heimdall_Data.config.spotter.throttleTime then
|
||||||
if Heimdall_Data.config.spotter.debug then
|
if Heimdall_Data.config.spotter.debug then
|
||||||
local remainingTime = Heimdall_Data.config.spotter.throttleTime - (time - throttleTable[name])
|
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
|
end
|
||||||
return string.format("Throttled %s", tostring(name))
|
return string.format("Throttled %s", tostring(name))
|
||||||
end
|
end
|
||||||
@@ -220,5 +233,6 @@ function shared.Spotter.Init()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
if Heimdall_Data.config.spotter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
if Heimdall_Data.config.spotter.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||||
print("[Heimdall] Spotter loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -1,11 +1,19 @@
|
|||||||
local addonname, shared = ...
|
local _, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
|
||||||
local ModuleName = "StinkyCache"
|
local ModuleName = "StinkyCache"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallStinkyCacheConfig
|
||||||
shared.StinkyCache = {}
|
---@field enabled boolean
|
||||||
function shared.StinkyCache.Init()
|
---@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 = {
|
shared.stinkyCache = {
|
||||||
stinkies = {},
|
stinkies = {},
|
||||||
}
|
}
|
||||||
@@ -64,9 +72,12 @@ function shared.StinkyCache.Init()
|
|||||||
__index = function(self, key)
|
__index = function(self, key)
|
||||||
local value = rawget(self, key)
|
local value = rawget(self, key)
|
||||||
local now = GetTime()
|
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)
|
return rawget(self, key)
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
print("[Heimdall] StinkyCache module loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,16 +2,107 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "StinkyTracker"
|
local ModuleName = "StinkyTracker"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class Stinky
|
||||||
shared.StinkyTracker = {}
|
---@field name string
|
||||||
function shared.StinkyTracker.Init()
|
---@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 = {
|
shared.stinkyTracker = {
|
||||||
stinkies = ReactiveValue.new({}),
|
stinkies = ReactiveValue.new({}),
|
||||||
|
ignored = ReactiveValue.new({}),
|
||||||
}
|
}
|
||||||
|
|
||||||
local whoRegex = "([^ -/]+)-?%w*/(%w+)"
|
local whoRegex = "([^ -/]+)-?%w*/(%w+)"
|
||||||
---@param msg string
|
---@param msg string
|
||||||
---@return table<string, stinky>
|
---@return table<string, Stinky>
|
||||||
local function ParseWho(msg)
|
local function ParseWho(msg)
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
print(string.format("[%s] Parsing WHO message: '%s'", ModuleName, msg))
|
print(string.format("[%s] Parsing WHO message: '%s'", ModuleName, msg))
|
||||||
@@ -42,7 +133,7 @@ function shared.StinkyTracker.Init()
|
|||||||
|
|
||||||
local seeRegex = "I see %((%w+)%) ([^ -/]+)-?%w*/(%w+)"
|
local seeRegex = "I see %((%w+)%) ([^ -/]+)-?%w*/(%w+)"
|
||||||
---@param msg string
|
---@param msg string
|
||||||
---@return table<string, stinky>
|
---@return table<string, Stinky>
|
||||||
local function ParseSee(msg)
|
local function ParseSee(msg)
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
print(string.format("[%s] Parsing SEE message: '%s'", ModuleName, msg))
|
print(string.format("[%s] Parsing SEE message: '%s'", ModuleName, msg))
|
||||||
@@ -81,7 +172,7 @@ function shared.StinkyTracker.Init()
|
|||||||
local arrivedRegex = "([^ -/]+)-?%w*; c:([^;]+)"
|
local arrivedRegex = "([^ -/]+)-?%w*; c:([^;]+)"
|
||||||
local arrivedRegexAlt = "([^ -/]+)-?%w*%(!!!!%); c:([^;]+)"
|
local arrivedRegexAlt = "([^ -/]+)-?%w*%(!!!!%); c:([^;]+)"
|
||||||
---@param msg string
|
---@param msg string
|
||||||
---@return table<string, stinky>
|
---@return table<string, Stinky>
|
||||||
local function ParseArrived(msg)
|
local function ParseArrived(msg)
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
print(string.format("%s: Parsing arrived message: %s", ModuleName, msg))
|
print(string.format("%s: Parsing arrived message: %s", ModuleName, msg))
|
||||||
@@ -143,6 +234,7 @@ function shared.StinkyTracker.Init()
|
|||||||
shared.dump(Heimdall_Data.config.stinkyTracker)
|
shared.dump(Heimdall_Data.config.stinkyTracker)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local stinkies = {}
|
||||||
if string.find(msg, "^who:") then
|
if string.find(msg, "^who:") then
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
print(string.format("[%s] Processing WHO message from %s", ModuleName, sender))
|
print(string.format("[%s] Processing WHO message from %s", ModuleName, sender))
|
||||||
@@ -150,16 +242,10 @@ function shared.StinkyTracker.Init()
|
|||||||
local whoStinkies = ParseWho(msg)
|
local whoStinkies = ParseWho(msg)
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
print(string.format("[%s] Found stinkies in WHO message", ModuleName))
|
print(string.format("[%s] Found stinkies in WHO message", ModuleName))
|
||||||
|
shared.dump(whoStinkies)
|
||||||
end
|
end
|
||||||
for name, stinky in pairs(whoStinkies) do
|
for name, stinky in pairs(whoStinkies) do
|
||||||
if stinky.hostile then
|
stinkies[name] = stinky
|
||||||
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
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if string.find(msg, "^I see") then
|
if string.find(msg, "^I see") then
|
||||||
@@ -169,22 +255,10 @@ function shared.StinkyTracker.Init()
|
|||||||
local seeStinkies = ParseSee(msg)
|
local seeStinkies = ParseSee(msg)
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
print(string.format("[%s] Found stinkies in SEE message", ModuleName))
|
print(string.format("[%s] Found stinkies in SEE message", ModuleName))
|
||||||
|
shared.dump(seeStinkies)
|
||||||
end
|
end
|
||||||
for name, stinky in pairs(seeStinkies) do
|
for name, stinky in pairs(seeStinkies) do
|
||||||
if stinky.hostile then
|
stinkies[name] = stinky
|
||||||
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
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if string.find(msg, "arrived to") or string.find(msg, "moved to") then
|
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)
|
local arrivedStinkies = ParseArrived(msg)
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
print(string.format("[%s] Found stinkies in ARRIVED message", ModuleName))
|
print(string.format("[%s] Found stinkies in ARRIVED message", ModuleName))
|
||||||
|
shared.dump(arrivedStinkies)
|
||||||
end
|
end
|
||||||
for name, stinky in pairs(arrivedStinkies) do
|
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
|
shared.stinkyTracker.stinkies[name] = stinky
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
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
|
end
|
||||||
end
|
end
|
||||||
@@ -212,14 +298,14 @@ function shared.StinkyTracker.Init()
|
|||||||
print(string.format("[%s] Current total stinkies tracked: %d", ModuleName, count))
|
print(string.format("[%s] Current total stinkies tracked: %d", ModuleName, count))
|
||||||
end
|
end
|
||||||
|
|
||||||
for name, stinky in pairs(shared.stinkyTracker.stinkies) do
|
shared.StinkyTracker.ForEach(function(name, stinky)
|
||||||
if Heimdall_Data.config.agents[name] then
|
if shared.AgentTracker.IsAgent(name) then
|
||||||
shared.stinkyTracker.stinkies[name] = nil
|
shared.stinkyTracker.stinkies[name] = nil
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
print(string.format("[%s] Removed agent from stinkies: %s", ModuleName, name))
|
print(string.format("[%s] Removed agent from stinkies: %s", ModuleName, name))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local targetFrame = CreateFrame("Frame")
|
local targetFrame = CreateFrame("Frame")
|
||||||
@@ -273,5 +359,6 @@ function shared.StinkyTracker.Init()
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
if Heimdall_Data.config.stinkyTracker.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
if Heimdall_Data.config.stinkyTracker.debug then print(string.format("[%s] Module initialized", ModuleName)) end
|
||||||
print("[Heimdall] StinkyTracker loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
@@ -2,14 +2,27 @@ local _, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
local ModuleName = "Whoer"
|
local ModuleName = "Whoer"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@class HeimdallWhoConfig
|
||||||
shared.Whoer = {}
|
---@field enabled boolean
|
||||||
function shared.Whoer.Init()
|
---@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 then Heimdall_Data.who = {} end
|
||||||
if not Heimdall_Data.who.data then Heimdall_Data.who.data = {} end
|
if not Heimdall_Data.who.data then Heimdall_Data.who.data = {} end
|
||||||
|
|
||||||
local whoWaiting = false
|
|
||||||
|
|
||||||
---@type table<string, Player>
|
---@type table<string, Player>
|
||||||
HeimdallStinkies = {}
|
HeimdallStinkies = {}
|
||||||
|
|
||||||
@@ -186,12 +199,19 @@ function shared.Whoer.Init()
|
|||||||
print(string.format("[%s] ShouldNotifyForZone %s", ModuleName, inputZone))
|
print(string.format("[%s] ShouldNotifyForZone %s", ModuleName, inputZone))
|
||||||
end
|
end
|
||||||
for zone, _ in pairs(Heimdall_Data.config.who.zoneNotifyFor) do
|
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 zone == "*" then return true end
|
||||||
if string.find(inputZone, zone) then
|
if string.find(inputZone, zone) then
|
||||||
if not Heimdall_Data.config.who.debug then
|
if not Heimdall_Data.config.who.debug then
|
||||||
print(
|
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
|
end
|
||||||
return true
|
return true
|
||||||
@@ -271,7 +291,11 @@ function shared.Whoer.Init()
|
|||||||
--if not Heimdall_Data.config.who.zoneNotifyFor[player.zone] then
|
--if not Heimdall_Data.config.who.zoneNotifyFor[player.zone] then
|
||||||
if Heimdall_Data.config.who.debug then
|
if Heimdall_Data.config.who.debug then
|
||||||
print(
|
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
|
end
|
||||||
return string.format("Not notifying for zone %s", tostring(player.zone))
|
return string.format("Not notifying for zone %s", tostring(player.zone))
|
||||||
@@ -299,7 +323,11 @@ function shared.Whoer.Init()
|
|||||||
print(string.format("[%s] Queuing channel notification", ModuleName))
|
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||||
shared.dump(msg)
|
shared.dump(msg)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
--if Heimdall_Data.config.who.doWhisper then
|
--if Heimdall_Data.config.who.doWhisper then
|
||||||
@@ -358,7 +386,11 @@ function shared.Whoer.Init()
|
|||||||
print(string.format("[%s] Queuing channel notification", ModuleName))
|
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||||
shared.dump(msg)
|
shared.dump(msg)
|
||||||
end
|
end
|
||||||
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
|
end
|
||||||
|
|
||||||
--if Heimdall_Data.config.who.doWhisper then
|
--if Heimdall_Data.config.who.doWhisper then
|
||||||
@@ -409,8 +441,11 @@ function shared.Whoer.Init()
|
|||||||
print(string.format("[%s] Queuing channel notification", ModuleName))
|
print(string.format("[%s] Queuing channel notification", ModuleName))
|
||||||
shared.dump(msg)
|
shared.dump(msg)
|
||||||
end
|
end
|
||||||
--table.insert(shared.messenger.queue, msg)
|
if Heimdall_Data.config.networkMessenger.enabled then
|
||||||
table.insert(shared.networkMessenger.queue, msg)
|
shared.NetworkMessenger.Enqueue(msg)
|
||||||
|
elseif Heimdall_Data.config.messenger.enabled then
|
||||||
|
shared.Messenger.Enqueue(msg)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--if Heimdall_Data.config.who.doWhisper then
|
--if Heimdall_Data.config.who.doWhisper then
|
||||||
@@ -434,7 +469,9 @@ function shared.Whoer.Init()
|
|||||||
frame:SetScript("OnEvent", function(self, event, ...)
|
frame:SetScript("OnEvent", function(self, event, ...)
|
||||||
if Heimdall_Data.config.who.debug then
|
if Heimdall_Data.config.who.debug then
|
||||||
print(string.format("[%s] WHO list update received", ModuleName))
|
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
|
end
|
||||||
|
|
||||||
if not Heimdall_Data.config.who.enabled then
|
if not Heimdall_Data.config.who.enabled then
|
||||||
@@ -462,7 +499,15 @@ function shared.Whoer.Init()
|
|||||||
local name, guild, level, race, class, zone = GetWhoInfo(i)
|
local name, guild, level, race, class, zone = GetWhoInfo(i)
|
||||||
if Heimdall_Data.config.who.debug then
|
if Heimdall_Data.config.who.debug then
|
||||||
print(
|
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
|
end
|
||||||
|
|
||||||
@@ -472,13 +517,25 @@ function shared.Whoer.Init()
|
|||||||
for _, filter in pairs(filters) do
|
for _, filter in pairs(filters) do
|
||||||
if Heimdall_Data.config.who.debug then
|
if Heimdall_Data.config.who.debug then
|
||||||
print(
|
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
|
end
|
||||||
if not filter.Run(name, guild, level, race, class, zone) then
|
if not filter.Run(name, guild, level, race, class, zone) then
|
||||||
if Heimdall_Data.config.who.debug then
|
if Heimdall_Data.config.who.debug then
|
||||||
print(
|
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
|
end
|
||||||
continue = true
|
continue = true
|
||||||
@@ -504,7 +561,9 @@ function shared.Whoer.Init()
|
|||||||
local player = HeimdallStinkies[name]
|
local player = HeimdallStinkies[name]
|
||||||
if not player then
|
if not player then
|
||||||
if Heimdall_Data.config.who.debug 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
|
end
|
||||||
|
|
||||||
player = Player.new(name, guild, race, class, zone)
|
player = Player.new(name, guild, race, class, zone)
|
||||||
@@ -532,7 +591,14 @@ function shared.Whoer.Init()
|
|||||||
if player.firstSeen == "never" then
|
if player.firstSeen == "never" then
|
||||||
player.firstSeen = timestamp
|
player.firstSeen = timestamp
|
||||||
if Heimdall_Data.config.who.debug then
|
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
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -550,7 +616,12 @@ function shared.Whoer.Init()
|
|||||||
local err = Notify(player)
|
local err = Notify(player)
|
||||||
if err then
|
if err then
|
||||||
print(
|
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
|
end
|
||||||
|
|
||||||
@@ -573,7 +644,9 @@ function shared.Whoer.Init()
|
|||||||
)
|
)
|
||||||
end
|
end
|
||||||
local err = NotifyZoneChanged(player, zone)
|
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
|
end
|
||||||
player.zone = zone
|
player.zone = zone
|
||||||
player.lastSeen = timestamp
|
player.lastSeen = timestamp
|
||||||
@@ -585,7 +658,7 @@ function shared.Whoer.Init()
|
|||||||
end
|
end
|
||||||
-- Turns out WA cannot do this (
|
-- Turns out WA cannot do this (
|
||||||
-- aura_env.UpdateMacro()
|
-- aura_env.UpdateMacro()
|
||||||
-- We MAY not need this
|
-- No longer needed with the hook to friends frame show
|
||||||
-- _G["FriendsFrameCloseButton"]:Click()
|
-- _G["FriendsFrameCloseButton"]:Click()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -613,7 +686,10 @@ function shared.Whoer.Init()
|
|||||||
local query = shared.WhoQueryService.queries[whoQueryIdx]
|
local query = shared.WhoQueryService.queries[whoQueryIdx]
|
||||||
if not query then
|
if not query then
|
||||||
if Heimdall_Data.config.who.debug 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
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -636,24 +712,24 @@ function shared.Whoer.Init()
|
|||||||
whoQueryIdx = whoQueryIdx + 1
|
whoQueryIdx = whoQueryIdx + 1
|
||||||
if whoQueryIdx > #shared.WhoQueryService.queries then whoQueryIdx = 1 end
|
if whoQueryIdx > #shared.WhoQueryService.queries then whoQueryIdx = 1 end
|
||||||
lastQuery = query
|
lastQuery = query
|
||||||
|
whoWaiting = true
|
||||||
---@diagnostic disable-next-line: param-type-mismatch
|
---@diagnostic disable-next-line: param-type-mismatch
|
||||||
SetWhoToUI(1)
|
SetWhoToUI(1)
|
||||||
SetWhoToUI(1)
|
SetWhoToUI(1)
|
||||||
SendWho(query.query)
|
SendWho(query.query)
|
||||||
whoWaiting = true
|
|
||||||
end
|
end
|
||||||
local function Tick()
|
local function Tick()
|
||||||
DoQuery()
|
DoQuery()
|
||||||
C_Timer.NewTimer(1, Tick, 1)
|
C_Timer.NewTimer(1, Tick, 1)
|
||||||
end
|
end
|
||||||
Tick()
|
Tick()
|
||||||
|
end
|
||||||
local original_FriendsFrame_OnEvent = FriendsFrame_OnEvent
|
local original_FriendsFrame_OnEvent = FriendsFrame_OnEvent
|
||||||
local function my_FriendsFrame_OnEvent(event)
|
local function my_FriendsFrame_OnEvent(self, event, ...)
|
||||||
if not (event == "WHO_LIST_UPDATE" and whoWaiting) then original_FriendsFrame_OnEvent() end
|
if not (event == "WHO_LIST_UPDATE" and whoWaiting) then original_FriendsFrame_OnEvent(self, event, ...) end
|
||||||
end
|
end
|
||||||
FriendsFrame_OnEvent = my_FriendsFrame_OnEvent
|
FriendsFrame_OnEvent = my_FriendsFrame_OnEvent
|
||||||
end
|
|
||||||
|
|
||||||
print("[Heimdall] Whoer loaded")
|
print(string.format("[%s] Module initialized", ModuleName))
|
||||||
end
|
end,
|
||||||
|
}
|
||||||
|
2
_L.lua
2
_L.lua
@@ -90,6 +90,7 @@ shared._Locale = {
|
|||||||
updateInterval = "Update Interval",
|
updateInterval = "Update Interval",
|
||||||
networkMessenger = "Network Messenger",
|
networkMessenger = "Network Messenger",
|
||||||
queries = "Who queries",
|
queries = "Who queries",
|
||||||
|
chatSniffer = "Chat Sniffer",
|
||||||
},
|
},
|
||||||
ru = {
|
ru = {
|
||||||
bonkDetected = "%s ударил %s (%s)",
|
bonkDetected = "%s ударил %s (%s)",
|
||||||
@@ -175,6 +176,7 @@ shared._Locale = {
|
|||||||
updateInterval = "Интервал Обновления",
|
updateInterval = "Интервал Обновления",
|
||||||
networkMessenger = "Сетевой Мессенджер",
|
networkMessenger = "Сетевой Мессенджер",
|
||||||
queries = "Запросы Who",
|
queries = "Запросы Who",
|
||||||
|
chatSniffer = "Сниффер Чата",
|
||||||
["Orgrimmar"] = "Оргриммар",
|
["Orgrimmar"] = "Оргриммар",
|
||||||
["Valley of Strength"] = "Долина Силы",
|
["Valley of Strength"] = "Долина Силы",
|
||||||
["Valley of Trials"] = "Долина Испытаний",
|
["Valley of Trials"] = "Долина Испытаний",
|
||||||
|
Reference in New Issue
Block a user