dpslog: CLEU rename, DPSMate absorb pipeline, WSBT adapter, module version API

- Rename COMBAT_LOG_EVENT -> COMBAT_LOG_EVENT_UNFILTERED across Zig/Lua
- DPSMate CLEU adapter: absorb pipeline (SetUnregisterVariables, Absorb,
  ConfirmAbsorbApplication, UnregisterAbsorb), BuildFail type 2/3,
  "(Periodic)" suffix, removed dead handler
- WSBT (Weird Scrolling Battle Text): CLEU adapter fork of MSBT with
  dispatch table, A/B combat profiling, selective event unregistration
- Module version API: GetWeirdUtilsVersion(name?) Lua function + WeirdUtils
  global table, additive across independent DLLs. Build system passes
  per-module version strings via build_options.
- Hook Glue_LoadScriptFunctions (0x46ABB0) for login screen availability
- Rename lsf_hook -> register_commands_hook (real name: Player_LoadScriptFunctions)
- lua.zig: add setglobal/getglobal via LUA_GLOBALSINDEX (-10001)
This commit is contained in:
MarcelineVQ
2026-03-18 14:20:16 -07:00
parent 86da3bcc03
commit fc762ac200
14 changed files with 6672 additions and 402 deletions
+98 -183
View File
@@ -1,10 +1,10 @@
-- DPSMate CLEU Adapter
-- Replaces the string-parsing CHAT_MSG_* event system with structured COMBAT_LOG_EVENT
-- data from the DPSLog module. Registers for COMBAT_LOG_EVENT and calls DPSMate.DB
-- Replaces the string-parsing CHAT_MSG_* event system with structured COMBAT_LOG_EVENT_UNFILTERED
-- data from the DPSLog module. Registers for COMBAT_LOG_EVENT_UNFILTERED and calls DPSMate.DB
-- functions directly with extracted values.
--
-- Toggle: /dpscleu (switches between CLEU adapter and original string parser)
-- Requires: DPSLog module (provides COMBAT_LOG_EVENT + GetSpellInfo)
-- Requires: DPSLog module (provides COMBAT_LOG_EVENT_UNFILTERED + GetSpellInfo)
if not DPSMate or not DPSMate.DB then return end
@@ -75,14 +75,14 @@ local function enableCLEU()
Parser:UnregisterEvent(ev)
end
-- Enable CLEU
cleuFrame:RegisterEvent("COMBAT_LOG_EVENT")
cleuFrame:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
cleuActive = true
DEFAULT_CHAT_FRAME:AddMessage("|cff00ff00DPSMate CLEU Adapter|r: |cff00ff00ON|r (structured events)")
end
local function enableOriginal()
-- Disable CLEU
cleuFrame:UnregisterEvent("COMBAT_LOG_EVENT")
cleuFrame:UnregisterEvent("COMBAT_LOG_EVENT_UNFILTERED")
-- Re-enable string parser
for _, ev in ipairs(chatEvents) do
Parser:RegisterEvent(ev)
@@ -129,177 +129,9 @@ local function isGroupMember(name)
end
-- ============================================================================
-- CLEU event handler
-- (dead handler removed — real handler is cleuHandler below, wrapped by profiling)
-- ============================================================================
cleuFrame:SetScript("OnEvent", function()
local sub = arg1
if not sub then return end
local srcGUID = arg2
local srcName = arg3
local dstGUID = arg4
local dstName = arg5
if not srcName or srcName == "" then srcName = "Unknown" end
if not dstName or dstName == "" then dstName = "Unknown" end
-- ========================================================================
-- DAMAGE events
-- ========================================================================
if sub == "SWING_DAMAGE" then
local amount = arg6 or 0
local critical = arg12 == 1 and 1 or 0
local glancing = arg13 == 1 and 1 or 0
local crushing = arg14 == 1 and 1 or 0
local hit = (critical == 0 and glancing == 0 and crushing == 0) and 1 or 0
DB:DamageDone(srcName, AAttack, hit, critical, 0, 0, 0, 0, amount, glancing, 0)
DB:DamageTaken(dstName, AAttack, hit, critical, 0, 0, 0, 0, amount, srcName, crushing, 0)
DB:EnemyDamage(1, DPSMateEDT, dstName, AAttack, hit, critical, 0, 0, 0, 0, amount, srcName, 0, crushing)
DB:EnemyDamage(2, DPSMateEDD, srcName, AAttack, hit, critical, 0, 0, 0, 0, amount, dstName, 0, 0)
DB:DeathHistory(dstName, srcName, AAttack, amount, hit, critical, "hit", crushing)
elseif sub == "SWING_MISSED" then
local missType = arg6
local miss = (missType == "MISS") and 1 or 0
local parry = (missType == "PARRY") and 1 or 0
local dodge = (missType == "DODGE") and 1 or 0
local resist = (missType == "RESIST" or missType == "IMMUNE") and 1 or 0
local block = (missType == "BLOCK") and 1 or 0
local absorb = (missType == "ABSORB") and 1 or 0
DB:DamageDone(srcName, AAttack, 0, 0, miss + absorb, parry, dodge, resist, 0, 0, block)
DB:DamageTaken(dstName, AAttack, 0, 0, miss + absorb, parry, dodge, resist, 0, srcName, 0, block)
elseif sub == "SPELL_DAMAGE" or sub == "RANGE_DAMAGE" or sub == "SPELL_PERIODIC_DAMAGE"
or sub == "DAMAGE_SHIELD" or sub == "DAMAGE_SPLIT" then
local spellName = arg7 or "Unknown"
local amount = arg9 or 0
local school = arg11
local critical = arg15 == 1 and 1 or 0
local glancing = arg16 == 1 and 1 or 0
local crushing = arg17 == 1 and 1 or 0
local hit = (critical == 0 and glancing == 0 and crushing == 0) and 1 or 0
DB:DamageDone(srcName, spellName, hit, critical, 0, 0, 0, 0, amount, glancing, 0)
DB:DamageTaken(dstName, spellName, hit, critical, 0, 0, 0, 0, amount, srcName, crushing, 0)
DB:EnemyDamage(1, DPSMateEDT, dstName, spellName, hit, critical, 0, 0, 0, 0, amount, srcName, 0, crushing)
DB:EnemyDamage(2, DPSMateEDD, srcName, spellName, hit, critical, 0, 0, 0, 0, amount, dstName, 0, 0)
DB:DeathHistory(dstName, srcName, spellName, amount, hit, critical, "hit", crushing)
if school then DB:AddSpellSchool(spellName, school) end
elseif sub == "SPELL_MISSED" or sub == "RANGE_MISSED"
or sub == "SPELL_PERIODIC_MISSED" or sub == "DAMAGE_SHIELD_MISSED" then
local spellName = arg7 or "Unknown"
local missType = arg9
local miss = (missType == "MISS") and 1 or 0
local parry = (missType == "PARRY") and 1 or 0
local dodge = (missType == "DODGE") and 1 or 0
local resist = (missType == "RESIST" or missType == "IMMUNE") and 1 or 0
local block = (missType == "BLOCK") and 1 or 0
local absorb = (missType == "ABSORB") and 1 or 0
DB:DamageDone(srcName, spellName, 0, 0, miss + absorb, parry, dodge, resist, 0, 0, block)
DB:DamageTaken(dstName, spellName, 0, 0, miss + absorb, parry, dodge, resist, 0, srcName, 0, block)
elseif sub == "ENVIRONMENTAL_DAMAGE" then
local envType = arg6
local amount = arg7 or 0
DB:DamageTaken(dstName, envType or "Environment", 1, 0, 0, 0, 0, 0, amount, envType or "Environment", 0, 0)
DB:DeathHistory(dstName, envType or "Environment", envType or "Environment", amount, 1, 0, "hit", 0)
-- ========================================================================
-- HEAL events
-- ========================================================================
elseif sub == "SPELL_HEAL" or sub == "SPELL_PERIODIC_HEAL" then
local spellName = arg7 or "Unknown"
local amount = arg9 or 0
local overheal = arg10 or 0
local critical = arg12 == 1 and 1 or 0
local hit = critical == 0 and 1 or 0
local effective = amount - overheal
if effective < 0 then effective = 0 end
DB:Healing(1, DPSMateHealingTaken, srcName, spellName, hit, critical, effective)
DB:Healing(2, DPSMateOverhealing, srcName, spellName, hit, critical, overheal)
DB:HealingTaken(1, DPSMateHealingTaken, srcName, spellName, hit, critical, effective, dstName)
DB:DeathHistory(dstName, srcName, spellName, effective, hit, critical, "heal", 0)
-- ========================================================================
-- AURA events
-- ========================================================================
elseif sub == "SPELL_AURA_APPLIED" then
local spellName = arg7 or "Unknown"
local auraType = arg9
if auraType == "DEBUFF" then
DB:BuildBuffs(srcName, dstName, spellName, false)
if Parser.CC[spellName] then
DB:BuildActiveCC(dstName, spellName)
end
else
DB:BuildBuffs(srcName, dstName, spellName, true)
end
elseif sub == "SPELL_AURA_REMOVED" then
local spellName = arg7 or "Unknown"
DB:DestroyBuffs(dstName, spellName)
local auraType = arg9
if auraType == "DEBUFF" then
DB:RemoveActiveCC(dstName, spellName)
end
elseif sub == "SPELL_AURA_BROKEN_SPELL" or sub == "SPELL_AURA_BROKEN" then
local spellName = arg7 or "Unknown"
DB:RemoveActiveCC(dstName, spellName)
if Parser.CC[spellName] then
DB:CCBreaker(dstName, spellName, srcName)
end
-- ========================================================================
-- CAST events
-- ========================================================================
elseif sub == "SPELL_CAST_SUCCESS" then
local spellName = arg7 or "Unknown"
if Parser.Kicks and Parser.Kicks[spellName] then
DB:RegisterPotentialKick(srcName, spellName, GT())
end
-- ========================================================================
-- INTERRUPT / DISPEL events
-- ========================================================================
elseif sub == "SPELL_INTERRUPT" then
local spellName = arg7 or "Unknown"
local extraSpellName = arg10 or "Unknown"
DB:Kick(srcName, dstName, spellName, extraSpellName)
elseif sub == "SPELL_DISPEL" then
local spellName = arg7 or "Unknown"
local extraSpellName = arg10 or "Unknown"
if isGroupMember(srcName) then
DB:Dispels(srcName, spellName, dstName, extraSpellName)
end
-- ========================================================================
-- DEATH events
-- ========================================================================
elseif sub == "UNIT_DIED" or sub == "UNIT_DESTROYED" then
DB:UnregisterDeath(dstName)
elseif sub == "SPELL_SUMMON" then
local spellName = arg7 or "Unknown"
if not Parser.petToOwnerMap then Parser.petToOwnerMap = {} end
if not Parser.petToOwnerMap[dstName] then Parser.petToOwnerMap[dstName] = {} end
Parser.petToOwnerMap[dstName][srcName] = true
end
end)
-- ============================================================================
-- Performance profiling
-- ============================================================================
@@ -441,6 +273,10 @@ cleuFrame:SetScript("OnEvent", function()
end)
-- The actual CLEU handler (extracted so we can call it directly or measured)
local ShieldFlags = DB.ShieldFlags
local FailDT = DPSMate.Parser.FailDT
local FailDB = DPSMate.Parser.FailDB
cleuHandler = function()
local sub = arg1
if not sub then return end
@@ -453,17 +289,30 @@ cleuHandler = function()
if not srcName or srcName == "" then srcName = "Unknown" end
if not dstName or dstName == "" then dstName = "Unknown" end
-- ========================================================================
-- DAMAGE events
-- ========================================================================
-- SWING_DAMAGE args: amount(6), overkill(7), school(8), resisted(9),
-- blocked(10), absorbed(11), critical(12), glancing(13), crushing(14)
if sub == "SWING_DAMAGE" then
local amount = arg6 or 0
local absorbed = arg11 or 0
local critical = arg12 == 1 and 1 or 0
local glancing = arg13 == 1 and 1 or 0
local crushing = arg14 == 1 and 1 or 0
local hit = (critical == 0 and glancing == 0 and crushing == 0) and 1 or 0
DB:DamageDone(srcName, AAttack, hit, critical, 0, 0, 0, 0, amount, glancing, 0)
DB:DamageTaken(dstName, AAttack, hit, critical, 0, 0, 0, 0, amount, srcName, crushing, 0)
DB:EnemyDamage(1, DPSMateEDT, dstName, AAttack, hit, critical, 0, 0, 0, 0, amount, srcName, 0, crushing)
DB:EnemyDamage(2, DPSMateEDD, srcName, AAttack, hit, critical, 0, 0, 0, 0, amount, dstName, 0, 0)
DB:DeathHistory(dstName, srcName, AAttack, amount, hit, critical, "hit", crushing)
-- Partial absorb on a hit
if absorbed > 0 then
DB:SetUnregisterVariables(absorbed, AAttack, srcName)
DB:Absorb(AAttack, dstName, srcName)
end
elseif sub == "SWING_MISSED" then
local missType = arg6
@@ -473,24 +322,44 @@ cleuHandler = function()
local resist = (missType == "RESIST" or missType == "IMMUNE") and 1 or 0
local block = (missType == "BLOCK") and 1 or 0
local absorb = (missType == "ABSORB") and 1 or 0
DB:DamageDone(srcName, AAttack, 0, 0, miss + absorb, parry, dodge, resist, 0, 0, block)
DB:DamageTaken(dstName, AAttack, 0, 0, miss + absorb, parry, dodge, resist, 0, srcName, 0, block)
-- Full absorb
if absorb == 1 then
DB:Absorb(AAttack, dstName, srcName)
end
-- SPELL_DAMAGE args (after prefix): amount(9), overkill(10), school(11),
-- resisted(12), blocked(13), absorbed(14), critical(15), glancing(16), crushing(17)
elseif sub == "SPELL_DAMAGE" or sub == "RANGE_DAMAGE" or sub == "SPELL_PERIODIC_DAMAGE"
or sub == "DAMAGE_SHIELD" or sub == "DAMAGE_SPLIT" then
local spellName = arg7 or "Unknown"
local amount = arg9 or 0
local school = arg11
local absorbed = arg14 or 0
local critical = arg15 == 1 and 1 or 0
local glancing = arg16 == 1 and 1 or 0
local crushing = arg17 == 1 and 1 or 0
local hit = (critical == 0 and glancing == 0 and crushing == 0) and 1 or 0
DB:DamageDone(srcName, spellName, hit, critical, 0, 0, 0, 0, amount, glancing, 0)
DB:DamageTaken(dstName, spellName, hit, critical, 0, 0, 0, 0, amount, srcName, crushing, 0)
DB:EnemyDamage(1, DPSMateEDT, dstName, spellName, hit, critical, 0, 0, 0, 0, amount, srcName, 0, crushing)
DB:EnemyDamage(2, DPSMateEDD, srcName, spellName, hit, critical, 0, 0, 0, 0, amount, dstName, 0, 0)
DB:DeathHistory(dstName, srcName, spellName, amount, hit, critical, "hit", crushing)
if school then DB:AddSpellSchool(spellName, school) end
local abilityName = (sub == "SPELL_PERIODIC_DAMAGE") and (spellName .. "(Periodic)") or spellName
DB:DamageDone(srcName, abilityName, hit, critical, 0, 0, 0, 0, amount, glancing, 0)
DB:DamageTaken(dstName, abilityName, hit, critical, 0, 0, 0, 0, amount, srcName, crushing, 0)
DB:EnemyDamage(1, DPSMateEDT, dstName, abilityName, hit, critical, 0, 0, 0, 0, amount, srcName, 0, crushing)
DB:EnemyDamage(2, DPSMateEDD, srcName, abilityName, hit, critical, 0, 0, 0, 0, amount, dstName, 0, 0)
DB:DeathHistory(dstName, srcName, abilityName, amount, hit, critical, "hit", crushing)
if school then DB:AddSpellSchool(abilityName, school) end
-- Partial absorb on a hit
if absorbed > 0 then
DB:SetUnregisterVariables(absorbed, abilityName, srcName)
DB:Absorb(abilityName, dstName, srcName)
end
-- Avoidable damage taken (fire, void zones, etc.)
if FailDT and FailDT[spellName] then
DB:BuildFail(2, srcName, dstName, abilityName, amount)
end
elseif sub == "SPELL_MISSED" or sub == "RANGE_MISSED"
or sub == "SPELL_PERIODIC_MISSED" or sub == "DAMAGE_SHIELD_MISSED" then
@@ -502,8 +371,15 @@ cleuHandler = function()
local resist = (missType == "RESIST" or missType == "IMMUNE") and 1 or 0
local block = (missType == "BLOCK") and 1 or 0
local absorb = (missType == "ABSORB") and 1 or 0
DB:DamageDone(srcName, spellName, 0, 0, miss + absorb, parry, dodge, resist, 0, 0, block)
DB:DamageTaken(dstName, spellName, 0, 0, miss + absorb, parry, dodge, resist, 0, srcName, 0, block)
local isPeriodic = (sub == "SPELL_PERIODIC_MISSED")
local abilityName = isPeriodic and (spellName .. "(Periodic)") or spellName
DB:DamageDone(srcName, abilityName, 0, 0, miss + absorb, parry, dodge, resist, 0, 0, block)
DB:DamageTaken(dstName, abilityName, 0, 0, miss + absorb, parry, dodge, resist, 0, srcName, 0, block)
-- Full absorb
if absorb == 1 then
DB:Absorb(abilityName, dstName, srcName)
end
elseif sub == "ENVIRONMENTAL_DAMAGE" then
local envType = arg6
@@ -511,6 +387,10 @@ cleuHandler = function()
DB:DamageTaken(dstName, envType or "Environment", 1, 0, 0, 0, 0, 0, amount, envType or "Environment", 0, 0)
DB:DeathHistory(dstName, envType or "Environment", envType or "Environment", amount, 1, 0, "hit", 0)
-- ========================================================================
-- HEAL events
-- ========================================================================
elseif sub == "SPELL_HEAL" or sub == "SPELL_PERIODIC_HEAL" then
local spellName = arg7 or "Unknown"
local amount = arg9 or 0
@@ -519,11 +399,16 @@ cleuHandler = function()
local hit = critical == 0 and 1 or 0
local effective = amount - overheal
if effective < 0 then effective = 0 end
DB:Healing(1, DPSMateHealingTaken, srcName, spellName, hit, critical, effective)
DB:Healing(2, DPSMateOverhealing, srcName, spellName, hit, critical, overheal)
DB:HealingTaken(1, DPSMateHealingTaken, srcName, spellName, hit, critical, effective, dstName)
DB:DeathHistory(dstName, srcName, spellName, effective, hit, critical, "heal", 0)
-- ========================================================================
-- AURA events (+ absorb shield lifecycle)
-- ========================================================================
elseif sub == "SPELL_AURA_APPLIED" then
local spellName = arg7 or "Unknown"
local auraType = arg9
@@ -532,15 +417,29 @@ cleuHandler = function()
if Parser.CC[spellName] then
DB:BuildActiveCC(dstName, spellName)
end
-- Avoidable debuff application
if FailDB and FailDB[spellName] then
DB:BuildFail(3, "Environment", dstName, spellName, 0)
end
else
DB:BuildBuffs(srcName, dstName, spellName, true)
-- Absorb shield applied
if ShieldFlags[spellName] then
DB:ConfirmAbsorbApplication(spellName, dstName, GT())
end
end
elseif sub == "SPELL_AURA_REMOVED" then
local spellName = arg7 or "Unknown"
DB:DestroyBuffs(dstName, spellName)
if arg9 == "DEBUFF" then
local auraType = arg9
if auraType == "DEBUFF" then
DB:RemoveActiveCC(dstName, spellName)
else
-- Absorb shield removed
if ShieldFlags[spellName] then
DB:UnregisterAbsorb(spellName, dstName)
end
end
elseif sub == "SPELL_AURA_BROKEN_SPELL" or sub == "SPELL_AURA_BROKEN" then
@@ -550,11 +449,23 @@ cleuHandler = function()
DB:CCBreaker(dstName, spellName, srcName)
end
-- ========================================================================
-- CAST events
-- ========================================================================
elseif sub == "SPELL_CAST_SUCCESS" then
local spellName = arg7 or "Unknown"
if Parser.Kicks and Parser.Kicks[spellName] then
DB:RegisterPotentialKick(srcName, spellName, GT())
end
-- Shield cast → await confirmation via SPELL_AURA_APPLIED
if ShieldFlags[spellName] then
DB:AwaitingAbsorbConfirmation(srcName, spellName, dstName, GT())
end
-- ========================================================================
-- INTERRUPT / DISPEL events
-- ========================================================================
elseif sub == "SPELL_INTERRUPT" then
local spellName = arg7 or "Unknown"
@@ -568,6 +479,10 @@ cleuHandler = function()
DB:Dispels(srcName, spellName, dstName, extraSpellName)
end
-- ========================================================================
-- DEATH events
-- ========================================================================
elseif sub == "UNIT_DIED" or sub == "UNIT_DESTROYED" then
DB:UnregisterDeath(dstName)