Fix up the log messages a lil
Unbutcher inviter
This commit is contained in:
@@ -11,47 +11,77 @@ function shared.CombatAlerter.Init()
|
||||
combatAlerterFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
|
||||
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)
|
||||
print(string.format("[%s] Combat log event received", ModuleName))
|
||||
end
|
||||
if not Heimdall_Data.config.combatAlerter.enabled then return end
|
||||
if not Heimdall_Data.config.combatAlerter.enabled then
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("[%s] Module disabled, ignoring combat event", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local destination, err = CLEUParser.GetDestName(...)
|
||||
if err then return end
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("%s: Destination: %s", ModuleName, destination))
|
||||
if err then
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("[%s] Error getting destination: %s", ModuleName, err))
|
||||
end
|
||||
return
|
||||
end
|
||||
if destination ~= UnitName("player") then return end
|
||||
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("[%s] Combat event destination: %s", ModuleName, destination))
|
||||
end
|
||||
|
||||
if destination ~= UnitName("player") then
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("[%s] Ignoring event - not targeted at player", ModuleName))
|
||||
end
|
||||
return
|
||||
end
|
||||
|
||||
local source, err = CLEUParser.GetSourceName(...)
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("%s: Source: %s", ModuleName, source))
|
||||
if err then
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("[%s] Error getting source, using 'unknown': %s", ModuleName, err))
|
||||
end
|
||||
source = "unknown"
|
||||
end
|
||||
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("[%s] Combat event source: %s", ModuleName, source))
|
||||
end
|
||||
if err then source = "unknown" end
|
||||
|
||||
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]))
|
||||
print(string.format("[%s] Source is tracked stinky: %s (Already alerted: %s)", ModuleName, source, tostring(alerted[source] or false)))
|
||||
end
|
||||
if alerted[source] then return end
|
||||
|
||||
alerted[source] = true
|
||||
local x, y = GetPlayerMapPosition("player")
|
||||
local zone, subZone = GetZoneText(), GetSubZoneText()
|
||||
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("%s: Player position: %2.2f,%2.2f", ModuleName, x, y))
|
||||
print(string.format("[%s] Player location: %s/%s at %.2f,%.2f", ModuleName, zone, subZone, x * 100, y * 100))
|
||||
end
|
||||
|
||||
---@type Message
|
||||
local msg = {
|
||||
channel = "CHANNEL",
|
||||
data = Heimdall_Data.config.combatAlerter.masterChannel,
|
||||
message = string.format("%s is attacking me in %s(%s) at %2.2f,%2.2f ",
|
||||
source,
|
||||
GetZoneText(), GetSubZoneText(),
|
||||
zone, subZone,
|
||||
x * 100, y * 100
|
||||
),
|
||||
}
|
||||
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("%s: Message:", ModuleName))
|
||||
shared.dumpTable(msg)
|
||||
print(string.format("[%s] Queuing alert message: '%s'", ModuleName, msg.message))
|
||||
end
|
||||
table.insert(shared.messenger.queue, msg)
|
||||
elseif Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("[%s] Source not in stinky list, ignoring: %s", ModuleName, source))
|
||||
end
|
||||
end)
|
||||
|
||||
@@ -60,11 +90,18 @@ function shared.CombatAlerter.Init()
|
||||
combatTriggerFrame:RegisterEvent("PLAYER_REGEN_ENABLED")
|
||||
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)
|
||||
print(string.format("[%s] Combat state changed: %s", ModuleName, event))
|
||||
if event == "PLAYER_REGEN_DISABLED" then
|
||||
print(string.format("[%s] Entered combat - Resetting alerts", ModuleName))
|
||||
else
|
||||
print(string.format("[%s] Left combat - Resetting alerts", ModuleName))
|
||||
end
|
||||
end
|
||||
alerted = {}
|
||||
end)
|
||||
|
||||
print("Heimdall - CombatAlerter loaded")
|
||||
if Heimdall_Data.config.combatAlerter.debug then
|
||||
print(string.format("[%s] Module initialized", ModuleName))
|
||||
end
|
||||
print("[Heimdall] CombatAlerter loaded")
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user