Implement target on SPELL_CAST_START
This commit is contained in:
@@ -1,10 +1,17 @@
|
|||||||
--- COMBAT_LOG_EVENT_UNFILTERED
|
--- COMBAT_LOG_EVENT_UNFILTERED
|
||||||
---@param e string
|
---@param e string
|
||||||
---@param ... any
|
---@param ... any
|
||||||
function(e, ...)
|
function(allstates, e, ...)
|
||||||
local subevent, err = CLEUParser.GetSubevent(...)
|
local subevent, err = CLEUParser.GetSubevent(...)
|
||||||
if err then return end
|
if err then return end
|
||||||
local spellId, err = CLEUParser.GetSpellId(...)
|
local spellId, err = CLEUParser.GetSpellId(...)
|
||||||
if err then return end
|
if err then return end
|
||||||
print(EventMap[subevent][spellId])
|
|
||||||
|
local eventMap = EventMap[subevent]
|
||||||
|
if eventMap == nil then return end
|
||||||
|
local alert = eventMap[spellId]
|
||||||
|
if alert == nil then return end
|
||||||
|
|
||||||
|
alert:Trigger(allstates, ...)
|
||||||
|
return true
|
||||||
end
|
end
|
||||||
|
11
FreshShit/RaiderlosSA/event2.lua
Normal file
11
FreshShit/RaiderlosSA/event2.lua
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
-- TICKER_100
|
||||||
|
function()
|
||||||
|
GUIDUnitMap = {}
|
||||||
|
for i = 1, 40 do
|
||||||
|
local unit = string.format("nameplate%d", i)
|
||||||
|
local GUID = UnitGUID(unit)
|
||||||
|
if GUID then
|
||||||
|
GUIDUnitMap[GUID] = unit
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@@ -1036,48 +1036,60 @@ CLEUParser = {
|
|||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
local function varargToString(...)
|
GUIDUnitMap = {}
|
||||||
local output = {}
|
|
||||||
for i = 1, select("#", ...) do
|
|
||||||
table.insert(output, tostring(select(i, ...)))
|
|
||||||
end
|
|
||||||
return table.concat(output, ", ")
|
|
||||||
end
|
|
||||||
|
|
||||||
-- C:\Users\Administrator\Seafile\Backup-WoW\Ruski\WTF\Account\phatphuckdave\SavedVariables\WeakAuras.lua
|
|
||||||
-- /dump WeakAurasSaved.Cyka.CLEUExample
|
|
||||||
if not WeakAurasSaved then WeakAurasSaved = {} end
|
|
||||||
if not WeakAurasSaved.Cyka then WeakAurasSaved.Cyka = {} end
|
|
||||||
if not WeakAurasSaved.Cyka.CLEUExample then WeakAurasSaved.Cyka.CLEUExample = {} end
|
|
||||||
---@param spellName string
|
|
||||||
---@param spellId number
|
|
||||||
---@param subevent string
|
|
||||||
---@param ... any
|
|
||||||
aura_env.LogSpell = function(spellName, spellId, subevent, ...)
|
|
||||||
local slug = string.format("%d-%s", spellId, subevent)
|
|
||||||
if not WeakAurasSaved.Cyka.CLEUExample[slug] then
|
|
||||||
WeakAurasSaved.Cyka.CLEUExample[slug] = varargToString(spellName, spellId, subevent, ...)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local SoundFileRoot = "Interface\\Sounds\\spellAlert\\"
|
local SoundFileRoot = "Interface\\Sounds\\spellAlert\\"
|
||||||
|
local PlayerName = UnitName("player")
|
||||||
|
|
||||||
---@class SpellAlert
|
---@param guid string
|
||||||
|
---@return string, nil|string
|
||||||
|
local function GetUnitFromGuid(guid)
|
||||||
|
local unit = GUIDUnitMap[guid]
|
||||||
|
if unit == nil then return "", "Unit not found" end
|
||||||
|
return unit, nil
|
||||||
|
end
|
||||||
|
|
||||||
|
---@param guid string
|
||||||
|
---@return {name: string, target: string, startms: number, endms: number, spellid: number}, nil|string
|
||||||
|
local function GetCastInfoForGuid(guid)
|
||||||
|
local retval = {
|
||||||
|
name = "",
|
||||||
|
target = "",
|
||||||
|
startms = 0,
|
||||||
|
endms = 0,
|
||||||
|
spellid = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
local unit, err = GetUnitFromGuid(guid)
|
||||||
|
if err then return retval, err end
|
||||||
|
local name, _, _, startTimeMS, endTimeMS, _, _, _, spellId = UnitCastingInfo(unit)
|
||||||
|
if name == nil then return retval, "Unit is not casting" end
|
||||||
|
retval.name = name
|
||||||
|
retval.startms = startTimeMS
|
||||||
|
retval.endms = endTimeMS
|
||||||
|
retval.spellid = spellId
|
||||||
|
retval.target = UnitName(string.format("%starget", unit))
|
||||||
|
|
||||||
|
return retval, nil
|
||||||
|
end
|
||||||
|
|
||||||
|
---@class Alert
|
||||||
---@field id number
|
---@field id number
|
||||||
---@field soundFile string
|
---@field soundFile string
|
||||||
---@field events table<string, boolean>
|
---@field events table<string, boolean>
|
||||||
---@field instruction string
|
---@field instruction string
|
||||||
---@field afflictedInstruction string
|
---@field afflictedInstruction string
|
||||||
SpellAlert = {
|
---@field iterator number
|
||||||
|
Alert = {
|
||||||
---@param id number
|
---@param id number
|
||||||
---@param name string
|
---@param name string
|
||||||
---@param events table<string>
|
---@param events table<string>
|
||||||
---@param instruction string
|
---@param instruction string
|
||||||
---@param afflictedInstruction string
|
---@param afflictedInstruction string
|
||||||
---@return SpellAlert
|
---@return Alert
|
||||||
new = function(id, name, events, instruction, afflictedInstruction)
|
new = function(id, name, events, instruction, afflictedInstruction)
|
||||||
local self = setmetatable({}, {
|
local self = setmetatable({}, {
|
||||||
__index = SpellAlert
|
__index = Alert
|
||||||
})
|
})
|
||||||
self.id = id
|
self.id = id
|
||||||
name = string.gsub(name, " ", "_")
|
name = string.gsub(name, " ", "_")
|
||||||
@@ -1089,38 +1101,88 @@ SpellAlert = {
|
|||||||
end
|
end
|
||||||
self.instruction = instruction
|
self.instruction = instruction
|
||||||
self.afflictedInstruction = afflictedInstruction
|
self.afflictedInstruction = afflictedInstruction
|
||||||
|
self.iterator = 0
|
||||||
return self
|
return self
|
||||||
|
end,
|
||||||
|
|
||||||
|
---@param self Alert
|
||||||
|
---@param allstates allstates
|
||||||
|
---@param ... any
|
||||||
|
Trigger = function(self, allstates, ...)
|
||||||
|
-- We trust that the event is valid
|
||||||
|
local spellname, err = CLEUParser.GetSpellName(...)
|
||||||
|
if err then return end
|
||||||
|
-- SPELL_CAST_START does NOT have the destination info
|
||||||
|
-- What we'll have to do is keep a map of unit guids to units
|
||||||
|
-- In other words - 10 times per second scan all the nameplates and create a <guid, unit> map
|
||||||
|
-- On SPELL_CAST_START get the srcGUID, index the map, get the unit, run UnitCastingInfo(unit), get the target
|
||||||
|
-- It's fried af but it will probably work
|
||||||
|
-- With only 40 nameplates it shouldn't be a big deal
|
||||||
|
local target, err = CLEUParser.GetDestGUID(...)
|
||||||
|
if target == "" then
|
||||||
|
local src, err = CLEUParser.GetSourceGUID(...)
|
||||||
|
if err == nil then
|
||||||
|
local castInfo, err = GetCastInfoForGuid(src)
|
||||||
|
if err then print(err) end
|
||||||
|
if err == nil then
|
||||||
|
target = castInfo.target
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local displayText = self.instruction
|
||||||
|
if err == nil and target == PlayerName then
|
||||||
|
displayText = self.afflictedInstruction
|
||||||
|
end
|
||||||
|
|
||||||
|
---@type state
|
||||||
|
local state = {
|
||||||
|
show = true,
|
||||||
|
changed = true,
|
||||||
|
progressType = "timed",
|
||||||
|
expireTime = GetTime() + 3,
|
||||||
|
duration = 3,
|
||||||
|
autoHide = true,
|
||||||
|
name = displayText,
|
||||||
|
target = target,
|
||||||
|
}
|
||||||
|
DevTools_Dump(state)
|
||||||
|
|
||||||
|
allstates[string.format("%d-%d", self.id, self.iterator)] = state
|
||||||
|
self.iterator = self.iterator + 1
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
local alerts = {
|
local alerts = {
|
||||||
|
-- Debug
|
||||||
|
Alert.new(5176, "Solar Wrath", { "SPELL_CAST_START" }, "Solar Wrath", "Solar Wrath on you!"),
|
||||||
-- Garothi
|
-- Garothi
|
||||||
SpellAlert.new(244410, "Decimation", { "SPELL_CAST_SUCCESS" }, "", "Move"),
|
Alert.new(244410, "Decimation", { "SPELL_CAST_SUCCESS" }, "", "Move"),
|
||||||
SpellAlert.new(246220, "Fel Bombardment", { "SPELL_CAST_SUCCESS" }, "", "Move"),
|
Alert.new(246220, "Fel Bombardment", { "SPELL_CAST_SUCCESS" }, "", "Move"),
|
||||||
SpellAlert.new(244969, "Eradication", { "SPELL_CAST_START" }, "Run away", ""),
|
Alert.new(244969, "Eradication", { "SPELL_CAST_START" }, "Run away", ""),
|
||||||
SpellAlert.new(244106, "Carnage", { "SPELL_CAST_START" }, "Tank the boss", ""),
|
Alert.new(244106, "Carnage", { "SPELL_CAST_START" }, "Tank the boss", ""),
|
||||||
-- Felhounds
|
-- Felhounds
|
||||||
SpellAlert.new(244086, "Molten Touch", { "SPELL_CAST_SUCCESS" }, "", "Run away"),
|
Alert.new(244086, "Molten Touch", { "SPELL_CAST_SUCCESS" }, "", "Run away"),
|
||||||
SpellAlert.new(244768, "Desolate Gaze", { "SPELL_AURA_APPLIED" }, "", "Move away"),
|
Alert.new(244768, "Desolate Gaze", { "SPELL_AURA_APPLIED" }, "", "Move away"),
|
||||||
SpellAlert.new(244057, "Enflame Corruption", { "SPELL_CAST_START", "SPELL_AURA_APPLIED" }, "Spread", "Spread!!"),
|
Alert.new(244057, "Enflame Corruption", { "SPELL_CAST_START", "SPELL_AURA_APPLIED" }, "Spread", "Spread!!"),
|
||||||
SpellAlert.new(244131, "Consuming Sphere", { "SPELL_AURA_APPLIED" }, "Move", ""),
|
Alert.new(244131, "Consuming Sphere", { "SPELL_AURA_APPLIED" }, "Move", ""),
|
||||||
SpellAlert.new(244056, "Siphon Corruption", { "SPELL_CAST_START", "SPELL_AURA_APPLIED" }, "Stack", "Stack!!"),
|
Alert.new(244056, "Siphon Corruption", { "SPELL_CAST_START", "SPELL_AURA_APPLIED" }, "Stack", "Stack!!"),
|
||||||
-- Antoran High Command
|
-- Antoran High Command
|
||||||
-- SpellAlert.new(245161, "Entropic Mine"), -- Need more info
|
-- SpellAlert.new(245161, "Entropic Mine"), -- Need more info
|
||||||
-- SpellAlert.new(245546, "Summon Reinforcements"), -- Need more info
|
-- SpellAlert.new(245546, "Summon Reinforcements"), -- Need more info
|
||||||
-- Portal Keeper Hasabel
|
-- Portal Keeper Hasabel
|
||||||
SpellAlert.new(244016, "Reality Tear", { "SPELL_CAST_SUCCESS" }, "", ""),
|
Alert.new(244016, "Reality Tear", { "SPELL_CAST_SUCCESS" }, "", ""),
|
||||||
SpellAlert.new(243983, "Collapsing World", { "SPELL_CAST_SUCCESS" }, "Dodge", ""),
|
Alert.new(243983, "Collapsing World", { "SPELL_CAST_SUCCESS" }, "Dodge", ""),
|
||||||
SpellAlert.new(244000, "Felstorm Barrage", { "SPELL_CAST_START" }, "Dodge", ""),
|
Alert.new(244000, "Felstorm Barrage", { "SPELL_CAST_START" }, "Dodge", ""),
|
||||||
-- Imonar
|
-- Imonar
|
||||||
-- SpellAlert.new(247552, "Sleep Canister"), -- Need more info
|
-- SpellAlert.new(247552, "Sleep Canister"), -- Need more info
|
||||||
SpellAlert.new(247367, "Shock Lance", { "SPELL_CAST_SUCCESS" }, "", ""),
|
Alert.new(247367, "Shock Lance", { "SPELL_CAST_SUCCESS" }, "", ""),
|
||||||
SpellAlert.new(248068, "Empowered Pulse Grenade", { "SPELL_CAST_SUCCESS" }, "", ""), -- Need more info
|
Alert.new(248068, "Empowered Pulse Grenade", { "SPELL_CAST_SUCCESS" }, "", ""), -- Need more info
|
||||||
SpellAlert.new(247376, "Pulse Grenade", { "SPELL_CAST_SUCCESS" }, "", ""), -- Need more info
|
Alert.new(247376, "Pulse Grenade", { "SPELL_CAST_SUCCESS" }, "", ""), -- Need more info
|
||||||
SpellAlert.new(247716, "Charged Blasts", { "SPELL_AURA_APPLIED" }, "", "Move!!"),
|
Alert.new(247716, "Charged Blasts", { "SPELL_AURA_APPLIED" }, "", "Move!!"),
|
||||||
SpellAlert.new(247687, "Sever", { "SPELL_CAST_SUCCESS" }, "", ""),
|
Alert.new(247687, "Sever", { "SPELL_CAST_SUCCESS" }, "", ""),
|
||||||
SpellAlert.new(248070, "Empowered Shrapnel Blast", { "SPELL_CAST_START" }, "Mines", ""),
|
Alert.new(248070, "Empowered Shrapnel Blast", { "SPELL_CAST_START" }, "Mines", ""),
|
||||||
SpellAlert.new(250255, "Empowered Shock Lance", { "SPELL_CAST_START" }, "", ""),
|
Alert.new(250255, "Empowered Shock Lance", { "SPELL_CAST_START" }, "", ""),
|
||||||
-- Kin'garoth
|
-- Kin'garoth
|
||||||
-- SpellAlert.new(254919, "Forging Strike"),
|
-- SpellAlert.new(254919, "Forging Strike"),
|
||||||
-- SpellAlert.new(254926, "Reverberating Strike"),
|
-- SpellAlert.new(254926, "Reverberating Strike"),
|
||||||
@@ -1328,6 +1390,7 @@ local alerts = {
|
|||||||
-- SpellAlert.new(228837, "Bellowing Roar"),
|
-- SpellAlert.new(228837, "Bellowing Roar"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
---@type table<string, table<number, Alert>>
|
||||||
EventMap = {}
|
EventMap = {}
|
||||||
for _, alert in ipairs(alerts) do
|
for _, alert in ipairs(alerts) do
|
||||||
for event, _ in pairs(alert.events) do
|
for event, _ in pairs(alert.events) do
|
||||||
@@ -1336,4 +1399,4 @@ for _, alert in ipairs(alerts) do
|
|||||||
end
|
end
|
||||||
EventMap[event][alert.id] = alert
|
EventMap[event][alert.id] = alert
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Reference in New Issue
Block a user