mirror of
https://github.com/brues-code/Vanilla_MikScrollingBattleText.git
synced 2026-10-27 15:10:49 +00:00
Replace Nampower events with ClassicAPI combat log
- Register COMBAT_LOG_EVENT_UNFILTERED and map 20 subevents to MSBT damage/heal/notification data with GUID-based direction - Remove Nampower event layer, NP_* CVars, version check and install prompt - Resolve spell icons through ClassicAPI GetSpellInfo - Keep CHAT_MSG parsing for honor/rep/skill/XP/item/power lines and as fallback until each log event fires - Update README integration docs
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
-------------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------------
|
||||
-- Title: Mik's Scrolling Battle Text
|
||||
-- Author: Mik
|
||||
-- Maintainer: Athene
|
||||
@@ -524,13 +524,6 @@ function MikSBT.Init()
|
||||
-- Register the triggers with the combat event helper.
|
||||
MikSBT.RegisterTriggers();
|
||||
|
||||
-- Enable Nampower CVars for enhanced combat events when available.
|
||||
if MikCEH.hasNampower then
|
||||
pcall(SetCVar, "NP_EnableAutoAttackEvents", "1")
|
||||
pcall(SetCVar, "NP_EnableSpellHealEvents", "1")
|
||||
pcall(SetCVar, "NP_EnableSpellEnergizeEvents", "1")
|
||||
end
|
||||
|
||||
-- Disable or enable the mod depending on the saved setting.
|
||||
MikSBT.SetOptionUserDisabled(MikSBT_Save.UserDisabled)
|
||||
end
|
||||
@@ -1403,7 +1396,7 @@ function MikSBT.UpdateProfiles()
|
||||
end
|
||||
|
||||
if (profile.CreationVersion < 4.6) then
|
||||
-- Add missing incoming evade/reflect event settings (needed for Nampower events).
|
||||
-- Add missing incoming evade/reflect event settings (needed for combat log miss events).
|
||||
local incomingMissEvents = {
|
||||
"MSBT_EVENTTYPE_INCOMING_EVADE",
|
||||
"MSBT_EVENTTYPE_INCOMING_SPELL_EVADE",
|
||||
@@ -1838,12 +1831,9 @@ function MikSBT.AddAnimation(animationEvent)
|
||||
local sid = animationEvent.SpellId
|
||||
if spellIdIconCache[sid] then
|
||||
texture = spellIdIconCache[sid]
|
||||
elseif MikCEH.hasNampower and GetSpellRecField and GetSpellIconTexture then
|
||||
local ok, iconId = pcall(GetSpellRecField, sid, "spellIconID")
|
||||
if ok and iconId then
|
||||
local ok2, tex = pcall(GetSpellIconTexture, iconId)
|
||||
if ok2 and tex then texture = tex; spellIdIconCache[sid] = tex end
|
||||
end
|
||||
elseif GetSpellInfo then
|
||||
local ok, _, _, tex = pcall(GetSpellInfo, sid)
|
||||
if ok and tex then texture = tex; spellIdIconCache[sid] = tex end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1857,14 +1847,11 @@ function MikSBT.AddAnimation(animationEvent)
|
||||
elseif not texture and MikSBT.GetAuraIcon(name) then
|
||||
texture = MikSBT.GetAuraIcon(name)
|
||||
ICON_CACHE[lowerName] = texture
|
||||
elseif not texture and MikCEH.hasNampower and GetSpellIdForName then
|
||||
local ok, sid = pcall(GetSpellIdForName, name)
|
||||
elseif not texture and GetSpellInfo then
|
||||
local ok, sid = pcall(function(n) return select(10, GetSpellInfo(n)) end, name)
|
||||
if ok and sid and sid ~= 0 then
|
||||
local ok2, iconId = pcall(GetSpellRecField, sid, "spellIconID")
|
||||
if ok2 and iconId then
|
||||
local ok3, tex = pcall(GetSpellIconTexture, iconId)
|
||||
if ok3 and tex then texture = tex; ICON_CACHE[lowerName] = tex end
|
||||
end
|
||||
local ok2, _, _, tex = pcall(GetSpellInfo, sid)
|
||||
if ok2 and tex then texture = tex; ICON_CACHE[lowerName] = tex end
|
||||
end
|
||||
elseif not texture then
|
||||
local itemIcon = MikSBT.FindItemIcon(lowerName)
|
||||
|
||||
@@ -64,34 +64,28 @@ Interface/
|
||||
| `/msbt debug` | Toggle debug mode |
|
||||
| `/msbt help` | Show command usage |
|
||||
|
||||
## Nampower Integration
|
||||
## ClassicAPI Combat Log Integration
|
||||
|
||||
When Nampower is detected, MSBT automatically switches from string-based combat log parsing to structured event handling for significantly better performance in heavy combat scenarios (raids, AoE, battlegrounds).
|
||||
MSBT reads structured combat data from ClassicAPI's `COMBAT_LOG_EVENT_UNFILTERED` instead of relying on string-based combat log parsing alone, for significantly better performance in heavy combat scenarios (raids, AoE, battlegrounds).
|
||||
|
||||
### What Changes
|
||||
|
||||
- **Nampower**: Registers for structured events (`SPELL_DAMAGE_EVENT_SELF`, `AUTO_ATTACK_SELF`, `SPELL_HEAL_ON_SELF`, etc.) that provide pre-parsed combat data. Redundant `CHAT_MSG_*` events are unregistered to avoid duplicates. Enables `NP_EnableAutoAttackEvents`, `NP_EnableSpellHealEvents`, and `NP_EnableSpellEnergizeEvents` CVars.
|
||||
- **ClassicAPI combat log**: Registers for the unfiltered combat log (`SPELL_DAMAGE`, `SWING_DAMAGE`, `SPELL_HEAL`, `SPELL_ENERGIZE`, `SPELL_MISSED`, `SPELL_AURA_APPLIED`, `ENVIRONMENTAL_DAMAGE`, `PARTY_KILL`, etc.) which carries pre-parsed amounts, GUIDs, crit flags, miss types and spell info. Redundant `CHAT_MSG_*` events are unregistered to avoid duplicates. No opt-in CVars are needed.
|
||||
- **SpellId icons**: SpellIds from combat log events resolve icons directly through ClassicAPI's `GetSpellInfo`, bypassing Babble-Spell dictionary lookups and tooltip scanning.
|
||||
|
||||
### Removed: SuperWoW / UnitXP SP3
|
||||
### Removed: SuperWoW / UnitXP SP3 / Nampower
|
||||
|
||||
SuperWoW and UnitXP SP3 integration has been removed in favor of ClassicAPI (for spell/item lookups) and Nampower (for structured combat events). GUID and unit-name resolution now go through Nampower APIs, and spell/item icon and name resolution through ClassicAPI.
|
||||
SuperWoW, UnitXP SP3 and Nampower integration has been removed in favor of ClassicAPI (for spell/item lookups, GUIDs and structured combat events). ClassicAPI is a hard dependency (see the `.toc`).
|
||||
|
||||
### Fallback
|
||||
|
||||
When Nampower is not present, the addon falls back to the original string-parsing pipeline with no changes in behavior.
|
||||
|
||||
### Verification
|
||||
|
||||
```lua
|
||||
-- Check detection status in-game:
|
||||
/run MikSBT.Print("NP="..tostring(MikCEH.hasNampower))
|
||||
```
|
||||
`CHAT_MSG_*` parsing stays registered for everything with no combat log equivalent (honor, reputation, skill, XP, item enchantments, some power gains/losses) and as a fallback until each combat log event actually fires.
|
||||
|
||||
## Performance Optimizations
|
||||
|
||||
- **Upvalue caching**: Frequently called standard library functions (`string.find`, `string.gsub`, `table.insert`, `table.getn`, `GetTime`, etc.) are cached as local variables
|
||||
- **Dispatch table**: Combat event routing uses O(1) table lookup instead of an if/elseif chain
|
||||
- **SpellId icon cache**: When spellIds are available (via Nampower/SuperWoW), icons are resolved directly and cached, bypassing Babble-Spell dictionary lookups and tooltip scanning
|
||||
- **SpellId icon cache**: SpellIds from combat log events resolve icons directly through ClassicAPI and are cached, bypassing Babble-Spell dictionary lookups and tooltip scanning
|
||||
- **Event throttling**: UNIT_HEALTH and UNIT_MANA trigger checks are throttled to 150ms intervals
|
||||
- **Table recycling**: `MikTRO` (Table Recycler Object) pools and reuses table allocations to reduce garbage collection pressure
|
||||
|
||||
@@ -108,9 +102,9 @@ When Nampower is not present, the addon falls back to the original string-parsin
|
||||
### Event Processing Pipeline
|
||||
|
||||
```
|
||||
WoW CHAT_MSG_* events (or Nampower structured events)
|
||||
-> MikCEH.OnEvent() / MikCEH.OnNampowerEvent()
|
||||
-> ParseCombatEvents() dispatch table (or Nampower handler)
|
||||
WoW CHAT_MSG_* events (or ClassicAPI COMBAT_LOG_EVENT_UNFILTERED)
|
||||
-> MikCEH.OnEvent() / MikCEH.OnCombatLogEvent()
|
||||
-> ParseCombatEvents() dispatch table (or combat log handler)
|
||||
-> Creates CombatEventData tables
|
||||
-> MikSBT.CombatEventsHandler()
|
||||
-> Formats text with templates (%a=amount, %n=name, %s=spell, %t=type)
|
||||
|
||||
Reference in New Issue
Block a user