Code format

This commit is contained in:
2025-01-09 10:55:32 +01:00
parent 2e44a1ef31
commit be81a31302
15 changed files with 274 additions and 231 deletions

View File

@@ -13,58 +13,60 @@ function shared.CombatAlerter.Init()
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Combat log event received", ModuleName))
end
if not Heimdall_Data.config.combatAlerter.enabled then
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
return
end
local destination, err = CLEUParser.GetDestName(...)
if err then
if err then
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Error getting destination: %s", ModuleName, err))
end
return
return
end
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Combat event destination: %s", ModuleName, destination))
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Combat event destination: %s", ModuleName, destination))
end
if destination ~= UnitName("player") then
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
return
end
local source, err = CLEUParser.GetSourceName(...)
if err then
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"
source = "unknown"
end
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Combat event source: %s", ModuleName, source))
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Combat event source: %s", ModuleName, source))
end
if shared.stinkyTracker.stinkies and shared.stinkyTracker.stinkies[source] then
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Source is tracked stinky: %s (Already alerted: %s)", ModuleName, source, tostring(alerted[source] or false)))
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 location: %s/%s at %.2f,%.2f", ModuleName, zone, subZone, x * 100, y * 100))
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",
@@ -75,7 +77,7 @@ function shared.CombatAlerter.Init()
x * 100, y * 100
),
}
if Heimdall_Data.config.combatAlerter.debug then
print(string.format("[%s] Queuing alert message: '%s'", ModuleName, msg.message))
end