Add debug options
Add debug buttons Add combatalerter debug
This commit is contained in:
59
Heimdall.lua
59
Heimdall.lua
@@ -2,11 +2,6 @@ local addonname, shared = ...
|
|||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
|
||||||
-- TODO: Implement counting kills and display on whosniffer
|
|
||||||
-- Take last N seconds of combatlog into account ie. count who does damage to who
|
|
||||||
-- Maybe even make an alert when someone does too much damage to someone else...
|
|
||||||
-- But that would not be trivial as of now, I can't think of a way to do it sensibly
|
|
||||||
|
|
||||||
local function init()
|
local function init()
|
||||||
---@class Heimdall_Data
|
---@class Heimdall_Data
|
||||||
---@field config HeimdallConfig
|
---@field config HeimdallConfig
|
||||||
@@ -41,6 +36,7 @@ local function init()
|
|||||||
---@field StinkyTracker InitTable
|
---@field StinkyTracker InitTable
|
||||||
---@field CombatAlerter InitTable
|
---@field CombatAlerter InitTable
|
||||||
---@field Config InitTable
|
---@field Config InitTable
|
||||||
|
---@field Sniffer InitTable
|
||||||
|
|
||||||
--- Config ---
|
--- Config ---
|
||||||
---@class HeimdallConfig
|
---@class HeimdallConfig
|
||||||
@@ -58,12 +54,14 @@ local function init()
|
|||||||
---@field commander HeimdallCommanderConfig
|
---@field commander HeimdallCommanderConfig
|
||||||
---@field stinkyTracker HeimdallStinkyTrackerConfig
|
---@field stinkyTracker HeimdallStinkyTrackerConfig
|
||||||
---@field combatAlerter HeimdallCombatAlerterConfig
|
---@field combatAlerter HeimdallCombatAlerterConfig
|
||||||
|
---@field sniffer HeimdallSnifferConfig
|
||||||
---@field whisperNotify table<string, string>
|
---@field whisperNotify table<string, string>
|
||||||
---@field stinkies table<string, boolean>
|
---@field stinkies table<string, boolean>
|
||||||
---@field agents table<string, string>
|
---@field agents table<string, string>
|
||||||
|
|
||||||
---@class HeimdallSpotterConfig
|
---@class HeimdallSpotterConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field everyone boolean
|
---@field everyone boolean
|
||||||
---@field hostile boolean
|
---@field hostile boolean
|
||||||
---@field alliance boolean
|
---@field alliance boolean
|
||||||
@@ -74,6 +72,7 @@ local function init()
|
|||||||
|
|
||||||
---@class HeimdallWhoConfig
|
---@class HeimdallWhoConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field ignored table<string, boolean>
|
---@field ignored table<string, boolean>
|
||||||
---@field notifyChannel string
|
---@field notifyChannel string
|
||||||
---@field ttl number
|
---@field ttl number
|
||||||
@@ -82,10 +81,12 @@ local function init()
|
|||||||
|
|
||||||
---@class HeimdallMessengerConfig
|
---@class HeimdallMessengerConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field interval number
|
---@field interval number
|
||||||
|
|
||||||
---@class HeimdallDeathReporterConfig
|
---@class HeimdallDeathReporterConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field throttle number
|
---@field throttle number
|
||||||
---@field doWhisper boolean
|
---@field doWhisper boolean
|
||||||
---@field notifyChannel string
|
---@field notifyChannel string
|
||||||
@@ -94,6 +95,7 @@ local function init()
|
|||||||
|
|
||||||
---@class HeimdallInviterConfig
|
---@class HeimdallInviterConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field listeningChannel string
|
---@field listeningChannel string
|
||||||
---@field keyword string
|
---@field keyword string
|
||||||
---@field allAssist boolean
|
---@field allAssist boolean
|
||||||
@@ -105,43 +107,62 @@ local function init()
|
|||||||
|
|
||||||
---@class HeimdallDuelerConfig
|
---@class HeimdallDuelerConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field declineOther boolean
|
---@field declineOther boolean
|
||||||
|
|
||||||
---@class HeimdallBullyConfig
|
---@class HeimdallBullyConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
|
|
||||||
|
|
||||||
---@class HeimdallAgentTrackerConfig
|
---@class HeimdallAgentTrackerConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field masterChannel string
|
---@field masterChannel string
|
||||||
|
|
||||||
|
|
||||||
---@class HeimdallEmoterConfig
|
---@class HeimdallEmoterConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field masterChannel string
|
---@field masterChannel string
|
||||||
---@field prefix string
|
---@field prefix string
|
||||||
|
|
||||||
---@class HeimdallEchoerConfig
|
---@class HeimdallEchoerConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field masterChannel string
|
---@field masterChannel string
|
||||||
---@field prefix string
|
---@field prefix string
|
||||||
|
|
||||||
---@class HeimdallMacroerConfig
|
---@class HeimdallMacroerConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field priority string[]
|
---@field priority string[]
|
||||||
|
|
||||||
---@class HeimdallCommanderConfig
|
---@class HeimdallCommanderConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field masterChannel string
|
---@field masterChannel string
|
||||||
---@field commander string
|
---@field commander string
|
||||||
---@field commands table<string, boolean>
|
---@field commands table<string, boolean>
|
||||||
|
|
||||||
---@class HeimdallStinkyTrackerConfig
|
---@class HeimdallStinkyTrackerConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field masterChannel string
|
---@field masterChannel string
|
||||||
|
|
||||||
---@class HeimdallCombatAlerterConfig
|
---@class HeimdallCombatAlerterConfig
|
||||||
---@field enabled boolean
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
---@field masterChannel string
|
---@field masterChannel string
|
||||||
|
|
||||||
|
---@class HeimdallSnifferConfig
|
||||||
|
---@field enabled boolean
|
||||||
|
---@field debug boolean
|
||||||
|
---@field notifyChannel string
|
||||||
|
---@field throttle number
|
||||||
|
---@field zoneOverride string?
|
||||||
|
---@field stinky boolean
|
||||||
|
|
||||||
--- Data ---
|
--- Data ---
|
||||||
---@class HeimdallMessengerData
|
---@class HeimdallMessengerData
|
||||||
---@field queue table<string, Message>
|
---@field queue table<string, Message>
|
||||||
@@ -186,6 +207,7 @@ local function init()
|
|||||||
Heimdall_Data.config = {
|
Heimdall_Data.config = {
|
||||||
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),
|
||||||
everyone = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "everyone" }, false),
|
everyone = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "everyone" }, false),
|
||||||
hostile = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "hostile" }, true),
|
hostile = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "hostile" }, true),
|
||||||
alliance = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "alliance" }, true),
|
alliance = shared.GetOrDefault(Heimdall_Data, { "config", "spotter", "alliance" }, true),
|
||||||
@@ -196,6 +218,7 @@ local function init()
|
|||||||
},
|
},
|
||||||
who = {
|
who = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "who", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "who", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "who", "debug" }, false),
|
||||||
ignored = shared.GetOrDefault(Heimdall_Data, { "config", "who", "ignored" }, {}),
|
ignored = shared.GetOrDefault(Heimdall_Data, { "config", "who", "ignored" }, {}),
|
||||||
notifyChannel = shared.GetOrDefault(Heimdall_Data, { "config", "who", "notifyChannel" }, "Agent"),
|
notifyChannel = shared.GetOrDefault(Heimdall_Data, { "config", "who", "notifyChannel" }, "Agent"),
|
||||||
ttl = shared.GetOrDefault(Heimdall_Data, { "config", "who", "ttl" }, 20),
|
ttl = shared.GetOrDefault(Heimdall_Data, { "config", "who", "ttl" }, 20),
|
||||||
@@ -211,10 +234,12 @@ local function init()
|
|||||||
},
|
},
|
||||||
messenger = {
|
messenger = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "messenger", "enabled" }, true),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "messenger", "enabled" }, true),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "messenger", "debug" }, false),
|
||||||
interval = shared.GetOrDefault(Heimdall_Data, { "config", "messenger", "interval" }, 0.2),
|
interval = shared.GetOrDefault(Heimdall_Data, { "config", "messenger", "interval" }, 0.2),
|
||||||
},
|
},
|
||||||
deathReporter = {
|
deathReporter = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "debug" }, false),
|
||||||
throttle = shared.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "throttle" }, 10),
|
throttle = shared.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "throttle" }, 10),
|
||||||
doWhisper = shared.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "doWhisper" }, true),
|
doWhisper = shared.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "doWhisper" }, true),
|
||||||
notifyChannel = shared.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "notifyChannel" }, "Agent"),
|
notifyChannel = shared.GetOrDefault(Heimdall_Data, { "config", "deathReporter", "notifyChannel" }, "Agent"),
|
||||||
@@ -225,6 +250,7 @@ local function init()
|
|||||||
stinkies = shared.GetOrDefault(Heimdall_Data, { "config", "stinkies" }, {}),
|
stinkies = shared.GetOrDefault(Heimdall_Data, { "config", "stinkies" }, {}),
|
||||||
inviter = {
|
inviter = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "debug" }, false),
|
||||||
listeningChannel = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "listeningChannel" }, "Agent"),
|
listeningChannel = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "listeningChannel" }, "Agent"),
|
||||||
keyword = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "keyword" }, "+"),
|
keyword = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "keyword" }, "+"),
|
||||||
allAssist = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "allAssist" }, false),
|
allAssist = shared.GetOrDefault(Heimdall_Data, { "config", "inviter", "allAssist" }, false),
|
||||||
@@ -236,44 +262,67 @@ local function init()
|
|||||||
},
|
},
|
||||||
dueler = {
|
dueler = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "dueler", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "dueler", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "dueler", "debug" }, false),
|
||||||
declineOther = shared.GetOrDefault(Heimdall_Data, { "config", "dueler", "declineOther" }, false),
|
declineOther = shared.GetOrDefault(Heimdall_Data, { "config", "dueler", "declineOther" }, false),
|
||||||
},
|
},
|
||||||
bully = {
|
bully = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "bully", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "bully", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "bully", "debug" }, false) ,
|
||||||
},
|
},
|
||||||
agentTracker = {
|
agentTracker = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "agentTracker", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "agentTracker", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "agentTracker", "debug" }, false),
|
||||||
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "agentTracker", "masterChannel" }, "Agent"),
|
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "agentTracker", "masterChannel" }, "Agent"),
|
||||||
},
|
},
|
||||||
emoter = {
|
emoter = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "emoter", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "emoter", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "emoter", "debug" }, false),
|
||||||
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "emoter", "masterChannel" }, "Agent"),
|
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "emoter", "masterChannel" }, "Agent"),
|
||||||
prefix = shared.GetOrDefault(Heimdall_Data, { "config", "emoter", "prefix" }, ""),
|
prefix = shared.GetOrDefault(Heimdall_Data, { "config", "emoter", "prefix" }, ""),
|
||||||
},
|
},
|
||||||
echoer = {
|
echoer = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "echoer", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "echoer", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "echoer", "debug" }, false),
|
||||||
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "echoer", "masterChannel" }, "Agent"),
|
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "echoer", "masterChannel" }, "Agent"),
|
||||||
prefix = shared.GetOrDefault(Heimdall_Data, { "config", "echoer", "prefix" }, ""),
|
prefix = shared.GetOrDefault(Heimdall_Data, { "config", "echoer", "prefix" }, ""),
|
||||||
},
|
},
|
||||||
macroer = {
|
macroer = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "macroer", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "macroer", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "macroer", "debug" }, false),
|
||||||
priority = shared.GetOrDefault(Heimdall_Data, { "config", "macroer", "priority" }, {}),
|
priority = shared.GetOrDefault(Heimdall_Data, { "config", "macroer", "priority" }, {}),
|
||||||
},
|
},
|
||||||
agents = shared.GetOrDefault(Heimdall_Data, { "config", "agents" }, {}),
|
agents = shared.GetOrDefault(Heimdall_Data, { "config", "agents" }, {}),
|
||||||
commander = {
|
commander = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "commander", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "commander", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "commander", "debug" }, false),
|
||||||
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "commander", "masterChannel" }, "Agent"),
|
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "commander", "masterChannel" }, "Agent"),
|
||||||
commander = shared.GetOrDefault(Heimdall_Data, { "config", "commander", "commander" }, "Heimdállr"),
|
commander = shared.GetOrDefault(Heimdall_Data, { "config", "commander", "commander" }, "Heimdállr"),
|
||||||
commands = shared.GetOrDefault(Heimdall_Data, { "config", "commander", "commands" }, {}),
|
commands = shared.GetOrDefault(Heimdall_Data, { "config", "commander", "commands" }, {}),
|
||||||
},
|
},
|
||||||
stinkyTracker = {
|
stinkyTracker = {
|
||||||
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),
|
||||||
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "masterChannel" }, "Agent"),
|
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "stinkyTracker", "masterChannel" }, "Agent"),
|
||||||
},
|
},
|
||||||
combatAlerter = {
|
combatAlerter = {
|
||||||
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "combatAlerter", "enabled" }, false),
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "combatAlerter", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "combatAlerter", "debug" }, false),
|
||||||
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "combatAlerter", "masterChannel" }, "Agent"),
|
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "combatAlerter", "masterChannel" }, "Agent"),
|
||||||
},
|
},
|
||||||
|
messageDelegator = {
|
||||||
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "messageDelegator", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "messageDelegator", "debug" }, false),
|
||||||
|
delegates = shared.GetOrDefault(Heimdall_Data, { "config", "messageDelegator", "delegates" }, {}),
|
||||||
|
masterChannel = shared.GetOrDefault(Heimdall_Data, { "config", "messageDelegator", "masterChannel" }, "Agent"),
|
||||||
|
},
|
||||||
|
sniffer = {
|
||||||
|
enabled = shared.GetOrDefault(Heimdall_Data, { "config", "sniffer", "enabled" }, false),
|
||||||
|
debug = shared.GetOrDefault(Heimdall_Data, { "config", "sniffer", "debug" }, false),
|
||||||
|
notifyChannel = shared.GetOrDefault(Heimdall_Data, { "config", "sniffer", "notifyChannel" }, "Agent"),
|
||||||
|
throttle = shared.GetOrDefault(Heimdall_Data, { "config", "sniffer", "throttle" }, 10),
|
||||||
|
zoneOverride = shared.GetOrDefault(Heimdall_Data, { "config", "sniffer", "zoneOverride" }, nil),
|
||||||
|
stinky = shared.GetOrDefault(Heimdall_Data, { "config", "sniffer", "stinky" }, true),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
shared.raceMap = {
|
shared.raceMap = {
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "AgentTracker"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.AgentTracker = {}
|
shared.AgentTracker = {}
|
||||||
@@ -9,29 +10,78 @@ function shared.AgentTracker.Init()
|
|||||||
local channelRosterFrame = CreateFrame("Frame")
|
local channelRosterFrame = CreateFrame("Frame")
|
||||||
channelRosterFrame:RegisterEvent("CHANNEL_ROSTER_UPDATE")
|
channelRosterFrame:RegisterEvent("CHANNEL_ROSTER_UPDATE")
|
||||||
channelRosterFrame:SetScript("OnEvent", function(self, event, index)
|
channelRosterFrame:SetScript("OnEvent", function(self, event, index)
|
||||||
if not Heimdall_Data.config.agentTracker.enabled then return end
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
|
print(string.format("%s: Received event: %s", ModuleName, event))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.agentTracker)
|
||||||
|
end
|
||||||
|
if not Heimdall_Data.config.agentTracker.enabled then
|
||||||
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
|
print(string.format("%s: AgentTracker disabled", ModuleName))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
local name = GetChannelDisplayInfo(index)
|
local name = GetChannelDisplayInfo(index)
|
||||||
if name ~= Heimdall_Data.config.agentTracker.masterChannel then return end
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
|
print(string.format("%s: Processing channel: %s", ModuleName, name))
|
||||||
|
end
|
||||||
|
if name ~= Heimdall_Data.config.agentTracker.masterChannel then
|
||||||
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
|
print(string.format("%s: Channel is not master channel: %s", ModuleName, name))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
local count = select(5, GetChannelDisplayInfo(index))
|
local count = select(5, GetChannelDisplayInfo(index))
|
||||||
for i = 1, count do
|
for i = 1, count do
|
||||||
local name = GetChannelRosterInfo(index, i)
|
local name = GetChannelRosterInfo(index, i)
|
||||||
if name then
|
if name then
|
||||||
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
|
print(string.format("%s: Tracking agent in channel: %s", ModuleName, name))
|
||||||
|
end
|
||||||
Heimdall_Data.config.agents[name] = date("%Y-%m-%dT%H:%M:%S")
|
Heimdall_Data.config.agents[name] = date("%Y-%m-%dT%H:%M:%S")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
--shared.dumpTable(Heimdall_Data.config.agents)
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local agentTrackerChannelSniffer = CreateFrame("Frame")
|
local agentTrackerChannelSniffer = CreateFrame("Frame")
|
||||||
agentTrackerChannelSniffer:RegisterEvent("CHAT_MSG_CHANNEL")
|
agentTrackerChannelSniffer:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||||
agentTrackerChannelSniffer:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
agentTrackerChannelSniffer:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||||
if not Heimdall_Data.config.agentTracker.enabled then return end
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
|
print(string.format("%s: Received event: %s", ModuleName, event))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.agentTracker)
|
||||||
|
end
|
||||||
|
if not Heimdall_Data.config.agentTracker.enabled then
|
||||||
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
|
print(string.format("%s: AgentTracker disabled", ModuleName))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
local channelId = select(6, ...)
|
local channelId = select(6, ...)
|
||||||
local channelname = GetChannelName(channelId)
|
local channelname = GetChannelName(channelId)
|
||||||
if not channelname then return end
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
if channelname ~= Heimdall_Data.config.who.notifyChannel then return end
|
print(string.format("%s: Processing message from: %s", ModuleName, sender))
|
||||||
|
end
|
||||||
|
if not channelname then
|
||||||
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
|
print(string.format("%s: No channel name found", ModuleName))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
if channelname ~= Heimdall_Data.config.who.notifyChannel then
|
||||||
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
|
print(string.format("%s: Message not in notify channel: %s", ModuleName, channelname))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
local agentName = sender
|
local agentName = sender
|
||||||
if not agentName then return end
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
|
print(string.format("%s: Tracking agent from message: %s", ModuleName, agentName))
|
||||||
|
end
|
||||||
|
if not agentName then
|
||||||
|
if Heimdall_Data.config.agentTracker.debug then
|
||||||
|
print(string.format("%s: No agent name found", ModuleName))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
Heimdall_Data.config.agents[agentName] = date("%Y-%m-%dT%H:%M:%S")
|
Heimdall_Data.config.agents[agentName] = date("%Y-%m-%dT%H:%M:%S")
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "CombatAlerter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.CombatAlerter = {}
|
shared.CombatAlerter = {}
|
||||||
@@ -9,17 +10,33 @@ function shared.CombatAlerter.Init()
|
|||||||
local combatAlerterFrame = CreateFrame("Frame")
|
local combatAlerterFrame = CreateFrame("Frame")
|
||||||
combatAlerterFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
combatAlerterFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||||
combatAlerterFrame:SetScript("OnEvent", function(self, event, ...)
|
combatAlerterFrame:SetScript("OnEvent", function(self, event, ...)
|
||||||
|
if Heimdall_Data.config.combatAlerter.debug then
|
||||||
|
print(string.format("%s: Received event: %s", ModuleName, event))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.combatAlerter)
|
||||||
|
end
|
||||||
if not Heimdall_Data.config.combatAlerter.enabled then return end
|
if not Heimdall_Data.config.combatAlerter.enabled then return end
|
||||||
local destination, err = CLEUParser.GetDestName(...)
|
local destination, err = CLEUParser.GetDestName(...)
|
||||||
if err then return end
|
if err then return end
|
||||||
|
if Heimdall_Data.config.combatAlerter.debug then
|
||||||
|
print(string.format("%s: Destination: %s", ModuleName, destination))
|
||||||
|
end
|
||||||
if destination ~= UnitName("player") then return end
|
if destination ~= UnitName("player") then return end
|
||||||
local source, err = CLEUParser.GetSourceName(...)
|
local source, err = CLEUParser.GetSourceName(...)
|
||||||
|
if Heimdall_Data.config.combatAlerter.debug then
|
||||||
|
print(string.format("%s: Source: %s", ModuleName, source))
|
||||||
|
end
|
||||||
if err then source = "unknown" end
|
if err then source = "unknown" end
|
||||||
|
|
||||||
if shared.stinkyTracker.stinkies and shared.stinkyTracker.stinkies[source] then
|
if shared.stinkyTracker.stinkies and shared.stinkyTracker.stinkies[source] then
|
||||||
|
if Heimdall_Data.config.combatAlerter.debug then
|
||||||
|
print(string.format("%s: Alerted status for %s: %s", ModuleName, source, alerted[source]))
|
||||||
|
end
|
||||||
if alerted[source] then return end
|
if alerted[source] then return end
|
||||||
alerted[source] = true
|
alerted[source] = true
|
||||||
local x, y = GetPlayerMapPosition("player")
|
local x, y = GetPlayerMapPosition("player")
|
||||||
|
if Heimdall_Data.config.combatAlerter.debug then
|
||||||
|
print(string.format("%s: Player position: %2.2f,%2.2f", ModuleName, x, y))
|
||||||
|
end
|
||||||
---@type Message
|
---@type Message
|
||||||
local msg = {
|
local msg = {
|
||||||
channel = "CHANNEL",
|
channel = "CHANNEL",
|
||||||
@@ -30,6 +47,10 @@ function shared.CombatAlerter.Init()
|
|||||||
x * 100, y * 100
|
x * 100, y * 100
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
if Heimdall_Data.config.combatAlerter.debug then
|
||||||
|
print(string.format("%s: Message:", ModuleName))
|
||||||
|
shared.dumpTable(msg)
|
||||||
|
end
|
||||||
table.insert(shared.messenger.queue, msg)
|
table.insert(shared.messenger.queue, msg)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
@@ -37,11 +58,11 @@ function shared.CombatAlerter.Init()
|
|||||||
local combatTriggerFrame = CreateFrame("Frame")
|
local combatTriggerFrame = CreateFrame("Frame")
|
||||||
combatTriggerFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
|
combatTriggerFrame:RegisterEvent("PLAYER_REGEN_DISABLED")
|
||||||
combatTriggerFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
|
combatTriggerFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||||
-- We want to only alert once per target per combat encounter
|
|
||||||
-- Even a small throttle would probably spam too much here
|
|
||||||
-- ....but maybe we can call it a 120 second throttle or something?
|
|
||||||
-- We will see
|
|
||||||
combatTriggerFrame:SetScript("OnEvent", function(self, event, ...)
|
combatTriggerFrame:SetScript("OnEvent", function(self, event, ...)
|
||||||
|
if Heimdall_Data.config.combatAlerter.debug then
|
||||||
|
print(string.format("%s: Received event: %s", ModuleName, event))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.combatAlerter)
|
||||||
|
end
|
||||||
alerted = {}
|
alerted = {}
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "Commander"
|
||||||
|
|
||||||
local helpMessages = {
|
local helpMessages = {
|
||||||
ru = {
|
ru = {
|
||||||
@@ -86,6 +87,9 @@ function shared.Commander.Init()
|
|||||||
player.stinky and "(!!!!)" or "")
|
player.stinky and "(!!!!)" or "")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if Heimdall_Data.config.commander.debug then
|
||||||
|
print(string.format("%s: ret = %s", ModuleName, strjoin(", ", unpack(ret))))
|
||||||
|
end
|
||||||
return ret
|
return ret
|
||||||
end
|
end
|
||||||
---@param arr table<string, Player>
|
---@param arr table<string, Player>
|
||||||
@@ -111,6 +115,9 @@ function shared.Commander.Init()
|
|||||||
for class, count in pairs(ret) do
|
for class, count in pairs(ret) do
|
||||||
text[#text + 1] = string.format("%s: %d", class, count)
|
text[#text + 1] = string.format("%s: %d", class, count)
|
||||||
end
|
end
|
||||||
|
if Heimdall_Data.config.commander.debug then
|
||||||
|
print(string.format("%s: ret = %s", ModuleName, strjoin(", ", unpack(text))))
|
||||||
|
end
|
||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
---@param arr table<string, Player>
|
---@param arr table<string, Player>
|
||||||
@@ -124,6 +131,7 @@ function shared.Commander.Init()
|
|||||||
return text
|
return text
|
||||||
end
|
end
|
||||||
local function CountClassPartitionedStinkies()
|
local function CountClassPartitionedStinkies()
|
||||||
|
if Heimdall_Data.config.commander.debug then print(string.format("%s: CountClassPartitionedStinkies", ModuleName)) end
|
||||||
local res = CountClassPartitioned(HeimdallStinkies)
|
local res = CountClassPartitioned(HeimdallStinkies)
|
||||||
if #res == 0 then
|
if #res == 0 then
|
||||||
return { "No stinkies found" }
|
return { "No stinkies found" }
|
||||||
@@ -131,6 +139,7 @@ function shared.Commander.Init()
|
|||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
local function WhoPartitionedStinkies()
|
local function WhoPartitionedStinkies()
|
||||||
|
if Heimdall_Data.config.commander.debug then print(string.format("%s: WhoPartitionedStinkies", ModuleName)) end
|
||||||
local res = WhoPartitioned(HeimdallStinkies)
|
local res = WhoPartitioned(HeimdallStinkies)
|
||||||
if #res == 0 then
|
if #res == 0 then
|
||||||
return { "No stinkies found" }
|
return { "No stinkies found" }
|
||||||
@@ -138,23 +147,33 @@ function shared.Commander.Init()
|
|||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
local function CountPartitionedStinkies()
|
local function CountPartitionedStinkies()
|
||||||
|
if Heimdall_Data.config.commander.debug then print(string.format("%s: CountPartitionedStinkies", ModuleName)) end
|
||||||
local res = CountPartitioned(HeimdallStinkies)
|
local res = CountPartitioned(HeimdallStinkies)
|
||||||
if #res == 0 then
|
if #res == 0 then
|
||||||
return { "No stinkies found" }
|
return { "No stinkies found" }
|
||||||
end
|
end
|
||||||
return res
|
return res
|
||||||
end
|
end
|
||||||
local function HelpRu() return helpMessages.ru end
|
local function HelpRu()
|
||||||
local function HelpEn() return helpMessages.en end
|
if Heimdall_Data.config.commander.debug then print(string.format("%s: HelpRu", ModuleName)) end
|
||||||
|
return helpMessages.ru
|
||||||
|
end
|
||||||
|
local function HelpEn()
|
||||||
|
if Heimdall_Data.config.commander.debug then print(string.format("%s: HelpEn", ModuleName)) end
|
||||||
|
return helpMessages.en
|
||||||
|
end
|
||||||
local groupInviteFrame = CreateFrame("Frame")
|
local groupInviteFrame = CreateFrame("Frame")
|
||||||
groupInviteFrame:SetScript("OnEvent", function(self, event, ...)
|
groupInviteFrame:SetScript("OnEvent", function(self, event, ...)
|
||||||
|
if Heimdall_Data.config.commander.debug then print(string.format("%s: OnEvent", ModuleName)) end
|
||||||
AcceptGroup()
|
AcceptGroup()
|
||||||
groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST")
|
groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST")
|
||||||
C_Timer.NewTimer(0.1, function()
|
C_Timer.NewTimer(0.1, function()
|
||||||
|
if Heimdall_Data.config.commander.debug then print(string.format("%s: Click", ModuleName)) end
|
||||||
_G["StaticPopup1Button1"]:Click()
|
_G["StaticPopup1Button1"]:Click()
|
||||||
end, 1)
|
end, 1)
|
||||||
end)
|
end)
|
||||||
local function JoinGroup()
|
local function JoinGroup()
|
||||||
|
if Heimdall_Data.config.commander.debug then print(string.format("%s: JoinGroup", ModuleName)) end
|
||||||
groupInviteFrame:RegisterEvent("PARTY_INVITE_REQUEST")
|
groupInviteFrame:RegisterEvent("PARTY_INVITE_REQUEST")
|
||||||
C_Timer.NewTimer(10, function()
|
C_Timer.NewTimer(10, function()
|
||||||
groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST")
|
groupInviteFrame:UnregisterEvent("PARTY_INVITE_REQUEST")
|
||||||
@@ -162,11 +181,13 @@ function shared.Commander.Init()
|
|||||||
return { "+" }
|
return { "+" }
|
||||||
end
|
end
|
||||||
local function LeaveGroup()
|
local function LeaveGroup()
|
||||||
|
if Heimdall_Data.config.commander.debug then print(string.format("%s: LeaveGroup", ModuleName)) end
|
||||||
LeaveParty()
|
LeaveParty()
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
---@param target string
|
---@param target string
|
||||||
local function FollowTarget(target)
|
local function FollowTarget(target)
|
||||||
|
if Heimdall_Data.config.commander.debug then print(string.format("%s: FollowTarget: %s", ModuleName, target)) end
|
||||||
if not target then return end
|
if not target then return end
|
||||||
FollowUnit(target)
|
FollowUnit(target)
|
||||||
return {}
|
return {}
|
||||||
@@ -191,20 +212,36 @@ function shared.Commander.Init()
|
|||||||
local commanderChannelFrame = CreateFrame("Frame")
|
local commanderChannelFrame = CreateFrame("Frame")
|
||||||
commanderChannelFrame:RegisterEvent("CHAT_MSG_CHANNEL")
|
commanderChannelFrame:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||||
commanderChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
commanderChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||||
|
if Heimdall_Data.config.commander.debug then
|
||||||
|
print(string.format("%s: OnEvent", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.commander)
|
||||||
|
end
|
||||||
if not Heimdall_Data.config.commander.enabled then return end
|
if not Heimdall_Data.config.commander.enabled then return end
|
||||||
local channelId = select(6, ...)
|
local channelId = select(6, ...)
|
||||||
local _, channelname = GetChannelName(channelId)
|
local _, channelname = GetChannelName(channelId)
|
||||||
|
if Heimdall_Data.config.commander.debug then
|
||||||
|
print(string.format("%s: channelname = %s", ModuleName, channelname))
|
||||||
|
end
|
||||||
if channelname ~= Heimdall_Data.config.commander.masterChannel then return end
|
if channelname ~= Heimdall_Data.config.commander.masterChannel then return end
|
||||||
sender = string.match(sender, "^[^-]+")
|
sender = string.match(sender, "^[^-]+")
|
||||||
|
if Heimdall_Data.config.commander.debug then
|
||||||
|
print(string.format("%s: sender = %s", ModuleName, sender))
|
||||||
|
end
|
||||||
|
|
||||||
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
|
||||||
|
print(string.format("%s: command.keywordRe = %s: %s", ModuleName, command.keywordRe, tostring(enabled)))
|
||||||
|
end
|
||||||
if enabled and
|
if enabled and
|
||||||
(not command.commanderOnly
|
(not command.commanderOnly
|
||||||
or (command.commanderOnly
|
or (command.commanderOnly
|
||||||
and sender == Heimdall_Data.config.commander.commander)) then
|
and sender == Heimdall_Data.config.commander.commander)) then
|
||||||
if msg:match(command.keywordRe) then
|
if msg:match(command.keywordRe) then
|
||||||
local messages = command.callback({ strsplit(" ", msg) })
|
local messages = command.callback({ strsplit(" ", msg) })
|
||||||
|
if Heimdall_Data.config.commander.debug then
|
||||||
|
print(string.format("%s: messages = %s", ModuleName, strjoin(", ", unpack(messages))))
|
||||||
|
end
|
||||||
for _, message in ipairs(messages) do
|
for _, message in ipairs(messages) do
|
||||||
---@type Message
|
---@type Message
|
||||||
local msg = {
|
local msg = {
|
||||||
|
@@ -521,7 +521,14 @@ function shared.Config.Init()
|
|||||||
configFrame:Add(spotterConfigFrame, 5, 3)
|
configFrame:Add(spotterConfigFrame, 5, 3)
|
||||||
|
|
||||||
local title = CreateFancyText("HeimdallSpotterConfigTitle", spotterConfigFrame.frame, "Spotter", { r, g, b, a })
|
local title = CreateFancyText("HeimdallSpotterConfigTitle", spotterConfigFrame.frame, "Spotter", { r, g, b, a })
|
||||||
spotterConfigFrame:Add(title, 1, 12)
|
spotterConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallSpotterConfigDebugButton",
|
||||||
|
spotterConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.spotter.debug = not Heimdall_Data.config.spotter.debug
|
||||||
|
return Heimdall_Data.config.spotter.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.spotter.debug)
|
||||||
|
spotterConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallSpotterConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallSpotterConfigEnableButton",
|
||||||
spotterConfigFrame.frame, "Enabled", function()
|
spotterConfigFrame.frame, "Enabled", function()
|
||||||
@@ -617,7 +624,14 @@ function shared.Config.Init()
|
|||||||
configFrame:Add(whoerConfigFrame, 9, 3)
|
configFrame:Add(whoerConfigFrame, 9, 3)
|
||||||
|
|
||||||
local title = CreateFancyText("HeimdallWhoerConfigTitle", whoerConfigFrame.frame, "Whoer", { r, g, b, a })
|
local title = CreateFancyText("HeimdallWhoerConfigTitle", whoerConfigFrame.frame, "Whoer", { r, g, b, a })
|
||||||
whoerConfigFrame:Add(title, 1, 12)
|
whoerConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallWhoerConfigDebugButton",
|
||||||
|
whoerConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.who.debug = not Heimdall_Data.config.who.debug
|
||||||
|
return Heimdall_Data.config.who.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.who.debug)
|
||||||
|
whoerConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallWhoerConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallWhoerConfigEnableButton",
|
||||||
whoerConfigFrame.frame, "Enabled", function()
|
whoerConfigFrame.frame, "Enabled", function()
|
||||||
@@ -694,7 +708,14 @@ function shared.Config.Init()
|
|||||||
|
|
||||||
local title = CreateFancyText("HeimdallMessengerConfigTitle", messengerConfigFrame.frame, "Messenger",
|
local title = CreateFancyText("HeimdallMessengerConfigTitle", messengerConfigFrame.frame, "Messenger",
|
||||||
{ r, g, b, a })
|
{ r, g, b, a })
|
||||||
messengerConfigFrame:Add(title, 1, 12)
|
messengerConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallMessengerConfigDebugButton",
|
||||||
|
messengerConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.messenger.debug = not Heimdall_Data.config.messenger.debug
|
||||||
|
return Heimdall_Data.config.messenger.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.messenger.debug)
|
||||||
|
messengerConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallMessengerConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallMessengerConfigEnableButton",
|
||||||
messengerConfigFrame.frame, "Enabled", function()
|
messengerConfigFrame.frame, "Enabled", function()
|
||||||
@@ -731,7 +752,14 @@ function shared.Config.Init()
|
|||||||
local title = CreateFancyText("HeimdallDeathReporterConfigTitle", deathReporterConfigFrame.frame,
|
local title = CreateFancyText("HeimdallDeathReporterConfigTitle", deathReporterConfigFrame.frame,
|
||||||
"Death Reporter",
|
"Death Reporter",
|
||||||
{ r, g, b, a })
|
{ r, g, b, a })
|
||||||
deathReporterConfigFrame:Add(title, 1, 12)
|
deathReporterConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallDeathReporterConfigDebugButton",
|
||||||
|
deathReporterConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.deathReporter.debug = not Heimdall_Data.config.deathReporter.debug
|
||||||
|
return Heimdall_Data.config.deathReporter.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.deathReporter.debug)
|
||||||
|
deathReporterConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallDeathReporterConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallDeathReporterConfigEnableButton",
|
||||||
deathReporterConfigFrame.frame, "Enabled", function()
|
deathReporterConfigFrame.frame, "Enabled", function()
|
||||||
@@ -819,7 +847,14 @@ function shared.Config.Init()
|
|||||||
configFrame:Add(inviterConfigFrame, 7, 3)
|
configFrame:Add(inviterConfigFrame, 7, 3)
|
||||||
|
|
||||||
local title = CreateFancyText("HeimdallInviterConfigTitle", inviterConfigFrame.frame, "Inviter", { r, g, b, a })
|
local title = CreateFancyText("HeimdallInviterConfigTitle", inviterConfigFrame.frame, "Inviter", { r, g, b, a })
|
||||||
inviterConfigFrame:Add(title, 1, 12)
|
inviterConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallInviterConfigDebugButton",
|
||||||
|
inviterConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.inviter.debug = not Heimdall_Data.config.inviter.debug
|
||||||
|
return Heimdall_Data.config.inviter.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.inviter.debug)
|
||||||
|
inviterConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallInviterConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallInviterConfigEnableButton",
|
||||||
inviterConfigFrame.frame, "Enabled", function()
|
inviterConfigFrame.frame, "Enabled", function()
|
||||||
@@ -935,7 +970,14 @@ function shared.Config.Init()
|
|||||||
configFrame:Add(duelerConfigFrame, 2, 3)
|
configFrame:Add(duelerConfigFrame, 2, 3)
|
||||||
|
|
||||||
local title = CreateFancyText("HeimdallDuelerConfigTitle", duelerConfigFrame.frame, "Dueler", { r, g, b, a })
|
local title = CreateFancyText("HeimdallDuelerConfigTitle", duelerConfigFrame.frame, "Dueler", { r, g, b, a })
|
||||||
duelerConfigFrame:Add(title, 1, 12)
|
duelerConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallDuelerConfigDebugButton",
|
||||||
|
duelerConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.dueler.debug = not Heimdall_Data.config.dueler.debug
|
||||||
|
return Heimdall_Data.config.dueler.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.dueler.debug)
|
||||||
|
duelerConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallInviterConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallInviterConfigEnableButton",
|
||||||
duelerConfigFrame.frame, "Enabled", function()
|
duelerConfigFrame.frame, "Enabled", function()
|
||||||
@@ -964,7 +1006,15 @@ function shared.Config.Init()
|
|||||||
|
|
||||||
local title = CreateFancyText("HeimdallAgentTrackerConfigTitle", agentTrackerConfigFrame.frame, "Agent Tracker",
|
local title = CreateFancyText("HeimdallAgentTrackerConfigTitle", agentTrackerConfigFrame.frame, "Agent Tracker",
|
||||||
{ r, g, b, a })
|
{ r, g, b, a })
|
||||||
agentTrackerConfigFrame:Add(title, 1, 12)
|
agentTrackerConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallAgentTrackerConfigDebugButton",
|
||||||
|
agentTrackerConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.agentTracker.debug = not Heimdall_Data.config.agentTracker.debug
|
||||||
|
return Heimdall_Data.config.agentTracker.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.agentTracker.debug)
|
||||||
|
agentTrackerConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallAgentTrackerConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallAgentTrackerConfigEnableButton",
|
||||||
agentTrackerConfigFrame.frame, "Enabled", function()
|
agentTrackerConfigFrame.frame, "Enabled", function()
|
||||||
@@ -1001,7 +1051,14 @@ function shared.Config.Init()
|
|||||||
local title = CreateFancyText("HeimdallStinkyTrackerConfigTitle", stinkyTrackerConfigFrame.frame,
|
local title = CreateFancyText("HeimdallStinkyTrackerConfigTitle", stinkyTrackerConfigFrame.frame,
|
||||||
"Stinky Tracker",
|
"Stinky Tracker",
|
||||||
{ r, g, b, a })
|
{ r, g, b, a })
|
||||||
stinkyTrackerConfigFrame:Add(title, 1, 12)
|
stinkyTrackerConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallStinkyTrackerConfigDebugButton",
|
||||||
|
stinkyTrackerConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.stinkyTracker.debug = not Heimdall_Data.config.stinkyTracker.debug
|
||||||
|
return Heimdall_Data.config.stinkyTracker.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.stinkyTracker.debug)
|
||||||
|
stinkyTrackerConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallStinkyTrackerConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallStinkyTrackerConfigEnableButton",
|
||||||
stinkyTrackerConfigFrame.frame, "Enabled", function()
|
stinkyTrackerConfigFrame.frame, "Enabled", function()
|
||||||
@@ -1037,7 +1094,14 @@ function shared.Config.Init()
|
|||||||
|
|
||||||
local title = CreateFancyText("HeimdallEmoterConfigTitle", emoterConfigFrame.frame, "Emoter",
|
local title = CreateFancyText("HeimdallEmoterConfigTitle", emoterConfigFrame.frame, "Emoter",
|
||||||
{ r, g, b, a })
|
{ r, g, b, a })
|
||||||
emoterConfigFrame:Add(title, 1, 12)
|
emoterConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallEmoterConfigDebugButton",
|
||||||
|
emoterConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.emoter.debug = not Heimdall_Data.config.emoter.debug
|
||||||
|
return Heimdall_Data.config.emoter.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.emoter.debug)
|
||||||
|
emoterConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallEmoterConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallEmoterConfigEnableButton",
|
||||||
emoterConfigFrame.frame, "Enabled", function()
|
emoterConfigFrame.frame, "Enabled", function()
|
||||||
@@ -1088,7 +1152,14 @@ function shared.Config.Init()
|
|||||||
|
|
||||||
local title = CreateFancyText("HeimdallEchoerConfigTitle", echoerConfigFrame.frame, "Echoer",
|
local title = CreateFancyText("HeimdallEchoerConfigTitle", echoerConfigFrame.frame, "Echoer",
|
||||||
{ r, g, b, a })
|
{ r, g, b, a })
|
||||||
echoerConfigFrame:Add(title, 1, 12)
|
echoerConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallEchoerConfigDebugButton",
|
||||||
|
echoerConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.echoer.debug = not Heimdall_Data.config.echoer.debug
|
||||||
|
return Heimdall_Data.config.echoer.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.echoer.debug)
|
||||||
|
echoerConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallEmoterConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallEmoterConfigEnableButton",
|
||||||
echoerConfigFrame.frame, "Enabled", function()
|
echoerConfigFrame.frame, "Enabled", function()
|
||||||
@@ -1139,7 +1210,14 @@ function shared.Config.Init()
|
|||||||
|
|
||||||
local title = CreateFancyText("HeimdallCommanderConfigTitle", commanderConfigFrame.frame, "Commander",
|
local title = CreateFancyText("HeimdallCommanderConfigTitle", commanderConfigFrame.frame, "Commander",
|
||||||
{ r, g, b, a })
|
{ r, g, b, a })
|
||||||
commanderConfigFrame:Add(title, 1, 12)
|
commanderConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallCommanderConfigDebugButton",
|
||||||
|
commanderConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.commander.debug = not Heimdall_Data.config.commander.debug
|
||||||
|
return Heimdall_Data.config.commander.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.commander.debug)
|
||||||
|
commanderConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallCommanderConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallCommanderConfigEnableButton",
|
||||||
commanderConfigFrame.frame, "Enabled", function()
|
commanderConfigFrame.frame, "Enabled", function()
|
||||||
@@ -1199,7 +1277,14 @@ function shared.Config.Init()
|
|||||||
|
|
||||||
local title = CreateFancyText("HeimdallMacroerConfigTitle", macroerConfigFrame.frame, "Macroer",
|
local title = CreateFancyText("HeimdallMacroerConfigTitle", macroerConfigFrame.frame, "Macroer",
|
||||||
{ r, g, b, a })
|
{ r, g, b, a })
|
||||||
macroerConfigFrame:Add(title, 1, 12)
|
macroerConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallMacroerConfigDebugButton",
|
||||||
|
macroerConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.macroer.debug = not Heimdall_Data.config.macroer.debug
|
||||||
|
return Heimdall_Data.config.macroer.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.macroer.debug)
|
||||||
|
macroerConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallCommanderConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallCommanderConfigEnableButton",
|
||||||
macroerConfigFrame.frame, "Enabled", function()
|
macroerConfigFrame.frame, "Enabled", function()
|
||||||
@@ -1230,7 +1315,14 @@ function shared.Config.Init()
|
|||||||
local title = CreateFancyText("HeimdallCombatAlerterConfigTitle", combatAlerterConfigFrame.frame,
|
local title = CreateFancyText("HeimdallCombatAlerterConfigTitle", combatAlerterConfigFrame.frame,
|
||||||
"Combat Alerter",
|
"Combat Alerter",
|
||||||
{ r, g, b, a })
|
{ r, g, b, a })
|
||||||
combatAlerterConfigFrame:Add(title, 1, 12)
|
combatAlerterConfigFrame:Add(title, 1, 8)
|
||||||
|
local debugButton = CreateBasicButton("HeimdallCombatAlerterConfigDebugButton",
|
||||||
|
combatAlerterConfigFrame.frame, "Debug", function()
|
||||||
|
Heimdall_Data.config.combatAlerter.debug = not Heimdall_Data.config.combatAlerter.debug
|
||||||
|
return Heimdall_Data.config.combatAlerter.debug
|
||||||
|
end)
|
||||||
|
debugButton:UpdateColor(Heimdall_Data.config.combatAlerter.debug)
|
||||||
|
combatAlerterConfigFrame:Add(debugButton, 1, 4)
|
||||||
|
|
||||||
local enableButton = CreateBasicButton("HeimdallCombatAlerterConfigEnableButton",
|
local enableButton = CreateBasicButton("HeimdallCombatAlerterConfigEnableButton",
|
||||||
combatAlerterConfigFrame.frame, "Enabled", function()
|
combatAlerterConfigFrame.frame, "Enabled", function()
|
||||||
@@ -1304,7 +1396,7 @@ function shared.Config.Init()
|
|||||||
stinkiesConfigFrame:Add(stinkies, 16, 12)
|
stinkiesConfigFrame:Add(stinkies, 16, 12)
|
||||||
end
|
end
|
||||||
|
|
||||||
configFrame.frame:Hide()
|
--configFrame.frame:Hide()
|
||||||
print("Heimdall - Config loaded")
|
print("Heimdall - Config loaded")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "DeathReporter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.DeathReporter = {}
|
shared.DeathReporter = {}
|
||||||
@@ -14,20 +15,31 @@ function shared.DeathReporter.Init()
|
|||||||
---@param destination string
|
---@param destination string
|
||||||
---@param spellName string
|
---@param spellName string
|
||||||
local function RegisterDeath(source, destination, spellName)
|
local function RegisterDeath(source, destination, spellName)
|
||||||
|
if Heimdall_Data.config.deathReporter.debug then
|
||||||
|
print(string.format("%s: RegisterDeath", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.deathReporter)
|
||||||
|
end
|
||||||
if not Heimdall_Data.config.deathReporter.enabled then return end
|
if not Heimdall_Data.config.deathReporter.enabled then return end
|
||||||
if recentDeaths[destination]
|
if recentDeaths[destination]
|
||||||
and GetTime() - recentDeaths[destination] < Heimdall_Data.config.deathReporter.throttle then
|
and GetTime() - recentDeaths[destination] < Heimdall_Data.config.deathReporter.throttle then
|
||||||
|
if Heimdall_Data.config.deathReporter.debug then
|
||||||
|
print(string.format("%s: Throttled death report for %s", ModuleName, destination))
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if recentDuels[destination]
|
if recentDuels[destination]
|
||||||
and GetTime() - recentDuels[destination] < Heimdall_Data.config.deathReporter.duelThrottle then
|
and GetTime() - recentDuels[destination] < Heimdall_Data.config.deathReporter.duelThrottle then
|
||||||
|
if Heimdall_Data.config.deathReporter.debug then
|
||||||
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
|
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if recentDuels[source]
|
if recentDuels[source]
|
||||||
and GetTime() - recentDuels[source] < Heimdall_Data.config.deathReporter.duelThrottle then
|
and GetTime() - recentDuels[source] < Heimdall_Data.config.deathReporter.duelThrottle then
|
||||||
|
if Heimdall_Data.config.deathReporter.debug then
|
||||||
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
|
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -35,12 +47,18 @@ function shared.DeathReporter.Init()
|
|||||||
C_Timer.NewTimer(3, function()
|
C_Timer.NewTimer(3, function()
|
||||||
if recentDuels[destination]
|
if recentDuels[destination]
|
||||||
and GetTime() - recentDuels[destination] < Heimdall_Data.config.deathReporter.duelThrottle then
|
and GetTime() - recentDuels[destination] < Heimdall_Data.config.deathReporter.duelThrottle then
|
||||||
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
|
if Heimdall_Data.config.deathReporter.debug then
|
||||||
|
print(string.format("Cancelling death reports for %s and %s because of recent duel", source,
|
||||||
|
destination))
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if recentDuels[source]
|
if recentDuels[source]
|
||||||
and GetTime() - recentDuels[source] < Heimdall_Data.config.deathReporter.duelThrottle then
|
and GetTime() - recentDuels[source] < Heimdall_Data.config.deathReporter.duelThrottle then
|
||||||
print(string.format("Cancelling death reports for %s and %s because of recent duel", source, destination))
|
if Heimdall_Data.config.deathReporter.debug then
|
||||||
|
print(string.format("Cancelling death reports for %s and %s because of recent duel", source,
|
||||||
|
destination))
|
||||||
|
end
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -48,12 +66,18 @@ function shared.DeathReporter.Init()
|
|||||||
if zone == nil or zone == "" then
|
if zone == nil or zone == "" then
|
||||||
zone = string.format("%s (%s)", GetZoneText(), GetSubZoneText())
|
zone = string.format("%s (%s)", GetZoneText(), GetSubZoneText())
|
||||||
end
|
end
|
||||||
|
if Heimdall_Data.config.deathReporter.debug then
|
||||||
|
print(string.format("%s: zone = %s", ModuleName, zone))
|
||||||
|
end
|
||||||
|
|
||||||
local text = string.format("%s killed %s with %s in %s",
|
local text = string.format("%s killed %s with %s in %s",
|
||||||
tostring(source),
|
tostring(source),
|
||||||
tostring(destination),
|
tostring(destination),
|
||||||
tostring(spellName),
|
tostring(spellName),
|
||||||
tostring(zone))
|
tostring(zone))
|
||||||
|
if Heimdall_Data.config.deathReporter.debug then
|
||||||
|
print(string.format("%s: text = %s", ModuleName, text))
|
||||||
|
end
|
||||||
|
|
||||||
---@type Message
|
---@type Message
|
||||||
local msg = {
|
local msg = {
|
||||||
@@ -61,6 +85,10 @@ function shared.DeathReporter.Init()
|
|||||||
data = Heimdall_Data.config.deathReporter.notifyChannel,
|
data = Heimdall_Data.config.deathReporter.notifyChannel,
|
||||||
message = text,
|
message = text,
|
||||||
}
|
}
|
||||||
|
if Heimdall_Data.config.deathReporter.debug then
|
||||||
|
print(string.format("%s: msg =", ModuleName))
|
||||||
|
shared.dumpTable(msg)
|
||||||
|
end
|
||||||
table.insert(shared.messenger.queue, msg)
|
table.insert(shared.messenger.queue, msg)
|
||||||
|
|
||||||
if Heimdall_Data.config.deathReporter.doWhisper then
|
if Heimdall_Data.config.deathReporter.doWhisper then
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "Dueler"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.Dueler = {}
|
shared.Dueler = {}
|
||||||
@@ -8,14 +9,26 @@ function shared.Dueler.Init()
|
|||||||
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)
|
||||||
|
if Heimdall_Data.config.dueler.debug then
|
||||||
|
print(string.format("%s: OnEvent", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.dueler)
|
||||||
|
end
|
||||||
if not Heimdall_Data.config.dueler.enabled then return end
|
if not Heimdall_Data.config.dueler.enabled then return end
|
||||||
|
if Heimdall_Data.config.dueler.debug then
|
||||||
|
print(string.format("%s: sender = %s", ModuleName, sender))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.agents)
|
||||||
|
end
|
||||||
local allow = Heimdall_Data.config.agents[sender]
|
local allow = Heimdall_Data.config.agents[sender]
|
||||||
if allow then
|
if allow then
|
||||||
print("Heimdall - Dueler - Accepting duel from " .. sender)
|
if Heimdall_Data.config.dueler.debug then
|
||||||
|
print(string.format("%s: Accepting duel from %s", ModuleName, sender))
|
||||||
|
end
|
||||||
AcceptDuel()
|
AcceptDuel()
|
||||||
else
|
else
|
||||||
if Heimdall_Data.config.dueler.autoDecline then
|
if Heimdall_Data.config.dueler.autoDecline then
|
||||||
print("Heimdall - Dueler - Auto declining duel from " .. sender)
|
if Heimdall_Data.config.dueler.debug then
|
||||||
|
print(string.format("%s: Auto declining duel from %s", ModuleName, sender))
|
||||||
|
end
|
||||||
CancelDuel()
|
CancelDuel()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "Echoer"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.Echoer = {}
|
shared.Echoer = {}
|
||||||
@@ -8,25 +9,23 @@ function shared.Echoer.Init()
|
|||||||
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, ...)
|
||||||
|
if Heimdall_Data.config.echoer.debug then
|
||||||
|
print(string.format("%s: OnEvent", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.echoer)
|
||||||
|
end
|
||||||
if not Heimdall_Data.config.echoer.enabled then return end
|
if not Heimdall_Data.config.echoer.enabled then return end
|
||||||
|
|
||||||
local channelId = select(6, ...)
|
local channelId = select(6, ...)
|
||||||
local channelname = ""
|
local _, channelname = GetChannelName(channelId)
|
||||||
---@type any[]
|
if Heimdall_Data.config.echoer.debug then
|
||||||
local channels = { GetChannelList() }
|
print(string.format("%s: channelname = %s", ModuleName, channelname))
|
||||||
for i = 1, #channels, 2 do
|
|
||||||
---@type number
|
|
||||||
local id = channels[i]
|
|
||||||
---@type string
|
|
||||||
local name = channels[i + 1]
|
|
||||||
if id == channelId then
|
|
||||||
channelname = name
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if channelname ~= Heimdall_Data.config.echoer.masterChannel then return end
|
if channelname ~= Heimdall_Data.config.echoer.masterChannel then return end
|
||||||
|
|
||||||
if string.find(msg, "^" .. Heimdall_Data.config.echoer.prefix) then
|
if string.find(msg, "^" .. Heimdall_Data.config.echoer.prefix) then
|
||||||
|
if Heimdall_Data.config.echoer.debug then
|
||||||
|
print(string.format("%s: msg = %s", ModuleName, msg))
|
||||||
|
end
|
||||||
local msg = string.sub(msg, string.len(Heimdall_Data.config.echoer.prefix) + 1)
|
local msg = string.sub(msg, string.len(Heimdall_Data.config.echoer.prefix) + 1)
|
||||||
SendChatMessage(msg, "SAY")
|
SendChatMessage(msg, "SAY")
|
||||||
end
|
end
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "Emoter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.Emoter = {}
|
shared.Emoter = {}
|
||||||
@@ -8,25 +9,23 @@ function shared.Emoter.Init()
|
|||||||
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, ...)
|
||||||
|
if Heimdall_Data.config.emoter.debug then
|
||||||
|
print(string.format("%s: OnEvent", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.emoter)
|
||||||
|
end
|
||||||
if not Heimdall_Data.config.emoter.enabled then return end
|
if not Heimdall_Data.config.emoter.enabled then return end
|
||||||
|
|
||||||
local channelId = select(6, ...)
|
local channelId = select(6, ...)
|
||||||
local channelname = ""
|
local _, channelname = GetChannelName(channelId)
|
||||||
---@type any[]
|
if Heimdall_Data.config.emoter.debug then
|
||||||
local channels = { GetChannelList() }
|
print(string.format("%s: channelname = %s", ModuleName, channelname))
|
||||||
for i = 1, #channels, 2 do
|
|
||||||
---@type number
|
|
||||||
local id = channels[i]
|
|
||||||
---@type string
|
|
||||||
local name = channels[i + 1]
|
|
||||||
if id == channelId then
|
|
||||||
channelname = name
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
if channelname ~= Heimdall_Data.config.emoter.masterChannel then return end
|
if channelname ~= Heimdall_Data.config.emoter.masterChannel then return end
|
||||||
|
|
||||||
if string.find(msg, "^" .. Heimdall_Data.config.emoter.prefix) then
|
if string.find(msg, "^" .. Heimdall_Data.config.emoter.prefix) then
|
||||||
|
if Heimdall_Data.config.emoter.debug then
|
||||||
|
print(string.format("%s: msg = %s", ModuleName, msg))
|
||||||
|
end
|
||||||
local emote = string.sub(msg, string.len(Heimdall_Data.config.emoter.prefix) + 1)
|
local emote = string.sub(msg, string.len(Heimdall_Data.config.emoter.prefix) + 1)
|
||||||
DoEmote(emote)
|
DoEmote(emote)
|
||||||
end
|
end
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "Inviter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.Inviter = {}
|
shared.Inviter = {}
|
||||||
@@ -9,16 +10,34 @@ function shared.Inviter.Init()
|
|||||||
local updateTimer = nil
|
local updateTimer = nil
|
||||||
|
|
||||||
local function FixGroup()
|
local function FixGroup()
|
||||||
if not IsInRaid() then ConvertToRaid() end
|
if Heimdall_Data.config.inviter.debug then
|
||||||
if Heimdall_Data.config.inviter.allAssist then SetEveryoneIsAssistant() end
|
print(string.format("%s: FixGroup", ModuleName))
|
||||||
--shared.dumpTable(Heimdall_Data.config.inviter)
|
shared.dumpTable(Heimdall_Data.config.inviter)
|
||||||
|
end
|
||||||
|
if not IsInRaid() then
|
||||||
|
if Heimdall_Data.config.inviter.debug then
|
||||||
|
print(string.format("%s: Not in raid", ModuleName))
|
||||||
|
end
|
||||||
|
ConvertToRaid()
|
||||||
|
end
|
||||||
|
if Heimdall_Data.config.inviter.allAssist then
|
||||||
|
if Heimdall_Data.config.inviter.debug then
|
||||||
|
print(string.format("%s: Setting everyone to assistant", ModuleName))
|
||||||
|
end
|
||||||
|
SetEveryoneIsAssistant()
|
||||||
|
end
|
||||||
if Heimdall_Data.config.inviter.agentsAssist then
|
if Heimdall_Data.config.inviter.agentsAssist then
|
||||||
|
if Heimdall_Data.config.inviter.debug then
|
||||||
|
print(string.format("%s: Setting agents to assistant", ModuleName))
|
||||||
|
end
|
||||||
--shared.dumpTable(Heimdall_Data.config.agents)
|
--shared.dumpTable(Heimdall_Data.config.agents)
|
||||||
for name, _ in pairs(Heimdall_Data.config.agents) do
|
for name, _ in pairs(Heimdall_Data.config.agents) do
|
||||||
if UnitInParty(name)
|
if UnitInParty(name)
|
||||||
and not UnitIsGroupLeader(name)
|
and not UnitIsGroupLeader(name)
|
||||||
and not UnitIsRaidOfficer(name) then
|
and not UnitIsRaidOfficer(name) then
|
||||||
print("Promoting " .. name .. " to assistant")
|
if Heimdall_Data.config.inviter.debug then
|
||||||
|
print(string.format("%s: Promoting %s to assistant", ModuleName, name))
|
||||||
|
end
|
||||||
PromoteToAssistant(name, true)
|
PromoteToAssistant(name, true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -32,12 +51,25 @@ function shared.Inviter.Init()
|
|||||||
---But that is currently not trivial and would require some work
|
---But that is currently not trivial and would require some work
|
||||||
---Since I'm the only one currently using this - I don't care where the buttons are
|
---Since I'm the only one currently using this - I don't care where the buttons are
|
||||||
local function OverlayKickButtonElvUI(name)
|
local function OverlayKickButtonElvUI(name)
|
||||||
|
if Heimdall_Data.config.inviter.debug then
|
||||||
|
print(string.format("%s: OverlayKickButtonElvUI", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.inviter)
|
||||||
|
end
|
||||||
for group = 1, 8 do
|
for group = 1, 8 do
|
||||||
for player = 1, 5 do
|
for player = 1, 5 do
|
||||||
local button = _G[string.format("ElvUF_RaidGroup%dUnitButton%d", group, player)]
|
local button = _G[string.format("ElvUF_RaidGroup%dUnitButton%d", group, player)]
|
||||||
|
if Heimdall_Data.config.inviter.debug then
|
||||||
|
print(string.format("%s: button = %s", ModuleName, button))
|
||||||
|
end
|
||||||
|
|
||||||
local unitName = button and button.unit and UnitName(button.unit)
|
local unitName = button and button.unit and UnitName(button.unit)
|
||||||
|
if Heimdall_Data.config.inviter.debug then
|
||||||
|
print(string.format("%s: unitName = %s", ModuleName, unitName))
|
||||||
|
end
|
||||||
if unitName == name then
|
if unitName == name then
|
||||||
|
if Heimdall_Data.config.inviter.debug then
|
||||||
|
print(string.format("%s: unitName == name", ModuleName))
|
||||||
|
end
|
||||||
local overlayButton = framePool[button.unit] or
|
local overlayButton = framePool[button.unit] or
|
||||||
CreateFrame("Button",
|
CreateFrame("Button",
|
||||||
string.format("HeimdallKickButton%s", button.unit, button, "SecureActionButtonTemplate"))
|
string.format("HeimdallKickButton%s", button.unit, button, "SecureActionButtonTemplate"))
|
||||||
@@ -110,6 +142,11 @@ function shared.Inviter.Init()
|
|||||||
local inviterGroupFrame = CreateFrame("Frame")
|
local inviterGroupFrame = CreateFrame("Frame")
|
||||||
inviterGroupFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
|
inviterGroupFrame:RegisterEvent("GROUP_ROSTER_UPDATE")
|
||||||
inviterGroupFrame:SetScript("OnEvent", function(self, event, ...)
|
inviterGroupFrame:SetScript("OnEvent", function(self, event, ...)
|
||||||
|
if Heimdall_Data.config.inviter.debug then
|
||||||
|
print(string.format("%s: OnEvent", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.inviter)
|
||||||
|
print(string.format("%s: event = %s", ModuleName, UnitIsGroupLeader("player")))
|
||||||
|
end
|
||||||
if not Heimdall_Data.config.inviter.enabled then return end
|
if not Heimdall_Data.config.inviter.enabled then return end
|
||||||
if not UnitIsGroupLeader("player") then return end
|
if not UnitIsGroupLeader("player") then return end
|
||||||
|
|
||||||
@@ -120,23 +157,20 @@ function shared.Inviter.Init()
|
|||||||
local inviterChannelFrame = CreateFrame("Frame")
|
local inviterChannelFrame = CreateFrame("Frame")
|
||||||
inviterChannelFrame:RegisterEvent("CHAT_MSG_CHANNEL")
|
inviterChannelFrame:RegisterEvent("CHAT_MSG_CHANNEL")
|
||||||
inviterChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
inviterChannelFrame:SetScript("OnEvent", function(self, event, msg, sender, ...)
|
||||||
|
if Heimdall_Data.config.inviter.debug then
|
||||||
|
print(string.format("%s: OnEvent", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.inviter)
|
||||||
|
end
|
||||||
if not Heimdall_Data.config.inviter.enabled then return end
|
if not Heimdall_Data.config.inviter.enabled then return end
|
||||||
local channelId = select(6, ...)
|
local channelId = select(6, ...)
|
||||||
local channelname = ""
|
local _, channelname = GetChannelName(channelId)
|
||||||
---@type any[]
|
|
||||||
local channels = { GetChannelList() }
|
|
||||||
for i = 1, #channels, 2 do
|
|
||||||
---@type number
|
|
||||||
local id = channels[i]
|
|
||||||
---@type string
|
|
||||||
local name = channels[i + 1]
|
|
||||||
if id == channelId then
|
|
||||||
channelname = name
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
if channelname ~= Heimdall_Data.config.inviter.listeningChannel then return end
|
if channelname ~= Heimdall_Data.config.inviter.listeningChannel then return end
|
||||||
if msg == Heimdall_Data.config.inviter.keyword then InviteUnit(sender) end
|
if msg == Heimdall_Data.config.inviter.keyword then
|
||||||
|
if Heimdall_Data.config.inviter.debug then
|
||||||
|
print(string.format("%s: Inviting %s", ModuleName, sender))
|
||||||
|
end
|
||||||
|
InviteUnit(sender)
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
print("Heimdall - Inviter loaded")
|
print("Heimdall - Inviter loaded")
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "Macroer"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.Macroer = {}
|
shared.Macroer = {}
|
||||||
@@ -11,22 +12,37 @@ function shared.Macroer.Init()
|
|||||||
---@field seenAt number
|
---@field seenAt number
|
||||||
---@field hostile boolean
|
---@field hostile boolean
|
||||||
|
|
||||||
---@type table<string, stinky>
|
|
||||||
local recentStinkies = {}
|
|
||||||
|
|
||||||
local function FindOrCreateMacro(macroName)
|
local function FindOrCreateMacro(macroName)
|
||||||
|
if Heimdall_Data.config.macroer.debug then
|
||||||
|
print(string.format("%s: FindOrCreateMacro", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.macroer)
|
||||||
|
end
|
||||||
local idx = GetMacroIndexByName(macroName)
|
local idx = GetMacroIndexByName(macroName)
|
||||||
if idx == 0 then
|
if idx == 0 then
|
||||||
|
if Heimdall_Data.config.macroer.debug then
|
||||||
|
print(string.format("%s: Creating macro", ModuleName))
|
||||||
|
end
|
||||||
CreateMacro(macroName, "INV_Misc_QuestionMark", "")
|
CreateMacro(macroName, "INV_Misc_QuestionMark", "")
|
||||||
end
|
end
|
||||||
idx = GetMacroIndexByName(macroName)
|
idx = GetMacroIndexByName(macroName)
|
||||||
|
if Heimdall_Data.config.macroer.debug then
|
||||||
|
print(string.format("%s: idx = %s", ModuleName, idx))
|
||||||
|
end
|
||||||
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
|
||||||
|
print(string.format("%s: FixMacro", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.macroer)
|
||||||
|
end
|
||||||
if not Heimdall_Data.config.macroer.enabled then return end
|
if not Heimdall_Data.config.macroer.enabled then return end
|
||||||
if InCombatLockdown() then return end
|
if InCombatLockdown() then return end
|
||||||
|
if Heimdall_Data.config.macroer.debug then
|
||||||
|
print(string.format("%s: InCombatLockdown", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.macroer)
|
||||||
|
end
|
||||||
local priorityMap = {}
|
local priorityMap = {}
|
||||||
for priority, className in ipairs(Heimdall_Data.config.macroer.priority) do
|
for priority, className in ipairs(Heimdall_Data.config.macroer.priority) do
|
||||||
priorityMap[className] = priority
|
priorityMap[className] = priority
|
||||||
@@ -60,6 +76,10 @@ function shared.Macroer.Init()
|
|||||||
end
|
end
|
||||||
|
|
||||||
shared.stinkyTracker.stinkies:onChange(function(value)
|
shared.stinkyTracker.stinkies:onChange(function(value)
|
||||||
|
if Heimdall_Data.config.macroer.debug then
|
||||||
|
print(string.format("%s: onChange", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.macroer)
|
||||||
|
end
|
||||||
FixMacro(value)
|
FixMacro(value)
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "Messenger"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.Messenger = {}
|
shared.Messenger = {}
|
||||||
@@ -24,7 +25,9 @@ function shared.Messenger.Init()
|
|||||||
local function FindOrJoinChannel(channelName, password)
|
local function FindOrJoinChannel(channelName, password)
|
||||||
local channelId = GetChannelName(channelName)
|
local channelId = GetChannelName(channelName)
|
||||||
if channelId == 0 then
|
if channelId == 0 then
|
||||||
print("Channel", tostring(channelName), "not found, joining")
|
if Heimdall_Data.config.messenger.debug then
|
||||||
|
print(string.format("%s: Channel %s not found, joining", ModuleName, channelName))
|
||||||
|
end
|
||||||
if password then
|
if password then
|
||||||
JoinPermanentChannel(channelName, password)
|
JoinPermanentChannel(channelName, password)
|
||||||
else
|
else
|
||||||
@@ -32,6 +35,9 @@ function shared.Messenger.Init()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
channelId = GetChannelName(channelName)
|
channelId = GetChannelName(channelName)
|
||||||
|
if Heimdall_Data.config.messenger.debug then
|
||||||
|
print(string.format("%s: Channel %s found, id = %s", ModuleName, channelName, channelId))
|
||||||
|
end
|
||||||
return channelId
|
return channelId
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -40,6 +46,10 @@ function shared.Messenger.Init()
|
|||||||
if not shared.messenger.queue then shared.messenger.queue = {} 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
|
||||||
|
print(string.format("%s: DoMessage", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.messenger)
|
||||||
|
end
|
||||||
if not Heimdall_Data.config.messenger.enabled then return end
|
if not Heimdall_Data.config.messenger.enabled then return end
|
||||||
---@type Message
|
---@type Message
|
||||||
local message = shared.messenger.queue[1]
|
local message = shared.messenger.queue[1]
|
||||||
@@ -48,13 +58,19 @@ function shared.Messenger.Init()
|
|||||||
if not message.channel or message.channel == "" then return end
|
if not message.channel or message.channel == "" then return 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
|
||||||
--print("Channel presented as string:", message.data)
|
if Heimdall_Data.config.messenger.debug then
|
||||||
|
print(string.format("%s: Channel presented as string: %s", ModuleName, message.data))
|
||||||
|
end
|
||||||
local channelId = GetChannelName(message.data)
|
local channelId = GetChannelName(message.data)
|
||||||
if channelId == 0 then
|
if channelId == 0 then
|
||||||
print(string.format("Channel not found, joining %s", message.data))
|
if Heimdall_Data.config.messenger.debug then
|
||||||
|
print(string.format("%s: Channel not found, joining %s", ModuleName, message.data))
|
||||||
|
end
|
||||||
channelId = FindOrJoinChannel(message.data)
|
channelId = FindOrJoinChannel(message.data)
|
||||||
end
|
end
|
||||||
--print("Channel resolved to id", channelId)
|
if Heimdall_Data.config.messenger.debug then
|
||||||
|
print(string.format("%s: Channel resolved to id %s", ModuleName, channelId))
|
||||||
|
end
|
||||||
message.data = tostring(channelId)
|
message.data = tostring(channelId)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -65,6 +81,10 @@ function shared.Messenger.Init()
|
|||||||
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
|
||||||
|
print(string.format("%s: Tick", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.messenger)
|
||||||
|
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
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "Spotter"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.Spotter = {}
|
shared.Spotter = {}
|
||||||
@@ -27,15 +28,34 @@ function shared.Spotter.Init()
|
|||||||
---@return boolean
|
---@return boolean
|
||||||
---@return string? error
|
---@return string? error
|
||||||
local function ShouldNotify(unit, name, faction, hostile)
|
local function ShouldNotify(unit, name, faction, hostile)
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: ShouldNotify", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.spotter)
|
||||||
|
end
|
||||||
if Heimdall_Data.config.agents[name] then return false end
|
if Heimdall_Data.config.agents[name] then return false end
|
||||||
if Heimdall_Data.config.spotter.stinky then
|
if Heimdall_Data.config.spotter.stinky then
|
||||||
if Heimdall_Data.config.stinkies[name] then return true end
|
if Heimdall_Data.config.stinkies[name] then
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: Stinky found in config", ModuleName))
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if Heimdall_Data.config.spotter.alliance then
|
if Heimdall_Data.config.spotter.alliance then
|
||||||
if faction == "Alliance" then return true end
|
if faction == "Alliance" then
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: Alliance", ModuleName))
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if Heimdall_Data.config.spotter.hostile then
|
if Heimdall_Data.config.spotter.hostile then
|
||||||
if hostile then return true end
|
if hostile then
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: Hostile", ModuleName))
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return Heimdall_Data.config.spotter.everyone
|
return Heimdall_Data.config.spotter.everyone
|
||||||
end
|
end
|
||||||
@@ -43,14 +63,24 @@ function shared.Spotter.Init()
|
|||||||
---@param unit string
|
---@param unit string
|
||||||
---@return string?
|
---@return string?
|
||||||
local function NotifySpotted(unit)
|
local function NotifySpotted(unit)
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: NotifySpotted", ModuleName))
|
||||||
|
shared.dumpTable(Heimdall_Data.config.spotter)
|
||||||
|
end
|
||||||
if not unit then return string.format("Could not find unit %s", tostring(unit)) end
|
if not unit then return string.format("Could not find unit %s", tostring(unit)) end
|
||||||
if not UnitIsPlayer(unit) then return nil end
|
if not UnitIsPlayer(unit) then return nil end
|
||||||
|
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: UnitIsPlayer", ModuleName))
|
||||||
|
end
|
||||||
local name = UnitName(unit)
|
local name = UnitName(unit)
|
||||||
if not name then return string.format("Could not find name for unit %s", tostring(unit)) end
|
if not name then return string.format("Could not find name for unit %s", tostring(unit)) end
|
||||||
|
|
||||||
local time = GetTime()
|
local time = GetTime()
|
||||||
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
|
||||||
|
print(string.format("%s: Throttled %s", ModuleName, tostring(name)))
|
||||||
|
end
|
||||||
return string.format("Throttled %s", tostring(name))
|
return string.format("Throttled %s", tostring(name))
|
||||||
end
|
end
|
||||||
throttleTable[name] = time
|
throttleTable[name] = time
|
||||||
@@ -59,19 +89,37 @@ function shared.Spotter.Init()
|
|||||||
if not race then return string.format("Could not find race for unit %s", tostring(unit)) end
|
if not race then return string.format("Could not find race for unit %s", tostring(unit)) end
|
||||||
local faction = shared.raceMap[race]
|
local faction = shared.raceMap[race]
|
||||||
if not faction then return string.format("Could not find faction for race %s", tostring(race)) end
|
if not faction then return string.format("Could not find faction for race %s", tostring(race)) end
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: Faction %s", ModuleName, tostring(faction)))
|
||||||
|
end
|
||||||
|
|
||||||
local hostile = UnitCanAttack("player", unit)
|
local hostile = UnitCanAttack("player", unit)
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: Hostile %s", ModuleName, tostring(hostile)))
|
||||||
|
end
|
||||||
local doNotify = ShouldNotify(unit, name, faction, hostile)
|
local doNotify = ShouldNotify(unit, name, faction, hostile)
|
||||||
if not doNotify then return string.format("Not notifying for %s", tostring(name)) end
|
if not doNotify then return string.format("Not notifying for %s", tostring(name)) end
|
||||||
|
|
||||||
local hp = UnitHealth(unit)
|
local hp = UnitHealth(unit)
|
||||||
if not hp then return string.format("Could not find hp for unit %s", tostring(unit)) end
|
if not hp then return string.format("Could not find hp for unit %s", tostring(unit)) end
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: HP %s", ModuleName, tostring(hp)))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local maxHp = UnitHealthMax(unit)
|
local maxHp = UnitHealthMax(unit)
|
||||||
if not maxHp then return string.format("Could not find maxHp for unit %s", tostring(unit)) end
|
if not maxHp then return string.format("Could not find maxHp for unit %s", tostring(unit)) end
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: MaxHP %s", ModuleName, tostring(maxHp)))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local class = UnitClass(unit)
|
local class = UnitClass(unit)
|
||||||
if not class then return string.format("Could not find class for unit %s", tostring(unit)) end
|
if not class then return string.format("Could not find class for unit %s", tostring(unit)) end
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: Class %s", ModuleName, tostring(class)))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local location = Heimdall_Data.config.spotter.zoneOverride
|
local location = Heimdall_Data.config.spotter.zoneOverride
|
||||||
if not location or location == "" then
|
if not location or location == "" then
|
||||||
@@ -79,10 +127,18 @@ function shared.Spotter.Init()
|
|||||||
if not zone then return string.format("Could not find zone for unit %s", tostring(unit)) end
|
if not zone then return string.format("Could not find zone for unit %s", tostring(unit)) end
|
||||||
local subzone = GetSubZoneText()
|
local subzone = GetSubZoneText()
|
||||||
if not subzone then subzone = "" end
|
if not subzone then subzone = "" end
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: Zone %s", ModuleName, tostring(zone)))
|
||||||
|
print(string.format("%s: Subzone %s", ModuleName, tostring(subzone)))
|
||||||
|
end
|
||||||
location = string.format("%s (%s)", zone, subzone)
|
location = string.format("%s (%s)", zone, subzone)
|
||||||
end
|
end
|
||||||
|
|
||||||
local x, y = GetPlayerMapPosition("player")
|
local x, y = GetPlayerMapPosition("player")
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: X %s", ModuleName, tostring(x)))
|
||||||
|
print(string.format("%s: Y %s", ModuleName, tostring(y)))
|
||||||
|
end
|
||||||
local stinky = Heimdall_Data.config.stinkies[name] or false
|
local stinky = Heimdall_Data.config.stinkies[name] or false
|
||||||
local text = string.format("I see (%s) %s/%s %s of race %s (%s) with health %s/%s at %s (%2.2f, %2.2f)",
|
local text = string.format("I see (%s) %s/%s %s of race %s (%s) with health %s/%s at %s (%2.2f, %2.2f)",
|
||||||
hostile and "Hostile" or "Friendly",
|
hostile and "Hostile" or "Friendly",
|
||||||
@@ -95,6 +151,10 @@ function shared.Spotter.Init()
|
|||||||
FormatHP(maxHp),
|
FormatHP(maxHp),
|
||||||
location,
|
location,
|
||||||
x * 100, y * 100)
|
x * 100, y * 100)
|
||||||
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: Text %s", ModuleName, tostring(text)))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
---@type Message
|
---@type Message
|
||||||
local msg = {
|
local msg = {
|
||||||
@@ -102,7 +162,10 @@ function shared.Spotter.Init()
|
|||||||
data = Heimdall_Data.config.spotter.notifyChannel,
|
data = Heimdall_Data.config.spotter.notifyChannel,
|
||||||
message = text
|
message = text
|
||||||
}
|
}
|
||||||
--shared.dumpTable(msg)
|
if Heimdall_Data.config.spotter.debug then
|
||||||
|
print(string.format("%s: Inserting message into queue", ModuleName))
|
||||||
|
shared.dumpTable(msg)
|
||||||
|
end
|
||||||
table.insert(shared.messenger.queue, msg)
|
table.insert(shared.messenger.queue, msg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
local addonname, shared = ...
|
local addonname, shared = ...
|
||||||
---@cast shared HeimdallShared
|
---@cast shared HeimdallShared
|
||||||
---@cast addonname string
|
---@cast addonname string
|
||||||
|
local ModuleName = "StinkyTracker"
|
||||||
|
|
||||||
---@diagnostic disable-next-line: missing-fields
|
---@diagnostic disable-next-line: missing-fields
|
||||||
shared.StinkyTracker = {}
|
shared.StinkyTracker = {}
|
||||||
@@ -13,6 +14,9 @@ function shared.StinkyTracker.Init()
|
|||||||
---@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
|
||||||
|
print(string.format("%s: Parsing who message: %s", ModuleName, msg))
|
||||||
|
end
|
||||||
local stinkies = {}
|
local stinkies = {}
|
||||||
for name, class in string.gmatch(msg, whoRegex) do
|
for name, class in string.gmatch(msg, whoRegex) do
|
||||||
stinkies[name] = {
|
stinkies[name] = {
|
||||||
@@ -21,16 +25,26 @@ function shared.StinkyTracker.Init()
|
|||||||
seenAt = GetTime(),
|
seenAt = GetTime(),
|
||||||
hostile = true
|
hostile = true
|
||||||
}
|
}
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Found stinky in who: %s/%s", ModuleName, name, class))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return stinkies
|
return stinkies
|
||||||
end
|
end
|
||||||
|
|
||||||
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
|
||||||
|
print(string.format("%s: Parsing see message: %s", ModuleName, msg))
|
||||||
|
end
|
||||||
local stinkies = {}
|
local stinkies = {}
|
||||||
local aggression, name, class = string.match(msg, seeRegex)
|
local aggression, name, class = string.match(msg, seeRegex)
|
||||||
if not name or not class then
|
if not name or not class then
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: No valid stinky found in see message", ModuleName))
|
||||||
|
end
|
||||||
return stinkies
|
return stinkies
|
||||||
end
|
end
|
||||||
local stinky = {
|
local stinky = {
|
||||||
@@ -40,19 +54,29 @@ function shared.StinkyTracker.Init()
|
|||||||
hostile = aggression == "Hostile"
|
hostile = aggression == "Hostile"
|
||||||
}
|
}
|
||||||
stinkies[name] = stinky
|
stinkies[name] = stinky
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Found stinky in see: %s/%s (%s)", ModuleName, name, class, aggression))
|
||||||
|
end
|
||||||
return stinkies
|
return stinkies
|
||||||
end
|
end
|
||||||
|
|
||||||
local arrivedRegex = "([^ -/]+)-?%w* of class (%w+)"
|
local arrivedRegex = "([^ -/]+)-?%w* of class (%w+)"
|
||||||
local arrivedRegexAlt = "([^ -/]+)-?%w* %(!!!!%) of class (%w+)"
|
local arrivedRegexAlt = "([^ -/]+)-?%w* %(!!!!%) of class (%w+)"
|
||||||
---@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
|
||||||
|
print(string.format("%s: Parsing arrived message: %s", ModuleName, msg))
|
||||||
|
end
|
||||||
local stinkies = {}
|
local stinkies = {}
|
||||||
local name, class = string.match(msg, arrivedRegex)
|
local name, class = string.match(msg, arrivedRegex)
|
||||||
if not name or not class then
|
if not name or not class then
|
||||||
name, class = string.match(msg, arrivedRegexAlt)
|
name, class = string.match(msg, arrivedRegexAlt)
|
||||||
end
|
end
|
||||||
if not name or not class then
|
if not name or not class then
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: No valid stinky found in arrived message", ModuleName))
|
||||||
|
end
|
||||||
return stinkies
|
return stinkies
|
||||||
end
|
end
|
||||||
local stinky = {
|
local stinky = {
|
||||||
@@ -62,45 +86,85 @@ function shared.StinkyTracker.Init()
|
|||||||
hostile = true
|
hostile = true
|
||||||
}
|
}
|
||||||
stinkies[name] = stinky
|
stinkies[name] = stinky
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Found stinky in arrived: %s/%s", ModuleName, name, class))
|
||||||
|
end
|
||||||
return stinkies
|
return stinkies
|
||||||
end
|
end
|
||||||
|
|
||||||
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, ...)
|
||||||
if not Heimdall_Data.config.stinkyTracker.enabled then return end
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Received event: %s", ModuleName, event))
|
||||||
|
end
|
||||||
|
if not Heimdall_Data.config.stinkyTracker.enabled then
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: StinkyTracker disabled", ModuleName))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
local channelId = select(6, ...)
|
local channelId = select(6, ...)
|
||||||
local _, channelname = GetChannelName(channelId)
|
local _, channelname = GetChannelName(channelId)
|
||||||
if channelname ~= Heimdall_Data.config.stinkyTracker.masterChannel then return end
|
if channelname ~= Heimdall_Data.config.stinkyTracker.masterChannel then
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Message not in master channel: %s", ModuleName, channelname))
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if string.find(msg, "^who:") then
|
if string.find(msg, "^who:") then
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Processing who message", ModuleName))
|
||||||
|
end
|
||||||
local whoStinkies = ParseWho(msg)
|
local whoStinkies = ParseWho(msg)
|
||||||
for name, stinky in pairs(whoStinkies) do
|
for name, stinky in pairs(whoStinkies) do
|
||||||
if stinky.hostile then
|
if stinky.hostile then
|
||||||
shared.stinkyTracker.stinkies[name] = stinky
|
shared.stinkyTracker.stinkies[name] = stinky
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Added stinky from who: %s", ModuleName, name))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if string.find(msg, "^I see") then
|
if string.find(msg, "^I see") then
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Processing see message", ModuleName))
|
||||||
|
end
|
||||||
local seeStinkies = ParseSee(msg)
|
local seeStinkies = ParseSee(msg)
|
||||||
for name, stinky in pairs(seeStinkies) do
|
for name, stinky in pairs(seeStinkies) do
|
||||||
if stinky.hostile then
|
if stinky.hostile then
|
||||||
shared.stinkyTracker.stinkies[name] = stinky
|
shared.stinkyTracker.stinkies[name] = stinky
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Added stinky from see: %s", ModuleName, name))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
if not stinky.hostile then
|
if not stinky.hostile then
|
||||||
shared.stinkyTracker.stinkies[name] = nil
|
shared.stinkyTracker.stinkies[name] = nil
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Removed stinky from see: %s", ModuleName, name))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if string.find(msg, " and guild ") then
|
if string.find(msg, " and guild ") then
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Processing arrived message", ModuleName))
|
||||||
|
end
|
||||||
local arrivedStinkies = ParseArrived(msg)
|
local arrivedStinkies = ParseArrived(msg)
|
||||||
for name, stinky in pairs(arrivedStinkies) do
|
for name, stinky in pairs(arrivedStinkies) do
|
||||||
shared.stinkyTracker.stinkies[name] = stinky
|
shared.stinkyTracker.stinkies[name] = stinky
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Added stinky from arrived: %s", ModuleName, name))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
for name, stinky in pairs(shared.stinkyTracker.stinkies) do
|
for name, stinky in pairs(shared.stinkyTracker.stinkies) do
|
||||||
if Heimdall_Data.config.agents[name] then
|
if Heimdall_Data.config.agents[name] then
|
||||||
shared.stinkyTracker.stinkies[name] = nil
|
shared.stinkyTracker.stinkies[name] = nil
|
||||||
|
if Heimdall_Data.config.stinkyTracker.debug then
|
||||||
|
print(string.format("%s: Removed agent stinky: %s", ModuleName, name))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
Reference in New Issue
Block a user