Display error messages from event
This commit is contained in:
@@ -12,6 +12,7 @@ function(allstates, e, ...)
|
|||||||
local alert = eventMap[spellId]
|
local alert = eventMap[spellId]
|
||||||
if alert == nil then return end
|
if alert == nil then return end
|
||||||
|
|
||||||
alert:Trigger(allstates, ...)
|
local err = alert:Trigger(allstates, ...)
|
||||||
|
if err then print(err) end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
@@ -1236,10 +1236,11 @@ Alert = {
|
|||||||
---@param self Alert
|
---@param self Alert
|
||||||
---@param allstates allstates
|
---@param allstates allstates
|
||||||
---@param ... any
|
---@param ... any
|
||||||
|
---@return string|nil
|
||||||
Trigger = function(self, allstates, ...)
|
Trigger = function(self, allstates, ...)
|
||||||
-- We trust that the event is valid
|
-- We trust that the event is valid
|
||||||
local spellname, err = CLEUParser.GetSpellName(...)
|
local spellname, err = CLEUParser.GetSpellName(...)
|
||||||
if err then return end
|
if err then return err end
|
||||||
|
|
||||||
-- The idea is:
|
-- The idea is:
|
||||||
-- If the spell is being cast (SPELL_CAST_START) target will be nil (because server is cooked)
|
-- 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)
|
-- 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
|
-- And get the target "manually" from the instant cast using the same principle as with the cast start
|
||||||
local src, err = CLEUParser.GetSourceGUID(...)
|
local src, err = CLEUParser.GetSourceGUID(...)
|
||||||
if err then return end
|
if err then return err end
|
||||||
local castInfo, err = GetCastInfoForGuid(src)
|
local castInfo, err = GetCastInfoForGuid(src)
|
||||||
local targetInfo, err = GetTargetInfoForGuid(src)
|
local targetInfo, err = GetTargetInfoForGuid(src)
|
||||||
|
|
||||||
@@ -1275,7 +1276,6 @@ Alert = {
|
|||||||
|
|
||||||
local castEnd = math.max(GetTime() + 1, castInfo.endms / 1000)
|
local castEnd = math.max(GetTime() + 1, castInfo.endms / 1000)
|
||||||
local castDuration = math.max(1, (castInfo.endms - castInfo.startms) / 1000)
|
local castDuration = math.max(1, (castInfo.endms - castInfo.startms) / 1000)
|
||||||
DevTools_Dump(castInfo)
|
|
||||||
|
|
||||||
---@type state
|
---@type state
|
||||||
local state = {
|
local state = {
|
||||||
@@ -1294,12 +1294,13 @@ Alert = {
|
|||||||
|
|
||||||
allstates[string.format("%d-%d", self.id, self.iterator)] = state
|
allstates[string.format("%d-%d", self.id, self.iterator)] = state
|
||||||
self.iterator = self.iterator + 1
|
self.iterator = self.iterator + 1
|
||||||
|
return nil
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
local alerts = {
|
local alerts = {
|
||||||
-- Debug
|
-- Debug
|
||||||
Alert.new(774, "Rejuvenation", { "SPELL_CAST_SUCCESS" }, "REJUV", "REEEEEEEEJUUUUUUUUUUUVVVVVVVVV"),
|
Alert.new(774, "Rejuvenation", { "SPELL_AURA_APPLIED" }, "REJUV", "REEEEEEEEJUUUUUUUUUUUVVVVVVVVV"),
|
||||||
-- Garothi
|
-- Garothi
|
||||||
Alert.new(244410, "Decimation", { "SPELL_CAST_SUCCESS" }, "", "Move"),
|
Alert.new(244410, "Decimation", { "SPELL_CAST_SUCCESS" }, "", "Move"),
|
||||||
Alert.new(246220, "Fel Bombardment", { "SPELL_CAST_SUCCESS" }, "", "Move"),
|
Alert.new(246220, "Fel Bombardment", { "SPELL_CAST_SUCCESS" }, "", "Move"),
|
||||||
|
Reference in New Issue
Block a user