Display error messages from event

This commit is contained in:
2024-03-15 18:09:12 +01:00
parent 7819d0fc3d
commit b7d0a62bb0
2 changed files with 8 additions and 6 deletions

View File

@@ -11,7 +11,8 @@ function(allstates, e, ...)
if eventMap == nil then return end
local alert = eventMap[spellId]
if alert == nil then return end
alert:Trigger(allstates, ...)
local err = alert:Trigger(allstates, ...)
if err then print(err) end
return true
end

View File

@@ -1236,10 +1236,11 @@ Alert = {
---@param self Alert
---@param allstates allstates
---@param ... any
---@return string|nil
Trigger = function(self, allstates, ...)
-- We trust that the event is valid
local spellname, err = CLEUParser.GetSpellName(...)
if err then return end
if err then return err end
-- The idea is:
-- If the spell is being cast (SPELL_CAST_START) target will be nil (because server is cooked)
@@ -1253,7 +1254,7 @@ Alert = {
-- We then clamp the cast time to at least 1 second (meaning instant spells appear for 1s)
-- And get the target "manually" from the instant cast using the same principle as with the cast start
local src, err = CLEUParser.GetSourceGUID(...)
if err then return end
if err then return err end
local castInfo, err = GetCastInfoForGuid(src)
local targetInfo, err = GetTargetInfoForGuid(src)
@@ -1275,7 +1276,6 @@ Alert = {
local castEnd = math.max(GetTime() + 1, castInfo.endms / 1000)
local castDuration = math.max(1, (castInfo.endms - castInfo.startms) / 1000)
DevTools_Dump(castInfo)
---@type state
local state = {
@@ -1294,12 +1294,13 @@ Alert = {
allstates[string.format("%d-%d", self.id, self.iterator)] = state
self.iterator = self.iterator + 1
return nil
end
}
local alerts = {
-- Debug
Alert.new(774, "Rejuvenation", { "SPELL_CAST_SUCCESS" }, "REJUV", "REEEEEEEEJUUUUUUUUUUUVVVVVVVVV"),
Alert.new(774, "Rejuvenation", { "SPELL_AURA_APPLIED" }, "REJUV", "REEEEEEEEJUUUUUUUUUUUVVVVVVVVV"),
-- Garothi
Alert.new(244410, "Decimation", { "SPELL_CAST_SUCCESS" }, "", "Move"),
Alert.new(246220, "Fel Bombardment", { "SPELL_CAST_SUCCESS" }, "", "Move"),