mirror of
https://github.com/NovaElysium/CawDPSMeter.git
synced 2026-11-16 16:10:37 +00:00
With the DPSLog Community Edition installed, a native COMBAT_LOG_EVENT_UNFILTERED fired by another addon or client mod was read as an "unsupported header" and, if it arrived during the start-up probe, dropped the whole session to combat text so DPSLog did nothing (community reports from Icekronik and Taroven). Caw now takes DPSLog events only through its DpsLogPopEvent polling channel and ignores unrelated native combat-log events; older DLLs without polling still use the native event. The one-time rejected-event chat warning is removed; counts remain under /cawinput. Adds a regression test for both producer paths. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1082 lines
78 KiB
Lua
1082 lines
78 KiB
Lua
local D=CAW_DPS_METER
|
|
local count=0
|
|
local function check(ok,name) assert(ok,name); count=count+1; print("PASS "..name) end
|
|
fire(D.diagBootstrapFrame,"ADDON_LOADED","CawDPSMeter")
|
|
fire(D.events,"ADDON_LOADED","CawDPSMeter")
|
|
fire(D.events,"PLAYER_ENTERING_WORLD")
|
|
local function fresh()
|
|
SlashCmdList.CAWDPS("reset")
|
|
D.lastFinalizeAt=0; NOW=NOW+10; PLAYER_COMBAT=true
|
|
end
|
|
fresh()
|
|
D.threatOnCast("0x99","0xF1","CAST",2649)
|
|
check(not D.inCombat,"outsider cannot open segment")
|
|
D.threatOnCast("0x2","0xF1","FAIL",2649)
|
|
check(not D.inCombat,"failed growl cannot open segment")
|
|
D.threatOnCast("0x2","0xF1","CAST",2649)
|
|
check(D.inCombat and (not D.actors["0x2"] or not D.actors["0x2"].threat),"growl waits for RAW success")
|
|
D.threatOnSpellLanded("0x2","0xF1","Growl")
|
|
D.threatOnSpellLanded("0x2","0xF1","Growl")
|
|
check(D.actors["0x2"].threat["0xF1"]==50,"growl success counted once")
|
|
check(D.actors["0x1"]~=nil,"pet creates owner actor")
|
|
NOW=NOW+3; D.threatPrunePending()
|
|
check(next(D.threatPendingCast)==nil,"expired pending casts removed")
|
|
D.threatOnCast("0x2","0xF1","CAST",99999)
|
|
check(next(D.threatPendingCast)==nil,"irrelevant casts not retained")
|
|
fresh()
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_COMBAT_SELF_HITS","You hit 0xF1 for 10.")
|
|
check(D.currentEnemyDamage["0xF1"]==10 and D.currentEnemyBestGuid=="0xF1","first RAW target survives segment reset")
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_COMBAT_SELF_HITS","You hit Other for 15.")
|
|
check(D.actors["0x1"].damage==25 and D.actors["0x1"].threat["0xF1"]==10,"unknown target does not reuse previous threat target")
|
|
local v=D.createMultiWindow(nil)
|
|
v.mode="damage"; v.segment="overall"; D.updateMultiWindow(v)
|
|
check((v.modeText.text=="Damage / DPS" or v.modeText.text=="DPS") and v.modeButton.cawMenuLabel=="Damage / DPS"
|
|
and v.segmentText.text=="Overall","extra labels update without resize and preserve full mode tooltip")
|
|
local a={buffs={Renew={total=120,targets={x=120},active={}}}}
|
|
check(string.find(D.multiReportTotalLine({mode="buffs"},{{actor=a,value=1}},1,120),"120.0s",1,true),"aura total reports seconds")
|
|
a.name="Test"; D.lastDuration=10
|
|
check(string.find(D.multiReportLine({mode="buffs"},{actor=a,value=1},1,120),"100.0%",1,true),"extra aura report uses its own duration")
|
|
-- Bounded UI pool, including menu callbacks and closed-row references.
|
|
local oldFrame=v.frame
|
|
D.removeMultiWindow(v)
|
|
local allocated=table.getn(FRAMES)
|
|
for i=1,50 do local w=D.createMultiWindow(nil); assert(w.frame==oldFrame,"reuse window "..i); D.removeMultiWindow(w) end
|
|
check(true,"50 create/close cycles reuse the same window")
|
|
check(table.getn(FRAMES)==allocated,"create/close does not allocate more frames")
|
|
check(oldFrame.scripts.OnUpdate==nil and v.rows[1].actor==nil,"closed windows stop ticking and release actors")
|
|
CawDPSMeterDB.windowSettingsVersion=nil; CawDPSMeterCharDB.windowSettingsVersion=nil
|
|
CawDPSMeterCharDB.extraWindowsExplicit=nil; CawDPSMeterCharDB.extraWindows={}; CawDPSMeterCharDB.extraWindowCount=0
|
|
CawDPSMeterDB.extraWindowsExplicit=true; CawDPSMeterDB.extraWindowCount=1; CawDPSMeterDB.extraWindows={{mode="damage"}}
|
|
D.multiWindowsRestored=false; D.restoreMultiWindows()
|
|
check(CawDPSMeterCharDB.extraWindowCount==0 and not D.multiWindows[2],"legacy character zero wins over account v3")
|
|
-- Name matching includes identities with no local damage/threat events.
|
|
D.actors={a={name="Wolf",guid="0x2",threat={['0xF1']=50}}}
|
|
D.guidToActor.other={name="Wolf",guid="0x3",key="0x3",isPet=true}
|
|
local match,matches,ambiguous=D.threatCalActorByName("Wolf","0xF1")
|
|
check(match==nil and matches==2 and ambiguous,"missing same-name pet remains ambiguous")
|
|
D.guidToActor.other=nil
|
|
-- Complete scans remove stale entries, failed scans preserve them.
|
|
D.activeRosterBuffs['0x3|Renew']={target="0x3",spell="Renew"}
|
|
D.scanUnitBuffs("party1","0x3")
|
|
check(D.activeRosterBuffs['0x3|Renew']==nil,"group scan removes stale aura")
|
|
D.activeRosterBuffs['0x3|Renew']={target="0x3",spell="Renew"}
|
|
UnitBuff=function() error("unavailable") end
|
|
D.scanUnitBuffs("party1","0x3")
|
|
check(D.activeRosterBuffs['0x3|Renew']~=nil,"failed scan preserves last known aura")
|
|
UnitBuff=function() end
|
|
do
|
|
local oldInfo,oldBuff,oldEnchant=GetSpellInfo,UnitBuff,GetWeaponEnchantInfo
|
|
local oldTooltip,oldLine=D.buffScanTooltip,CawDPSMeterBuffScanTooltipTextLeft1
|
|
local oldRosterBuffs=D.activeRosterBuffs
|
|
local names,lookups,tooltipReads={},0,0
|
|
for i=1,12 do names[97000+i]=D.buffSpellNames[97000+i]; D.buffSpellNames[97000+i]=nil end
|
|
D.buffScanTooltip={ClearLines=function() end,SetUnitBuff=function() tooltipReads=tooltipReads+1 end}
|
|
CawDPSMeterBuffScanTooltipTextLeft1={GetText=function() return 'Tooltip fallback' end}
|
|
GetSpellInfo=function(id) lookups=lookups+1; return 'Combat buff '..(id-97000) end
|
|
GetWeaponEnchantInfo=function() end
|
|
UnitBuff=function(unit,i) if unit=='player' and i<=12 then return 'texture',1,97000+i end end
|
|
D.activeRosterBuffs={}; fresh(); fire(D.events,'PLAYER_REGEN_DISABLED')
|
|
check(lookups==12 and tooltipReads==0,'combat-start buff names use the available spell API without hidden tooltip builds')
|
|
local own=D.actors[D.selfKey]
|
|
check(own and own.buffs['Combat buff 1'] and own.buffs['Combat buff 12'],
|
|
'all opening buffs are recorded immediately with native spell names')
|
|
fresh(); fire(D.events,'PLAYER_REGEN_DISABLED')
|
|
check(lookups==12 and tooltipReads==0,'later combat starts reuse resolved buff names')
|
|
for _,failure in ipairs({'missing','error','empty','wrong-type'}) do
|
|
D.buffSpellNames[97001]=nil
|
|
if failure=='missing' then GetSpellInfo=nil
|
|
elseif failure=='error' then GetSpellInfo=function() error('unavailable') end
|
|
elseif failure=='empty' then GetSpellInfo=function() return '' end
|
|
else GetSpellInfo=function() return {} end end
|
|
local before=tooltipReads
|
|
check(D.getUnitBuffName('player',1,97001)=='Tooltip fallback' and tooltipReads==before+1,
|
|
'buff tooltip fallback survives '..failure..' spell API')
|
|
end
|
|
for i=1,12 do D.buffSpellNames[97000+i]=names[97000+i] end
|
|
GetSpellInfo,UnitBuff,GetWeaponEnchantInfo=oldInfo,oldBuff,oldEnchant
|
|
D.buffScanTooltip=oldTooltip; CawDPSMeterBuffScanTooltipTextLeft1=oldLine
|
|
D.activeRosterBuffs=oldRosterBuffs
|
|
end
|
|
fresh()
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_COMBAT_SELF_HITS","You hit 0xF1 for 10.")
|
|
D.threatOnCast("0x1",nil,"FAIL",5384)
|
|
check(D.actors['0x1'].threat['0xF1']==10,"FD failure does not erase threat")
|
|
D.threatOnCast("0x1",nil,"CAST",5384)
|
|
check(D.actors['0x1'].threat['0xF1']==0,"completed FD cast resets without RAW success")
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_SELF_BUFF","You cast Feign Death.")
|
|
check(D.actors['0x1'].threat['0xF1']==0,"FD RAW success resets threat")
|
|
fresh()
|
|
PARTY_COUNT=1; UNITS.party1={guid="0x3",name="Friend",class="HUNTER"}
|
|
fire(D.events,"PARTY_MEMBERS_CHANGED")
|
|
D.threatOnCast("0x3","0xF1","CAST",20736)
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE","0x3 casts Distracting Shot on 0xF1.")
|
|
check(D.actors['0x3'].threat['0xF1']==220,"group flat success creates actor and commits rank")
|
|
-- Enemy cast completed before Earth Shock: no ghost interrupt.
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE","0xF1 begins to cast Bolt.")
|
|
fire(D.events,"UNIT_CASTEVENT","0xF1","0x1","CAST",100)
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_SELF_DAMAGE","Your Earth Shock hits 0xF1 for 10.")
|
|
check(next(D.actors['0x1'].interrupts)==nil,"completed cast is not interrupted later")
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE","0xF1 begins to cast Bolt.")
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_SELF_DAMAGE","Your Kick misses 0xF1.")
|
|
check(D.activeEnemyCasts['0xF1']~=nil,"failed interrupt preserves enemy cast")
|
|
-- RavenCraft emits UNIT_CASTEVENT FAIL for an interrupted cast in the same
|
|
-- frame as the player's damaging Kick. The short deferred cleanup must let
|
|
-- the hit correlate to the failed enemy cast and count exactly one interrupt.
|
|
PARTY_COUNT=1; UNITS.party1={guid="0x3",name="Friend",class="ROGUE"}
|
|
fire(D.events,"PARTY_MEMBERS_CHANGED")
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE","0xF1 begins to cast Bolt.")
|
|
fire(D.events,"UNIT_CASTEVENT","0xF1","0x1","FAIL",100)
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE","0x3's Kick hits 0xF1 for 10.")
|
|
check(D.actors['0x3'].interrupts.Bolt.count==1,"UNIT_CASTEVENT FAIL keeps same-frame interrupt")
|
|
fresh()
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE","0xF1 begins to cast Bolt.")
|
|
fire(D.events,"UNIT_CASTEVENT","0xF1","0x1","FAIL",100)
|
|
NOW=NOW+1
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE","0x3's Kick hits 0xF1 for 10.")
|
|
check(next(D.actors['0x3'].interrupts)==nil,"expired failed cast does not create ghost interrupt")
|
|
-- Ordinary stun expiration is not a damage break.
|
|
D.activeCC['0xF1']={spell="Hammer of Justice",time=NOW,sourceKey="0x1"}
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_COMBAT_SELF_HITS","You hit 0xF1 for 5.")
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_AURA_GONE_OTHER","Hammer of Justice fades from 0xF1.")
|
|
check(next(D.actors['0x1'].ccBreaks)==nil,"normal stun expiration is not a CC break")
|
|
-- Summons survive refresh without retaining unrelated outsiders.
|
|
D.pendingSelfTotem={name="Searing Totem",time=NOW}
|
|
D.tryClaimSelfTotemSource("0xF9","Searing Bolt","CHAT_MSG_SPELL_PET_DAMAGE")
|
|
fire(D.events,"PARTY_MEMBERS_CHANGED")
|
|
check(D.guidToActor['0xF9'] and D.guidToActor['0xF9'].ownerKey=='0x1',"totem identity survives roster refresh")
|
|
-- Late snapshot cannot mutate a committed current segment.
|
|
D.syncNonce="test"; D.syncSelectedSource="Friend"
|
|
fire(D.events,"PLAYER_REGEN_ENABLED")
|
|
NOW=NOW+2; PLAYER_COMBAT=false; this=D.events; D.events.scripts.OnUpdate()
|
|
local before=D.actors['0x1'].damage
|
|
fire(D.events,"CHAT_MSG_ADDON",D.syncPrefix,"H~test~100~0xF1~Mob~0xF1","PARTY","Friend")
|
|
fire(D.events,"CHAT_MSG_ADDON",D.syncPrefix,"A~test~0x1~Hunter~0x1~~0~HUNTER~999~0~1~0~0~0","PARTY","Friend")
|
|
fire(D.events,"CHAT_MSG_ADDON",D.syncPrefix,"D~test~0x1~Melee~999~1~0","PARTY","Friend")
|
|
fire(D.events,"CHAT_MSG_ADDON",D.syncPrefix,"Z~test","PARTY","Friend")
|
|
check(D.actors['0x1'].damage==before and D.syncNonce==nil,"late sync rejected after commit")
|
|
check(not D.syncEnemyCompatible('0xF8') and D.syncEnemyCompatible('0xF1'),"sync requires known shared enemy")
|
|
-- Diagnostics keeps different contexts and sessions separate.
|
|
CawDPSMeterErrorLog.entries={}
|
|
D.diagWarn('API_TIMEOUT','timeout','A'); D.diagWarn('API_TIMEOUT','timeout','B')
|
|
check(table.getn(CawDPSMeterErrorLog.entries)==2,"diagnostics preserves different contexts")
|
|
D.diagWarn('API_TIMEOUT','timeout','B')
|
|
check(CawDPSMeterErrorLog.entries[2].count==2,"same diagnostic context still deduplicates")
|
|
NOW=NOW-20; D.diagWarn('API_TIMEOUT','timeout','B')
|
|
check(table.getn(CawDPSMeterErrorLog.entries)==3,"negative time difference not deduplicated")
|
|
-- Calibration timeout keeps server rows but removes unsafe target/diff claims.
|
|
D.threatCalEnabled=true; D.threatCalNewSession(); D.threatCalPendingRequests={}
|
|
D.threatCalQueueRequest('0xF1','Mob','elite','PARTY'); NOW=NOW+2; D.threatCalSendRequest()
|
|
check(D.threatCalAttributionUncertain,"timeout marks attribution uncertain")
|
|
D.threatCalQueueRequest('0xF8','Other','elite','PARTY')
|
|
D.threatCalRecordSnapshot('TWTv4=Hunter:1:100:100:1','server','PARTY','server')
|
|
local snap=D.threatCalSession.snapshots[1]
|
|
check(snap and snap.targetGuid==nil and snap.requestTargetGuid=='0xF8' and snap.rows[1].diff==nil,"late-risk response cannot claim new target or precise diff")
|
|
-- Hypothetical Lua 5.0 upvalue regression in the large event closure.
|
|
check(debug.getinfo(D.events.scripts.OnEvent).nups<=32,"event closure stays within 32 upvalues")
|
|
D.threatCalEnabled=false
|
|
fresh()
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_CUSTOM_DAMAGE","unrecognized test damage")
|
|
check(D.rawUnknownCount>0,"unknown RAW lines reach diagnostic ring")
|
|
D.mode="damage"; D.segment="current"
|
|
local w=D.createMultiWindow(nil); w.mode="healing"; w.segment="overall"
|
|
w.rows[1].actor={name="Test"}; this=w.rows[1].bar
|
|
local original=D.actorTooltipOnEnter; D.actorTooltipOnEnter=function() error("injected tooltip failure") end
|
|
local ok=pcall(this.scripts.OnEnter)
|
|
check(not ok and D.mode=="damage" and D.segment=="current" and this.detailsRow==nil,"tooltip exception restores primary view context")
|
|
D.actorTooltipOnEnter=original
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE","0xF1 begins to cast Bolt.")
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE","0x3's Kick hits 0xF1 for 10.")
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE","0x3's Kick interrupts 0xF1's Bolt.")
|
|
check(D.actors['0x3'].interrupts.Bolt.count==1,"explicit interrupt and hit heuristic counted once")
|
|
local rogue={guid='0x4',classToken='ROGUE'}
|
|
check(D.threatGlobalModifier(rogue)==0.8,"known rogue modifier applies remotely")
|
|
D.deadEnemies['0xF1']=true; D.currentEnemyBestGuid='0xF1'
|
|
D.threatOnHealing(rogue,100,'Heal')
|
|
check(not rogue.threat,"healing does not add threat to dead dominant target")
|
|
-- Historical target and reference are independent of today's target/actors.
|
|
D.fightHistory={{enemyGuid='0xFA',enemyName='Old Mob',actors={one={threat={['0xFA']=200}}}}}
|
|
D.segment='history'; D.segmentIndex=1
|
|
check(D.threatDisplayTargetGUID()=='0xFA' and D.threatDisplayTargetName()=='Old Mob' and D.threatTopForDisplay()==200,"history threat uses historical target and reference")
|
|
fresh()
|
|
fire(D.events,"RAW_COMBATLOG","CHAT_MSG_COMBAT_SELF_HITS","You hit 0xF1 for 10.")
|
|
D.syncNonce="valid"; D.syncSelectedSource="Friend"
|
|
fire(D.events,"CHAT_MSG_ADDON",D.syncPrefix,"H~valid~100~0xF1~Mob~0xF1","PARTY","Friend")
|
|
fire(D.events,"CHAT_MSG_ADDON",D.syncPrefix,"A~valid~0x1~Hunter~0x1~~0~HUNTER~100~0~1~0~0~0","PARTY","Friend")
|
|
fire(D.events,"CHAT_MSG_ADDON",D.syncPrefix,"D~valid~0x1~Melee~100~1~0","PARTY","Friend")
|
|
fire(D.events,"CHAT_MSG_ADDON",D.syncPrefix,"Z~valid","PARTY","Friend")
|
|
check(D.actors['0x1'].damage==100,"valid current snapshot still merges")
|
|
D.threatCalEnabled=true; D.threatCalNewSession()
|
|
local resetActor={guid='0x1',name='Hunter',threat={['0xF1']=100,['0xF2']=200}}
|
|
D.threatResetActor(resetActor,'Feign Death')
|
|
local events=D.threatCalSession.events
|
|
check(table.getn(events)==2 and events[1].delta<0 and events[2].delta<0 and events[1].kind=='reset',"calibration preserves per-target reset deltas")
|
|
D.threatCalEnabled=false
|
|
CawDPSMeterDB.savedVariablesCleanupVersion=nil
|
|
CawDPSMeterLog={old=true}
|
|
CawThreatCalibrationDB.sessions={{events={}},{requests=1},{events={{kind='reset'}}}}
|
|
D.cleanupLegacySavedVariables()
|
|
check(CawDPSMeterLog==nil and table.getn(CawThreatCalibrationDB.sessions)==2,"cleanup retains request-only and captured sessions")
|
|
CawDPSMeterLog={fresh=true}; D.cleanupLegacySavedVariables()
|
|
check(CawDPSMeterLog.fresh,"repeat cleanup preserves newly captured developer logs")
|
|
check(upvalue(SlashCmdList.CAWDPSDEBUG,'oldDebug')~=nil and pcall(SlashCmdList.CAWDPSDEBUG,''),"no-argument debug retains original handler")
|
|
D.threatCalEnabled=false; CawDPSMeterCharDB.threatCalAutoStart=nil
|
|
fire(D.threatCalFrame,'PLAYER_ENTERING_WORLD')
|
|
check(D.threatCalEnabled and CawDPSMeterCharDB.threatCalAutoStart,"calibration starts automatically by default")
|
|
local autoSession=D.threatCalSession
|
|
fire(D.threatCalFrame,'PLAYER_ENTERING_WORLD')
|
|
check(D.threatCalSession==autoSession,"zone transitions do not restart calibration")
|
|
fire(D.threatCalFrame,'PLAYER_LOGOUT')
|
|
check(autoSession.stopReason=='logout' and autoSession.endedAt~=nil,"automatic session closes at logout")
|
|
SlashCmdList.CAWDPSTHREATCAL('off')
|
|
fire(D.threatCalFrame,'PLAYER_ENTERING_WORLD')
|
|
check(not D.threatCalEnabled and CawDPSMeterCharDB.threatCalAutoStart==false,"explicit off disables future automatic starts")
|
|
SlashCmdList.CAWDPSTHREATCAL('on')
|
|
check(D.threatCalEnabled and CawDPSMeterCharDB.threatCalAutoStart,"manual on restores automatic startup")
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 10.')
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_SELF_BUFF','You gain Feign Death.')
|
|
check(D.actors['0x1'].threat['0xF1']==10,'early FD success waits for matching cast')
|
|
NOW=NOW+0.1; D.threatOnCast('0x1',nil,'CAST',5384)
|
|
check(D.actors['0x1'].threat['0xF1']==0,'FD success before CAST resets threat')
|
|
D.actors['0x1'].threat['0xF1']=5
|
|
D.threatOnFeignSuccess('0x1'); D.threatOnCast('0x1',nil,'CAST',5384)
|
|
check(D.actors['0x1'].threat['0xF1']==5,'duplicate FD notifications do not erase new damage')
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 10.')
|
|
D.threatOnFeignSuccess('0x1'); D.threatOnCast('0x1',nil,'FAIL',5384)
|
|
NOW=NOW+0.1; D.threatOnCast('0x1',nil,'CAST',5384)
|
|
check(D.actors['0x1'].threat['0xF1']==0,'new completed FD after an earlier FAIL can succeed')
|
|
D.threatCalNewSession(); D.threatCalEnabled=true
|
|
D.threatCalRecordCast('0x1','0xF1','MAINHAND',6603)
|
|
check(table.getn(D.threatCalSession.casts)==0 and D.threatCalSession.filteredSwings==1,'auto swings use counters instead of cast budget')
|
|
D.threatCalRecordCast('0x1',nil,'CAST',5384)
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_SELF_BUFF','You gain Feign Death.')
|
|
check(table.getn(D.threatCalSession.feignRaw)==2,'FD original CAST and RAW recorded automatically')
|
|
local oldLimit=D.threatCalMaxCasts; D.threatCalMaxCasts=1
|
|
local oldDiag=D.diagCal; local limitWarnings=0
|
|
D.diagCal=function() limitWarnings=limitWarnings+1 end
|
|
D.threatCalRecordCast('0x1',nil,'CAST',75); D.threatCalRecordCast('0x1',nil,'CAST',75)
|
|
check(D.threatCalSession.droppedCasts==2 and limitWarnings==1,'cast cap warns once and retains drop count')
|
|
D.threatCalMaxCasts=oldLimit; D.diagCal=oldDiag
|
|
D.threatCalPendingRequests={}; D.threatCalTimeoutStreak=0
|
|
D.threatCalQueueRequest('0xF1','Mob','elite','PARTY'); NOW=NOW+2
|
|
D.threatCalSendRequest()
|
|
NOW=NOW+1
|
|
local sent,reason=D.threatCalSendRequest()
|
|
check(not sent and reason=='timeout backoff','API timeout suppresses immediate retry')
|
|
local n=table.getn(D.threatCalSession.transport)
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','unrelated','private unrelated addon payload','PARTY','Friend')
|
|
check(table.getn(D.threatCalSession.transport)==n,'transport trace excludes unrelated addon payloads')
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT_SERVER','TWTv3=unknown format','PARTY','server')
|
|
check(table.getn(D.threatCalSession.transport)==n+1,'alternate TWT response retained for diagnosis')
|
|
local i; for i=1,250 do D.threatCalTrace('transport',{kind='test'}) end
|
|
check(table.getn(D.threatCalSession.transport)==200 and D.threatCalSession.transportDropped>0,'transport trace bounded to 200 records')
|
|
D.threatCalNewSession(); D.threatCalPendingRequests={}; D.threatCalLastPayload=nil
|
|
local originalLoaded=IsAddOnLoaded
|
|
IsAddOnLoaded=function(name) return name=='TWThreat' end
|
|
local sent,reason=D.threatCalSendRequest()
|
|
check(not sent and reason=='parallel TWThreat: API sampling paused','TWThreat owns requests in passive mode')
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','server','TWTv4=Hunter:1:123:100:1','WHISPER','server')
|
|
local passive=D.threatCalSession.snapshots[1]
|
|
check(passive and passive.captureMode=='passive' and passive.rows[1].server==123 and passive.targetGuid==nil and passive.rows[1].diff==nil,'passive server rows retained without invented target or diff')
|
|
IsAddOnLoaded=originalLoaded
|
|
D.threatCalQueueRequest('0xF1','Mob','elite','PARTY')
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','server','TWTv4=Hunter:1:124:100:1','WHISPER','server')
|
|
local mismatch=D.threatCalSession.snapshots[2]
|
|
check(mismatch and mismatch.channelMismatch and mismatch.rows[1].server==124 and mismatch.rows[1].diff==nil,'different response channel retains uncertain server values')
|
|
local eligible=D.threatCalApiEligible; local send=SendAddonMessage; local payload=nil
|
|
D.threatCalApiEligible=function() return true,'PARTY' end
|
|
SendAddonMessage=function(prefix,msg,channel) payload=msg end
|
|
D.threatCalPendingRequests={}; D.threatCalApiRetryAt=0; D.threatCalLastTimeoutAt=0
|
|
D.threatCalSendRequest()
|
|
check(payload=='limit=4','standalone request matches TWThreat default row limit')
|
|
D.threatCalApiEligible=eligible; SendAddonMessage=send
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 421.')
|
|
D.threatOnCast('0x1',nil,'START',5384)
|
|
check(D.actors['0x1'].threat['0xF1']==421,'FD START alone preserves threat')
|
|
D.threatOnCast('0x1',nil,'CAST',5384)
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 43.')
|
|
check(D.actors['0x1'].threat['0xF1']==43,'live FD pattern: 421 then CAST then 43 becomes 43')
|
|
D.threatOnCast('0x1',nil,'FAIL',5384)
|
|
check(D.actors['0x1'].threat['0xF1']==464 and D.actors['0x1'].threatBase['0xF1']==464,'late FD failure restores baseline and keeps new threat')
|
|
D.threatOnCast('0x1',nil,'FAIL',5384)
|
|
check(D.actors['0x1'].threat['0xF1']==464,'duplicate FD failure does not restore twice')
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 100.')
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF2 for 200.')
|
|
D.threatOnCast('0x1',nil,'CAST',5384)
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_SELF_DAMAGE','Your Feign Death was resisted by 0xF1.')
|
|
check(D.actors['0x1'].threat['0xF1']==100 and D.actors['0x1'].threat['0xF2']==0,'explicit FD resist restores only matching enemy')
|
|
NOW=NOW+4; D.threatPrunePending()
|
|
check(next(D.threatFeignUndo)==nil,'FD rollback baselines expire')
|
|
-- Resists without a combat-log line: the enemy keeps attacking the feigned player.
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 100.')
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF2 for 200.')
|
|
D.threatOnCast('0x1',nil,'CAST',5384)
|
|
check(D.actors['0x1'].threat['0xF1']==0,'FD CAST resets threat before any failure evidence')
|
|
NOW=NOW+0.2; fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS','0xF1 hits you for 50.')
|
|
check(D.actors['0x1'].threat['0xF1']==0,'swing already in flight right after FD does not undo the reset')
|
|
NOW=NOW+0.3; fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_CREATURE_VS_SELF_DAMAGE',"0xF1's Cleave hits you for 50.")
|
|
check(D.actors['0x1'].threat['0xF1']==0,'area spell damage does not prove FD failed')
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS','0xF9 crits you for 50.')
|
|
check(D.actors['0x1'].threat['0xF1']==0 and D.actors['0x1'].threat['0xF2']==0,'melee from an enemy without threat does not undo FD')
|
|
NOW=NOW+0.5; fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS','0xF1 crits you for 678.')
|
|
check(D.actors['0x1'].threat['0xF1']==100 and D.actors['0x1'].threat['0xF2']==0,'enemy melee after FD restores only that enemy')
|
|
NOW=NOW+0.1; fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS','0xF1 hits you for 60.')
|
|
check(D.actors['0x1'].threat['0xF1']==100,'repeated enemy melee does not restore twice')
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 100.')
|
|
D.threatOnCast('0x1',nil,'CAST',5384)
|
|
NOW=NOW+3.5; fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS','0xF1 hits you for 60.')
|
|
check(D.actors['0x1'].threat['0xF1']==0,'enemy melee long after FD cannot undo it')
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 100.')
|
|
D.threatOnCast('0x1',nil,'CAST',5384)
|
|
NOW=NOW+0.6; fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_CREATURE_VS_SELF_HITS','0xF1 misses you.')
|
|
check(D.actors['0x1'].threat['0xF1']==100,'enemy melee miss after FD also proves it failed')
|
|
-- The server value is authoritative when it never dropped.
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 1838.')
|
|
local feignAt=NOW; D.threatOnCast('0x1',nil,'CAST',5384)
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 20.')
|
|
local pa=D.actors['0x1']
|
|
D.threatFeignServerCheck(pa,'0xF1',1858,feignAt)
|
|
check(pa.threat['0xF1']==20,'server reply requested before the cast is ignored')
|
|
NOW=NOW+0.5; D.threatFeignServerCheck(pa,'0xF1',25,NOW)
|
|
check(pa.threat['0xF1']==20,'server value near the post-reset estimate confirms the reset')
|
|
D.threatFeignServerCheck(pa,'0xF2',1858,NOW)
|
|
check(pa.threat['0xF1']==20,'server reply for another enemy is ignored')
|
|
D.threatFeignServerCheck(pa,'0xF1',1858,NOW)
|
|
check(pa.threat['0xF1']==1858 and pa.threatBase['0xF1']==1858,'server value that never dropped restores the pre-FD threat')
|
|
D.threatFeignServerCheck(pa,'0xF1',1858,NOW)
|
|
check(pa.threat['0xF1']==1858,'server check does not restore twice')
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 30.')
|
|
D.threatOnCast('0x1',nil,'CAST',5384)
|
|
NOW=NOW+0.5; D.threatFeignServerCheck(D.actors['0x1'],'0xF1',30,NOW)
|
|
check(D.actors['0x1'].threat['0xF1']==0,'tiny baselines are not restored from server noise')
|
|
-- Integration: the published server snapshot triggers the same check.
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 1000.')
|
|
feignAt=NOW; D.threatOnCast('0x1',nil,'CAST',5384)
|
|
NOW=NOW+0.5
|
|
local pubActor=D.actors['0x1']
|
|
local pubState={guid='0xF1',name='Mob',generation=1,segmentSerial=D.segmentSerial}
|
|
local pubReq={serial=1,sentAt=NOW,targetGuid='0xF1',targetGeneration=1,segmentSerial=D.segmentSerial}
|
|
D.serverThreatPublish({{name=pubActor.name,threat=1000,percent=100,tank=true,melee=true}},pubReq,pubState)
|
|
check(pubActor.threat['0xF1']==1000,'published server snapshot restores a feign that did not drop threat')
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE',"0x3's Auto Shot hits 0xF1 for 80.")
|
|
D.threatOnCast('0x3',nil,'CAST',5384)
|
|
check(D.actors['0x3'].threat['0xF1']==0,'remote hunter FD uses the same local reset path')
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 100.')
|
|
D.threatCalNewSession(); D.threatCalEnabled=true
|
|
D.threatCalTargetState=nil; D.threatCalObservedRequest=nil; D.threatCalPendingRequests={}; D.threatCalLastPayload=nil
|
|
D.threatCalObserveTarget(); NOW=NOW+3
|
|
local transportOriginal=SendAddonMessage; local observerOriginal=D.threatCalSendObserver
|
|
local forwarded=nil
|
|
SendAddonMessage=function(a,b,c,d) forwarded={a,b,c,d}; return 'original-result',17 end
|
|
D.threatCalSendObserver=nil; D.threatCalInstallObserver()
|
|
local result,second=SendAddonMessage('TWT_UDTSv4','limit=4','PARTY','recipient')
|
|
check(result=='original-result' and second==17 and forwarded[4]=='recipient','request observer preserves transport arguments and return values')
|
|
check(D.threatCalObservedRequest.targetGuid=='0xF1','observer captures actual outgoing request target')
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:100:100:1','PARTY','Hunter')
|
|
local stableSnap=D.threatCalSession.snapshots[1]
|
|
local cursor=stableSnap.modelEventCursor
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 5.')
|
|
check(stableSnap.modelEventCursor==cursor and table.getn(D.threatCalSession.events)>cursor and stableSnap.rows[1].observedModel==100,'snapshot event cursor excludes a later hit at the same clock time')
|
|
check(stableSnap.modelEventsDropped==0,'snapshot records whether replay events have been dropped')
|
|
check(stableSnap.stableTargetCandidate and stableSnap.rows[1].observedModel==100 and stableSnap.rows[1].diff==nil and stableSnap.targetGuid==nil,'stable passive context stores provisional model separately')
|
|
UNITS.target.guid='0xF2'; fire(D.threatCalFrame,'PLAYER_TARGET_CHANGED')
|
|
UNITS.target.guid='0xF1'; fire(D.threatCalFrame,'PLAYER_TARGET_CHANGED')
|
|
NOW=NOW+0.3
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:101:100:1','PARTY','Hunter')
|
|
check(D.threatCalSession.snapshots[2].contextReason=='target-changed' and not D.threatCalSession.snapshots[2].stableTargetCandidate,'target away and back invalidates old request context')
|
|
SendAddonMessage('TWT_UDTSv4','limit=4','PARTY')
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:102:100:1','PARTY','Hunter')
|
|
check(D.threatCalSession.snapshots[3].contextReason=='target-settling','recent target switch excludes comparison')
|
|
NOW=NOW+3; SendAddonMessage('TWT_UDTSv4','limit=4','PARTY')
|
|
D.segmentSerial=D.segmentSerial+1
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:103:100:1','PARTY','Hunter')
|
|
check(D.threatCalSession.snapshots[4].contextReason=='segment-changed','new segment excludes previous request context')
|
|
local requestCount=D.threatCalSession.observedRequests
|
|
SendAddonMessage('OTHER','unrelated','PARTY')
|
|
check(D.threatCalSession.observedRequests==requestCount,'observer ignores unrelated outbound traffic')
|
|
local observeOriginal=D.threatCalObserveRequest
|
|
D.threatCalObserveRequest=function() error('test observer failure') end
|
|
check(SendAddonMessage('TWT_UDTSv4','limit=4','PARTY')=='original-result','diagnostic failure does not block addon transport')
|
|
D.threatCalObserveRequest=observeOriginal
|
|
SendAddonMessage=transportOriginal; D.threatCalSendObserver=observerOriginal
|
|
D.threatCalNewSession(); D.threatCalEnabled=true
|
|
UnitLevel=function(u) if u=='pet' then return 32 elseif u=='player' then return 34 end end
|
|
UnitAttackPower=function() return 100,20,-5 end
|
|
UnitPowerType=function() return 2 end
|
|
GetPetHappiness=function() return 3 end
|
|
UnitBuff=function(u,i) if i==1 then return 'texture',1,1234 end end
|
|
local contextId=D.threatCalActorContext('0x2',true)
|
|
local context=D.threatCalSession.actorContexts[contextId]
|
|
check(context.level==32 and context.ownerLevel==34 and context.attackPowerBase==100 and context.attackPowerPositive==20 and context.attackPowerNegative==-5,'pet context preserves levels and observed attack power components')
|
|
check(context.buffs[1].spellId==1234 and context.buffScanComplete and context.happiness==3,'pet context records buff IDs and local happiness')
|
|
check(D.threatCalActorContext('0x2',false)==contextId,'repeated actor context uses short cache')
|
|
UnitLevel=function(u) if u=='pet' then return 33 elseif u=='player' then return 34 end end
|
|
D.threatCalRecordEvent({guid='0x2',source='Growl',kind='special',delta=170})
|
|
local latestEvent=D.threatCalSession.events[1]
|
|
check(D.threatCalSession.actorContexts[latestEvent.actorContextId].level==33,'Growl forces a fresh context after a level change')
|
|
UnitBuff=function() error('unavailable buff API') end
|
|
UnitAttackPower=function() error('unavailable remote stat') end
|
|
local failed=D.threatCalSession.actorContexts[D.threatCalActorContext('0x2',true)]
|
|
check(not failed.buffScanComplete and failed.attackPowerBase==nil,'unavailable stats remain unknown instead of invented zeroes')
|
|
local unknown=D.threatCalSession.actorContexts[D.threatCalActorContext('0x99',true)]
|
|
check(not unknown.available and unknown.level==nil,'unresolved actor retains unavailable context')
|
|
local contexts=D.threatCalSession.actorContexts
|
|
while table.getn(contexts)<300 do table.insert(contexts,{}) end
|
|
check(D.threatCalActorContext('0x2',true)==nil and table.getn(contexts)==300,'context cap does not attach stale metadata')
|
|
UnitBuff=function() end
|
|
D.threatCalEnabled=false
|
|
local petActor={guid='0x2',isPet=true}
|
|
UnitLevel=function(u) if u=='pet' then return 33 elseif u=='partypet1' then return 29 end end
|
|
check(D.threatGrowlValue(petActor,14918)==182,'measured own pet rank 4 level 33 uses 182 without calibration')
|
|
PARTY_COUNT=1; UNITS.partypet1={guid='0x22',name='Other Pet'}
|
|
check(D.threatGrowlValue({guid='0x22',isPet=true},14917)==146,'measured group pet rank 3 level 29 uses 146')
|
|
check(D.threatGrowlValue({guid='0x99',isPet=true},14918)==170,'unresolved GUID cannot borrow another pet level')
|
|
UnitLevel=function() return 34 end
|
|
check(D.threatGrowlValue(petActor,14918)==186,'measured rank 4 level 34 uses 186 without server data')
|
|
check(D.threatGrowlValue({guid='0x22',isPet=true},14918)==186,'level 34 correction also applies to GUID-matched group pet')
|
|
check(D.threatGrowlValue(petActor,14917)==110,'level 34 correction does not change a different Growl rank')
|
|
UnitLevel=function() return 35 end
|
|
check(D.threatGrowlValue(petActor,14918)==170,'unmeasured level retains rank fallback after level change')
|
|
UnitLevel=function() error('level unavailable') end
|
|
check(D.threatGrowlValue(petActor,14918)==170,'level API failure retains fallback')
|
|
UnitLevel=nil
|
|
check(D.threatGrowlValue(petActor,14918)==170,'missing level API retains fallback')
|
|
local oldRaid=GetNumRaidMembers
|
|
GetNumRaidMembers=function() return 2 end
|
|
UNITS.raidpet2={guid='0x23',name='Raid Pet'}
|
|
UnitLevel=function(u) if u=='raidpet2' then return 29 elseif u=='pet' then return 33 end end
|
|
check(D.threatGrowlValue({guid='0x23',isPet=true},14917)==146,'raid pet resolved by GUID')
|
|
GetNumRaidMembers=oldRaid
|
|
fresh()
|
|
D.threatOnCast('0x2','0xF1','CAST',14918)
|
|
D.threatOnSpellLanded('0x2','0xF1','Growl')
|
|
D.threatOnSpellLanded('0x2','0xF1','Growl')
|
|
check(D.actors['0x2'].threat['0xF1']==182,'landed Growl uses measured value once')
|
|
NOW=NOW+3
|
|
D.threatOnCast('0x2','0xF1','CAST',14918)
|
|
D.threatOnCast('0x2','0xF1','FAIL',14918)
|
|
D.threatOnSpellLanded('0x2','0xF1','Growl')
|
|
check(D.actors['0x2'].threat['0xF1']==182,'failed Growl does not apply measured bonus')
|
|
local druid={guid='0x1',classToken='DRUID',name='Druid'}
|
|
local formId=5487
|
|
UnitBuff=function(unit,index) if index==1 and formId then return 'form',1,formId end end
|
|
local talentRank=5
|
|
GetNumTalentTabs=function() return 1 end
|
|
GetNumTalents=function() return 1 end
|
|
GetTalentInfo=function() return 'Feral Instinct','icon',1,1,talentRank,5 end
|
|
D.threatFeralTalentAt=nil
|
|
check(math.abs(D.threatGlobalModifier(druid)-1.45)<0.00001,'local bear separates 1.3 form and known 5-point talent bonus')
|
|
D.threatOnDamage(druid,160,'Maul',false,'0xF1')
|
|
check(math.abs(druid.threat['0xF1']-348)<0.00001,'measured Maul 160 produces 348 with known full talent')
|
|
D.threatOnDamage(druid,31,'Swipe',false,'0xF2')
|
|
check(math.abs(druid.threat['0xF2']-62.93)<0.00001,'Swipe relative factor 1.4 composes with bear and talent')
|
|
formId=nil
|
|
check(D.threatGlobalModifier(druid)==1,'leaving bear removes form and bear-only talent bonus immediately')
|
|
formId=9634; talentRank=0; NOW=NOW+2
|
|
check(D.threatGlobalModifier(druid)==1.3,'dire bear with zero talent uses only base modifier')
|
|
talentRank=3; NOW=NOW+2
|
|
check(math.abs(D.threatGlobalModifier(druid)-1.39)<0.00001,'partial local talent rank supported')
|
|
GetTalentInfo=function() return 'Feral Instinct','icon',1,1,3,3 end
|
|
NOW=NOW+2
|
|
check(math.abs(D.threatGlobalModifier(druid)-1.45)<0.00001,'RavenCraft three-point Feral Instinct supports full bonus')
|
|
GetTalentInfo=function() return 'Feral Instinct','icon',1,1,1,3 end
|
|
NOW=NOW+2
|
|
check(math.abs(D.threatGlobalModifier(druid)-1.35)<0.00001,'three-point talent uses separate per-rank model')
|
|
GetTalentInfo=function() return 'Feral Instinct','icon',1,1,3,4 end
|
|
NOW=NOW+2
|
|
check(D.threatGlobalModifier(druid)==1.3,'unknown custom talent layout does not invent bonus')
|
|
PARTY_COUNT=1; UNITS.party1={guid='0xD1',class='DRUID',name='Remote'}
|
|
local remote={guid='0xD1',classToken='DRUID'}
|
|
check(D.threatGlobalModifier(remote)==1.3,'remote bear never borrows local talent rank')
|
|
local base,bonus,knowledge=D.threatDruidModifiers(remote)
|
|
check(base==1.3 and bonus==0 and knowledge=='talent-unknown','unknown remote talent explicitly identified')
|
|
UnitBuff=function() error('unavailable') end
|
|
check(D.threatGlobalModifier(remote)==1,'failed form scan does not keep stale bear modifier')
|
|
UnitBuff=function() return nil end
|
|
check(D.threatGlobalModifier({guid='0x99',classToken='DRUID'})==1,'unresolved druid cannot borrow another unit form')
|
|
local sarvok={guid='0xD8',name='AnyDruid',classToken='DRUID',key='0xD8'}
|
|
UNITS.party1={guid=sarvok.guid,name=sarvok.name,class='DRUID'}
|
|
UnitBuff=function(unit,index) if index==1 then return 'form',1,5487 end end
|
|
check(D.threatGlobalModifier(sarvok)==1.3,'remote talent remains unknown without sync')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'T~1~0xD8~3~3','PARTY','AnyDruid')
|
|
check(math.abs(D.threatGlobalModifier(sarvok)-1.45)<0.00001,'any roster druid can announce own talent automatically')
|
|
local _,_,confirmedKnowledge=D.threatDruidModifiers(sarvok)
|
|
check(confirmedKnowledge=='caw-sync','remote talent sync provenance is explicit')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'T~1~0xD8~0~3','PARTY','Hunter')
|
|
check(math.abs(D.threatGlobalModifier(sarvok)-1.45)<0.00001,'another sender cannot announce talents for a roster druid')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'T~1~0xD8~0~3','WHISPER','AnyDruid')
|
|
check(math.abs(D.threatGlobalModifier(sarvok)-1.45)<0.00001,'talent sync rejects wrong channel')
|
|
UnitBuff=function() end
|
|
check(D.threatGlobalModifier(sarvok)==1,'synced talent does not force bear form')
|
|
UnitBuff=function(unit,index) if index==1 then return 'form',1,5487 end end
|
|
fresh()
|
|
D.guidToActor[sarvok.guid]=sarvok
|
|
D.threatOnCast(sarvok.guid,'0xF1','CAST',17390)
|
|
check(not D.actors[sarvok.guid] or not D.actors[sarvok.guid].threat,'Faerie Fire cast alone does not book threat')
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_FRIENDLYPLAYER_DAMAGE',sarvok.guid..' casts Faerie Fire (Feral) on 0xF1.')
|
|
local sa=D.actors[sarvok.guid]
|
|
check(sa and math.abs(sa.threat['0xF1']-156.6)<0.00001,'Faerie Fire rank 2 RAW success applies measured flat threat and confirmed modifier')
|
|
D.threatOnSpellLanded(sarvok.guid,'0xF1','Faerie Fire')
|
|
check(math.abs(sa.threat['0xF1']-156.6)<0.00001,'Faerie Fire aura alias cannot double-count committed cast')
|
|
NOW=NOW+3
|
|
D.threatOnCast(sarvok.guid,'0xF1','CAST',17390)
|
|
D.threatOnSpellFailed(sarvok.guid,'0xF1','Faerie Fire')
|
|
D.threatOnSpellLanded(sarvok.guid,'0xF1','Faerie Fire (Feral)')
|
|
check(math.abs(sa.threat['0xF1']-156.6)<0.00001,'Faerie Fire resist alias cancels pending bonus')
|
|
NOW=NOW+3
|
|
D.threatOnCast(sarvok.guid,'0xF1','CAST',17390)
|
|
check(not D.threatOnSpellLanded(sarvok.guid,'0xF2','Faerie Fire'),'Faerie Fire requires matching target')
|
|
NOW=NOW+3
|
|
check(not D.threatOnSpellLanded(sarvok.guid,'0xF1','Faerie Fire'),'expired Faerie Fire cannot book threat')
|
|
D.threatCalNewSession(); D.threatCalEnabled=true
|
|
local ci=D.threatCalActorContext(sarvok.guid,true)
|
|
local cc=D.threatCalSession.actorContexts[ci]
|
|
check(cc.modifierKnowledge=='caw-sync' and cc.remoteTalents=='caw-sync' and math.abs(cc.modelModifier-1.45)<0.00001,'calibration records synced remote talent provenance and applied modifier')
|
|
for i=1,205 do D.threatCalRecordRaw('CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE','0xF1 is afflicted by Faerie Fire.') end
|
|
check(table.getn(D.threatCalSession.druidRaw)==200 and D.threatCalSession.druidRawDropped==5,'automatic druid RAW capture stays bounded')
|
|
D.threatCalEnabled=false
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'T~1~0xD8~4~3','PARTY','AnyDruid')
|
|
check(math.abs(D.threatGlobalModifier(sarvok)-1.45)<0.00001,'invalid talent rank rejected')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'T~1~0xD8~0~3','PARTY','AnyDruid')
|
|
check(D.threatGlobalModifier(sarvok)==1.3,'zero talent after respec replaces previous bonus')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'T~1~0xD8~3~3','PARTY','AnyDruid')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'T~1~0xD8~unknown~0','PARTY','AnyDruid')
|
|
check(D.threatSyncTalents[sarvok.guid]==nil,'unavailable talent API revokes old state')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'T~1~0xD8~3~3','PARTY','AnyDruid')
|
|
NOW=NOW+46
|
|
check(D.threatGlobalModifier(sarvok)==1.3,'stale remote talent expires')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'T~1~0xD8~3~3','PARTY','AnyDruid')
|
|
UNITS.party1=nil
|
|
check(D.threatSyncedFeralInstinct(sarvok)==nil,'departed roster member loses cached talents')
|
|
UNITS.player.class='DRUID'
|
|
GetTalentInfo=function() return 'Feral Instinct','icon',1,1,3,3 end
|
|
local sentTalents={}
|
|
local sendTalent=function(msg,channel) table.insert(sentTalents,{msg=msg,channel=channel}); return true end
|
|
D.threatSyncTick(sendTalent,'PARTY')
|
|
check(table.getn(sentTalents)==1 and sentTalents[1].msg=='T~1~0x1~3~3','local talent announcement uses actual API without character config')
|
|
NOW=NOW+1; D.threatSyncTick(sendTalent,'PARTY')
|
|
check(table.getn(sentTalents)==1,'unchanged talent does not send every tick')
|
|
GetTalentInfo=function() return 'Feral Instinct','icon',1,1,0,3 end
|
|
NOW=NOW+1; D.threatSyncTick(sendTalent,'PARTY')
|
|
check(table.getn(sentTalents)==2 and sentTalents[2].msg=='T~1~0x1~0~3','local respec automatically broadcasts changed talent')
|
|
NOW=NOW+15; D.threatSyncTick(sendTalent,'PARTY')
|
|
check(table.getn(sentTalents)==3,'periodic announcement reaches newly joined clients')
|
|
NOW=NOW+1; D.threatSyncTick(sendTalent,nil)
|
|
check(table.getn(sentTalents)==3,'solo player does not broadcast talents')
|
|
fresh()
|
|
UNITS.party1={guid='0xD8',name='AnyDruid',class='DRUID'}
|
|
D.guidToActor[sarvok.guid]=sarvok
|
|
D.threatSyncTalents={}
|
|
D.threatOnCast(sarvok.guid,'0xF1','CAST',17390)
|
|
NOW=NOW+0.032
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE','0xF1 is afflicted by Faerie Fire (Feral).')
|
|
local auraActor=D.actors[sarvok.guid]
|
|
check(auraActor and math.abs(auraActor.threat['0xF1']-140.4)<0.00001,'captured casterless Faerie Fire aura books rank 2 with known bear baseline')
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_PERIODIC_CREATURE_DAMAGE','0xF1 is afflicted by Faerie Fire (Feral).')
|
|
check(math.abs(auraActor.threat['0xF1']-140.4)<0.00001,'duplicate casterless aura cannot double-book threat')
|
|
NOW=NOW+3
|
|
D.threatOnCast(sarvok.guid,'0xF1','CAST',17390)
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_PARTY_DAMAGE',sarvok.guid.."'s Faerie Fire (Feral) was resisted by 0xF1.")
|
|
check(not D.threatOnAuraLanded('0xF1','Faerie Fire (Feral)'),'captured resist removes candidate before aura matching')
|
|
NOW=NOW+3
|
|
D.threatOnCast(sarvok.guid,'0xF1','CAST',17390)
|
|
check(not D.threatOnAuraLanded('0xF2','Faerie Fire (Feral)'),'casterless aura cannot borrow another target cast')
|
|
NOW=NOW+0.6
|
|
check(not D.threatOnAuraLanded('0xF1','Faerie Fire (Feral)'),'casterless aura requires narrow timing window')
|
|
NOW=NOW+3
|
|
D.threatOnCast(sarvok.guid,'0xF1','CAST',17390)
|
|
D.guidToActor['0xD9']={guid='0xD9',key='0xD9',name='SecondDruid',classToken='DRUID'}
|
|
D.threatOnCast('0xD9','0xF1','CAST',17390)
|
|
check(not D.threatOnAuraLanded('0xF1','Faerie Fire (Feral)'),'simultaneous candidate casters remain ambiguous')
|
|
check(math.abs(auraActor.threat['0xF1']-140.4)<0.00001,'unmatched and ambiguous applications do not alter existing threat')
|
|
D.threatSyncPeers={}; D.threatSyncTalents={}
|
|
local ps,ds=D.threatPeerStatus(sarvok)
|
|
check(ps=='not-detected' and ds=='unknown','silent roster member is unconfirmed rather than classified as no addon')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'P~1~0xD8~CawThreat-0.20~fi1','PARTY','AnyDruid')
|
|
ps,ds=D.threatPeerStatus(sarvok)
|
|
check(ps=='detected' and ds=='feral-instinct-unavailable','capability announcement does not invent usable talent data')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'P~1~0xD8~forged~none','PARTY','Hunter')
|
|
check(D.threatSyncPeers['0xD8'].version=='CawThreat-0.20','peer announcement sender must own the roster GUID')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'P~1~0xD8~wrong~none','WHISPER','AnyDruid')
|
|
check(D.threatSyncPeers['0xD8'].version=='CawThreat-0.20','peer announcement rejects non-group channels')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'T~1~0xD8~3~3','PARTY','AnyDruid')
|
|
ps,ds=D.threatPeerStatus(sarvok)
|
|
check(ps=='detected' and ds=='feral-instinct-current','usable data requires actual current talent message')
|
|
NOW=NOW+46
|
|
ps,ds=D.threatPeerStatus(sarvok)
|
|
check(ps=='stale' and ds=='unknown','expired peer is not presented as current')
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'P~1~0xD8~CawThreat-0.20~fi1','PARTY','AnyDruid')
|
|
ps,ds=D.threatPeerStatus(sarvok)
|
|
check(ps=='detected' and ds=='feral-instinct-unavailable','fresh heartbeat cannot revive expired talent data')
|
|
D.threatSyncPeers={}
|
|
fire(D.events,'CHAT_MSG_ADDON',D.syncPrefix,'T~1~0xD8~3~3','PARTY','AnyDruid')
|
|
ps,ds=D.threatPeerStatus(sarvok)
|
|
check(ps=='detected' and ds=='feral-instinct-current','older talent-sync client is detected without new handshake')
|
|
UNITS.player.class='HUNTER'
|
|
local peerMessages={}
|
|
local peerSend=function(msg,ch) table.insert(peerMessages,{msg=msg,ch=ch}); return true end
|
|
D.threatPeerNextCheck=nil; D.threatPeerLastChannel=nil
|
|
D.threatPeerTick(peerSend,'PARTY')
|
|
check(table.getn(peerMessages)==1 and string.find(peerMessages[1].msg,'~none',1,true),'non-druid client announces presence without claiming talent support')
|
|
NOW=NOW+1; D.threatPeerTick(peerSend,'PARTY')
|
|
check(table.getn(peerMessages)==1,'peer announcement is throttled')
|
|
NOW=NOW+15; D.threatPeerTick(peerSend,'PARTY')
|
|
check(table.getn(peerMessages)==2,'periodic announcement discovers new group clients')
|
|
UNITS.party1=nil
|
|
NOW=NOW+1; D.threatPeerTick(peerSend,'PARTY')
|
|
check(D.threatSyncPeers['0xD8']==nil,'departed member removed from peer cache')
|
|
NOW=NOW+1; D.threatPeerTick(peerSend,nil)
|
|
check(table.getn(peerMessages)==2,'no presence broadcast when solo')
|
|
local scrollView=D.multiWindows[2] or D.createMultiWindow(nil)
|
|
local headerWidth=scrollView.frame:GetWidth()
|
|
for _,width in ipairs({160,190,260,360,440,900}) do
|
|
scrollView.frame:SetWidth(width); D.layoutMultiWindow(scrollView)
|
|
local used=5+scrollView.modeButton:GetWidth()+3+scrollView.segmentButton:GetWidth()+5
|
|
local buttons={scrollView.addButton,scrollView.reportButton,scrollView.lockButton,scrollView.resetButton,scrollView.closeButton,scrollView.optionsButton,scrollView.overflowButton}
|
|
local shown=0
|
|
for _,b in ipairs(buttons) do if b:IsShown() then used=used+b:GetWidth(); shown=shown+1 end end
|
|
used=used+(shown-1)*3+5
|
|
check(used<=width and scrollView.modeText:GetWidth()<scrollView.modeButton:GetWidth() and scrollView.segmentText:GetWidth()<scrollView.segmentButton:GetWidth(),'header controls and labels fit inside width '..width)
|
|
end
|
|
check(scrollView.summary.lastPoint[1]=='BOTTOMRIGHT' and not scrollView.toolbar:IsShown(),'status is separate from selectors and old toolbar is hidden')
|
|
scrollView.frame:SetWidth(headerWidth); D.layoutMultiWindow(scrollView)
|
|
local oldSorted=D.multiViewSortedActors
|
|
local scrollList={}
|
|
for i=1,25 do scrollList[i]={value=100-i,actor={name='Row'..i,classToken='HUNTER'}} end
|
|
D.multiViewSortedActors=function() return scrollList,table.getn(scrollList) end
|
|
scrollView.frame:Show(); scrollView.frame:SetHeight(260); scrollView.mode='damage'; scrollView.scrollOffset=0
|
|
D.updateMultiWindow(scrollView)
|
|
check(scrollView.brand:IsShown() and scrollView.brand.kind=='Texture','watermark remains present as a noninteractive texture with player bars')
|
|
check(scrollView.rows[1].frame:GetHeight()==D.rows[1].frame:GetHeight() and scrollView.frame:GetScript('OnMouseWheel'),'extra window matches primary row height and supports wheel scrolling')
|
|
check(scrollView.rows[1].classIcon:IsShown() and scrollView.rows[1].classIcon:GetWidth()==18,'extra actor rows display class icons at primary dimensions')
|
|
scrollList[1].actor.classToken=nil; D.updateMultiWindow(scrollView)
|
|
check(not scrollView.rows[1].classIcon:IsShown(),'reused extra row hides stale icon for unknown class')
|
|
scrollList[1].actor.classToken='HUNTER'; D.updateMultiWindow(scrollView)
|
|
local primaryOffset=D.scrollOffset
|
|
local footerSafe=true
|
|
for height=110,700 do
|
|
scrollView.frame:SetHeight(height); D.updateMultiWindow(scrollView)
|
|
local footerTop=scrollView.summary.lastPoint[5]+scrollView.summary:GetHeight()
|
|
for _,row in ipairs(scrollView.rows) do
|
|
if row.frame:IsShown() then
|
|
local rowBottom=height+row.frame.lastPoint[5]-row.frame:GetHeight()
|
|
if rowBottom<=footerTop then footerSafe=false end
|
|
end
|
|
end
|
|
end
|
|
check(footerSafe,'populated extra window keeps every player row above footer at all supported heights')
|
|
scrollView.frame:SetHeight(260); D.updateMultiWindow(scrollView)
|
|
this=scrollView.frame; arg1=-1
|
|
for i=1,100 do this:GetScript('OnMouseWheel')() end
|
|
check(scrollView.scrollOffset==17 and scrollView.rows[8].actor.name=='Row25' and D.scrollOffset==primaryOffset,'extra scrolling reaches final actor and remains independent of primary')
|
|
this=scrollView.rows[1].bar; arg1=1; this:GetScript('OnMouseWheel')()
|
|
check(scrollView.scrollOffset==16 and scrollView.rows[1].actor.name=='Row17','mouse wheel over a player bar scrolls back through the list')
|
|
scrollView.frame:SetHeight(600); D.updateMultiWindow(scrollView)
|
|
check(scrollView.scrollOffset==5,'resizing reclamps extra window scroll offset')
|
|
scrollList={scrollList[1],scrollList[2]}; D.updateMultiWindow(scrollView)
|
|
check(scrollView.scrollOffset==0 and scrollView.rows[1].actor.name=='Row1','short lists reset offset and keep the remaining actors reachable')
|
|
scrollList={}; D.updateMultiWindow(scrollView)
|
|
check(scrollView.brand:IsShown(),'empty view restores the watermark')
|
|
D.multiViewSortedActors=oldSorted
|
|
pfUI={chat={right=CreateFrame('Frame','MockPfChat',UIParent)}}
|
|
pfUI.chat.right:SetFrameStrata('BACKGROUND')
|
|
D.window:Show(); scrollView.frame:Show()
|
|
D.pfDockToggle(nil); D.pfDockToggle(scrollView)
|
|
check(D.window.parent==UIParent and scrollView.frame.parent==UIParent,'docked windows retain independent UIParent input hierarchy')
|
|
check(scrollView.frame.lastPoint[2]==D.window and scrollView.frame.lastPoint[3]=='BOTTOMLEFT' and scrollView.frame.lastPoint[4]==0 and scrollView.frame.lastPoint[5]==0,'docked windows attach directly edge-to-edge without summed width offsets')
|
|
check(D.window:GetFrameStrata()=='MEDIUM' and scrollView.lockButton:GetFrameStrata()=='MEDIUM' and scrollView.lockButton:GetFrameLevel()>scrollView.frame:GetFrameLevel(),'docked windows stay below inventory layers while their buttons remain above their bars')
|
|
check(D.window.lastPoint[3]=='BOTTOMRIGHT' and scrollView.frame.lastPoint[2]==D.window,'docking roots the window chain inside chat instead of above it')
|
|
local oldLocked=scrollView.locked
|
|
this=scrollView.lockButton; arg1='LeftButton'; this.scripts.OnClick()
|
|
check(scrollView.locked~=oldLocked,'docked extra lock button retains left-click action')
|
|
this=scrollView.lockButton; arg1='LeftButton'; this.scripts.OnClick()
|
|
pfUI.chat.right:Hide()
|
|
D.pfDockUpdate()
|
|
check(not D.window:IsVisible() and not scrollView.frame:IsVisible(),'pfUI arrow visibility hides both docked windows')
|
|
local oldShift=IsShiftKeyDown
|
|
IsShiftKeyDown=function() return true end
|
|
this=scrollView.lockButton; arg1='RightButton'; this.scripts.OnClick()
|
|
IsShiftKeyDown=oldShift
|
|
check(CawDPSMeterCharDB.pfDockAlternate and scrollView.pfDock and scrollView.locked==oldLocked,'shift right click saves alternate mode without unlocking or undocking')
|
|
check(D.window:IsVisible() and scrollView.frame:IsVisible(),'alternate mode shows both docked windows when chat is hidden')
|
|
check(scrollView.frame.lastPoint[2]==D.window and scrollView.frame.lastPoint[3]=='BOTTOMLEFT','alternate mode retains side by side placement against hidden chat')
|
|
pfUI.chat.right:Show(); D.pfDockUpdate()
|
|
check(not D.window:IsVisible() and not scrollView.frame:IsVisible(),'alternate mode hides both meters when chat returns')
|
|
D.saveMultiWindows()
|
|
check(CawDPSMeterCharDB.pfDockAlternate and CawDPSMeterCharDB.extraWindowCount>0,'saving hidden alternate windows retains mode and windows')
|
|
pfUI.chat.right:Hide(); D.pfDockUpdate()
|
|
check(D.window:IsVisible() and scrollView.frame:IsVisible(),'chat arrow restores both alternate windows repeatedly')
|
|
D.pfDockToggleVisibility()
|
|
check(not D.window:IsVisible() and not scrollView.frame:IsVisible(),'switching back restores shared chat visibility immediately')
|
|
pfUI.chat.right:Show(); pfUI.chat.right:SetAlpha(0); D.pfDockUpdate()
|
|
check(pfUI.chat.right:IsVisible() and not D.window:IsVisible() and not scrollView.frame:IsVisible(),'shared mode detects pfUI alpha-only chat hiding')
|
|
pfUI.chat.right:SetAlpha(1); D.pfDockUpdate()
|
|
check(D.window:IsVisible() and scrollView.frame:IsVisible(),'shared mode restores both meters on alpha-only chat showing')
|
|
D.pfDockToggleVisibility()
|
|
check(not D.window:IsVisible() and not scrollView.frame:IsVisible(),'alternate mode hides both meters with opaque chat')
|
|
pfUI.chat.right:SetAlpha(0); D.pfDockUpdate()
|
|
check(D.window:IsVisible() and scrollView.frame:IsVisible(),'alternate mode shows both meters with alpha-hidden chat')
|
|
pfUI.chat.right:SetAlpha(1); D.pfDockUpdate()
|
|
check(not D.window:IsVisible() and not scrollView.frame:IsVisible(),'alternate mode follows repeated alpha-only arrow changes')
|
|
D.pfDockToggleVisibility(); pfUI.chat.right:Hide(); D.pfDockUpdate()
|
|
D.saveMultiWindows()
|
|
check(CawDPSMeterCharDB.extraWindows[1].pfDock and CawDPSMeterCharDB.extraWindowCount>0,'parent-hidden docked extra survives saving')
|
|
D.pfDockToggle(scrollView)
|
|
check(scrollView.frame.parent==UIParent and scrollView.frame:IsVisible() and not D.window:IsVisible(),'undocked extra stays visible independently of hidden chat')
|
|
check(scrollView.lockButton:GetFrameLevel()>scrollView.frame:GetFrameLevel() and scrollView.frame:GetFrameStrata()=='HIGH','free extra retains usable foreground hierarchy after undocking')
|
|
pfUI.chat.right:Show()
|
|
D.pfDockUpdate()
|
|
check(D.window:IsVisible(),'pfUI arrow restores docked main')
|
|
D.pfDockToggle(nil)
|
|
check(D.window.parent==UIParent and not D.window.cawDockFree,'undocking restores free parent and clears docking state')
|
|
pfUI=nil
|
|
D.pfDockToggle(nil)
|
|
check(not CawDPSMeterCharDB.pfDockMain,'missing pfUI does not enable docking')
|
|
pfUI={chat={right=CreateFrame('Frame',nil,UIParent)}}
|
|
CawDPSMeterCharDB.pfDockRevision=nil; CawDPSMeterCharDB.pfDockMain=true; scrollView.pfDock=true
|
|
D.window:Hide(); scrollView.frame:Hide()
|
|
D.pfDockUpdate()
|
|
check(D.window:IsVisible() and scrollView.frame:IsVisible() and not scrollView.pfDock and not CawDPSMeterCharDB.pfDockMain,'old docking settings recover both windows visibly once')
|
|
D.pfDockToggle(nil); D.pfDockUpdate()
|
|
check(CawDPSMeterCharDB.pfDockMain,'recovery migration does not disable newly enabled docking')
|
|
D.pfDockToggle(nil); pfUI=nil
|
|
local menuFrame=scrollView.modeMenu
|
|
D.pfDockLayerTree(scrollView.frame,20,'HIGH')
|
|
check(menuFrame:GetFrameStrata()=='DIALOG' and menuFrame:GetFrameLevel()>scrollView.rows[1].bar:GetFrameLevel(),'dropdown retains explicit layer above player bars when window layers refresh')
|
|
local narrowRows={D.rows[1],scrollView.rows[1]}
|
|
for _,nr in ipairs(narrowRows) do
|
|
nr.actor={name='Somebody',classToken='HUNTER'}; nr.bar:SetWidth(150); nr.right:SetText('123 | 45')
|
|
D.fitBarActorName(nr,'Somebody',58)
|
|
check(not nr.classIcon:IsShown() and nr.left:GetText()=='Somebody','narrow primary or extra row drops icon before losing readable name')
|
|
nr.bar:SetWidth(300); D.fitBarActorName(nr,'Somebody',58)
|
|
check(nr.classIcon:IsShown() and nr.rank.lastPoint[4]==24,'widening row restores class icon and normal rank spacing')
|
|
end
|
|
fresh()
|
|
UNITS.target={guid='0xF1',name='Normal Mob',hostile=true}; PARTY_COUNT=1
|
|
UnitClassification=function() return 'normal' end
|
|
IsAddOnLoaded=function() return false end
|
|
D.threatCalEnabled=false; D.threatCalPendingRequests={}; D.threatCalStart(); D.threatCalAttributionUncertain=false
|
|
D.actors['0x1']={name='Hunter',key='0x1',guid='0x1',classToken='HUNTER',threat={['0xF1']=100}}
|
|
NOW=NOW+3
|
|
check(D.threatCalSendRequest(),'standalone Caw queries normal hostile combat targets without TWThreat')
|
|
NOW=NOW+0.05
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:777:100:1','PARTY','Hunter')
|
|
local serverView=D.serverThreatCurrent()
|
|
check(serverView and D.threatValueForActor(serverView.actors[1])==777 and D.threatPercentForActor(serverView.actors[1])==100,'own API reply supplies server threat and server percentage to display')
|
|
check(D.actors['0x1'].threat['0xF1']==100 and serverView.actors[1]._serverLocalValue==100,'server display leaves local threat untouched for calibration')
|
|
check(table.getn(D.threatCalSession.snapshots)==1,'standalone reply also saved for calibration')
|
|
NOW=NOW+1.3
|
|
check(not D.serverThreatCurrent() and not next(D.serverThreatActors()),'expired server view cannot silently substitute local estimates')
|
|
NOW=NOW+2; D.threatCalSendRequest(); NOW=NOW+0.05
|
|
D.threatCalMaxSnapshots=0
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:778:100:1','PARTY','Hunter')
|
|
check(D.serverThreatCurrent() and D.threatValueForActor(D.serverThreatCurrent().actors[1])==778,'recording cap does not freeze the live server display')
|
|
D.threatCalMaxSnapshots=800
|
|
UNITS.target.guid='0xF2'; D.threatCalObserveTarget()
|
|
check(not D.serverThreatCurrent(),'target switch immediately invalidates server display')
|
|
UNITS.target.guid='0xF1'; D.threatCalObserveTarget()
|
|
check(not D.serverThreatCurrent(),'switching back cannot revive old server snapshot')
|
|
NOW=NOW+3; D.threatCalSendRequest(); NOW=NOW+0.05; D.threatCalAttributionUncertain=true
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:999:100:1','PARTY','Hunter')
|
|
check(D.serverThreatCurrent() and D.threatValueForActor(D.serverThreatCurrent().actors[1])==999,'fresh server display recovers despite conservative calibration uncertainty')
|
|
D.threatCalEnabled=false
|
|
-- Live transport must remain independent from recording and model uncertainty.
|
|
local savedSnapshots=table.getn(D.threatCalSession.snapshots)
|
|
local savedRequests=D.threatCalSession.requests
|
|
NOW=NOW+2
|
|
check(D.threatCalSendRequest(),'server queries remain active with recording disabled')
|
|
NOW=NOW+0.05
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:1001:100:1','WHISPER','Hunter')
|
|
check(D.serverThreatCurrent() and D.serverThreatCurrent().actors[1]._serverThreatValue==1001,'live response accepts TWThreat-compatible response channel independently of request channel')
|
|
check(table.getn(D.threatCalSession.snapshots)==savedSnapshots and D.threatCalSession.requests==savedRequests,'recording off does not mutate the completed calibration session')
|
|
NOW=NOW+2; D.threatCalSendRequest(); NOW=NOW+2
|
|
local sentAfterTimeout=D.threatCalSendRequest()
|
|
check(not sentAfterTimeout and not D.serverThreatCurrent() and D.serverThreatLabel()=='No server response','actual timeout clears stale display and reports missing server response')
|
|
NOW=NOW+3; check(D.threatCalSendRequest(),'timeout backoff permits a later request without reload')
|
|
NOW=NOW+0.05; fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:1002:100:1','PARTY','Hunter')
|
|
check(D.serverThreatCurrent() and D.serverThreatCurrent().actors[1]._serverThreatValue==1002,'response after timeout restores live display without reload')
|
|
IsAddOnLoaded=function(name) return name=='TWThreat' end
|
|
local originalSend=SendAddonMessage; local originalObserver=D.threatCalSendObserver
|
|
SendAddonMessage=function() end; D.threatCalSendObserver=nil; D.threatCalInstallObserver()
|
|
NOW=NOW+2
|
|
SendAddonMessage('TWT_UDTSv4','limit=4','PARTY')
|
|
NOW=NOW+0.05
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:3310:100:1;Tempered:0:1358:37:1;Mynnie:0:1320:36:0;Gyaat:0:1236:34:1','WHISPER','Hunter')
|
|
local parallelView=D.serverThreatCurrent()
|
|
check(parallelView and table.getn(parallelView.actors)==4 and parallelView.actors[1]._serverThreatValue==3310 and parallelView.actors[4]._serverThreatPercent==34,'TWThreat-owned response displays all server rows including actors absent from local engine')
|
|
check(not D.threatCalSendRequest(),'parallel operation observes TWThreat instead of adding duplicate polling')
|
|
local extra=D.multiWindows[2]; extra.mode='threat'; extra.segment='current'; extra.frame:Show(); D.updateMultiWindow(extra)
|
|
check(extra.rows[1].actor._serverThreatValue==3310 and extra.rows[1].actor.name=='Hunter','extra threat window consumes server actors rather than local estimates')
|
|
check(D.actors['0x1'].threat['0xF1']==100,'parallel server display never overwrites local engine state')
|
|
local packet='TWTv4=Hunter:1:3310:100:1#TMTv1=unrelated'
|
|
NOW=NOW+0.5; SendAddonMessage('TWT_UDTSv4_TM','limit=4','PARTY'); NOW=NOW+0.05
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ',packet,'WHISPER','Hunter')
|
|
check(D.serverThreatCurrent() and table.getn(D.serverThreatCurrent().actors)==1,'tank-mode suffix is separated from the threat table')
|
|
local beforeMalformed=D.serverThreatSnapshot
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:invalid:100:1','WHISPER','Hunter')
|
|
check(D.serverThreatSnapshot==beforeMalformed,'malformed numeric values cannot become zero-threat rows')
|
|
NOW=NOW+0.5; SendAddonMessage('TWT_UDTSv4','limit=4','PARTY'); NOW=NOW+0.05
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=','WHISPER','Hunter')
|
|
check(D.serverThreatCurrent() and not next(D.serverThreatActors()),'empty server table clears previous actors')
|
|
SendAddonMessage('TWT_UDTSv4','limit=4','PARTY')
|
|
UNITS.target.guid='0xF2'; fire(D.threatCalFrame,'PLAYER_TARGET_CHANGED'); NOW=NOW+0.05
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:9999:100:1','WHISPER','Hunter')
|
|
check(not D.serverThreatCurrent(),'passive old-target reply cannot populate the newly selected enemy')
|
|
UNITS.target.guid='0xF1'; fire(D.threatCalFrame,'PLAYER_TARGET_CHANGED'); NOW=NOW+2
|
|
D.threatCalObservedRequest=nil
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:9998:100:1','PARTY','Hunter')
|
|
check(not D.serverThreatCurrent(),'unsolicited rows without a locally observed request remain unassigned')
|
|
-- Calibration remains useful in parallel mode without claiming a target ID.
|
|
D.threatCalEnabled=true; D.threatCalNewSession(); D.threatCalAttributionUncertain=true
|
|
NOW=NOW+3; SendAddonMessage('TWT_UDTSv4','limit=4','PARTY'); NOW=NOW+0.05
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:1200:100:1','WHISPER','Hunter')
|
|
local recorded=D.threatCalSession.snapshots[1]
|
|
check(D.serverThreatCurrent() and recorded and recorded.rows[1].server==1200 and recorded.rows[1].observedModel==100,'parallel live response also records server values and the separate local candidate')
|
|
check(recorded.comparisonProvisional and recorded.rows[1].diff==nil and recorded.targetGuid==nil,'parallel calibration does not invent exact target or diff after uncertainty')
|
|
local latest=D.serverThreatSnapshot
|
|
NOW=NOW+0.10; SendAddonMessage('TWT_UDTSv4','limit=4','PARTY'); NOW=NOW+0.02
|
|
fire(D.threatCalFrame,'CHAT_MSG_ADDON','TWT ','TWTv4=Hunter:1:1200:100:1','WHISPER','Hunter')
|
|
check(D.serverThreatSnapshot~=latest and table.getn(D.threatCalSession.snapshots)==2,'identical payload after a new observed request still refreshes live data')
|
|
D.threatCalEnabled=false
|
|
SendAddonMessage=originalSend; D.threatCalSendObserver=originalObserver; IsAddOnLoaded=function() return false end
|
|
for _,row in ipairs({D.rows[1],extra.rows[1]}) do
|
|
row.bar:SetWidth(300); row.right:SetText('100'); row.actor={name='Pet',isPet=true,classToken='WARRIOR'}
|
|
D.fitBarActorName(row,'Pet',58)
|
|
check(row.classIcon:IsShown() and row.classIcon.texture=='Interface\\Icons\\Ability_Hunter_BeastTaming' and row.classIcon.texCoords[2]==1,'pet gets dedicated icon even when unit API reports warrior')
|
|
row.actor={name='Warrior',classToken='WARRIOR'}; D.fitBarActorName(row,'Warrior',58)
|
|
check(row.classIcon:IsShown() and row.classIcon.texture~='Interface\\Icons\\Ability_Hunter_BeastTaming','reused pet row restores player class texture')
|
|
row.actor={name='Pet',isPet=true}; row.bar:SetWidth(100); D.fitBarActorName(row,'Pet',58)
|
|
check(not row.classIcon:IsShown(),'narrow pet row still prioritizes readable name over icon')
|
|
end
|
|
local petClass,petUnit,petFlag=D.threatCalClassForName(UnitName('pet'))
|
|
check(petClass==nil and petUnit=='pet' and petFlag,'server row class lookup identifies pet without warrior classification')
|
|
local demonRow=D.rows[1]; demonRow.bar:SetWidth(300); demonRow.actor={name='Demon',isPet=true,petOwnerClass='WARLOCK'}
|
|
D.fitBarActorName(demonRow,'Demon',58)
|
|
check(demonRow.classIcon.texture=='Interface\\Icons\\Spell_Shadow_SummonFelHunter','server warlock pet uses demon symbol rather than hunter pet symbol')
|
|
D.guidToActor['test-warlock']={classToken='WARLOCK'}
|
|
check(D.petIconForActor({isPet=true,ownerKey='test-warlock'})=='Interface\\Icons\\Spell_Shadow_SummonFelHunter','local pet icon resolves warlock through owner identity')
|
|
D.guidToActor['test-warlock']=nil
|
|
local footerTarget=UNITS.target
|
|
UNITS.target=nil
|
|
check(D.serverThreatLabel()=='No target','threat footer shows missing target only once')
|
|
UNITS.target=footerTarget; D.threatCalTimeoutStreak=0; D.serverThreatSnapshot=nil
|
|
check(D.serverThreatLabel()=='Waiting for threat data','pending footer uses plain status text')
|
|
extra.mode='threat'; extra.segment='current'; extra.frame:Show(); D.updateMultiWindow(extra)
|
|
check(extra.summary:GetText()=='Waiting for threat data','extra footer does not append target to pending status')
|
|
fresh()
|
|
D.pendingSelfTotem={name='Stoneskin Totem',time=NOW}
|
|
local searing=D.tryClaimSelfTotemSource('0xFA01','Searing Bolt','CHAT_MSG_SPELL_PET_DAMAGE')
|
|
local nova=D.tryClaimSelfTotemSource('0xFA02','Fire Nova','CHAT_MSG_SPELL_PET_DAMAGE')
|
|
check(searing and searing.name=='Searing Totem' and nova and nova.name=='Fire Nova Totem','simultaneous damaging totems do not inherit last Stoneskin cast name')
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_PET_DAMAGE',"0xFA01's Searing Bolt hits 0xF1 for 40.")
|
|
D.pendingSelfTotem={name='Mana Spring Totem',time=NOW}
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_PET_DAMAGE',"0xFA01's Searing Bolt hits 0xF1 for 60.")
|
|
check(D.actors['0xFA01'] and D.actors['0xFA01'].name=='Searing Totem' and D.actors['0xFA01'].damage==100 and D.actors['0xFA01'].isTotem,'hover source actor retains Searing identity and damage after another totem cast')
|
|
check(not D.tryClaimSelfTotemSource('0xFA03','Unknown Item Spell','CHAT_MSG_SPELL_PET_DAMAGE'),'unknown summon spell is not assigned to last totem')
|
|
D.pendingItemSummons={}; D.dpsLogActive=false
|
|
D.observeItemSummonCast('0x1',nil,'CAST',4074)
|
|
local itemPet=D.observeItemSummonCast('0xFA10','0xF1','CAST',4050)
|
|
check(itemPet and itemPet.name=='Explosive Sheep' and itemPet.ownerKey=='0x1' and not itemPet.isTotem,'item summon cast chain binds the new pet GUID to its player owner')
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_PET_DAMAGE',"0xFA10's Explosive Sheep hits 0xF1 for 30.")
|
|
check(D.actors['0xFA10'] and D.actors['0xFA10'].damage==30 and D.actors['0xFA10'].spells['Explosive Sheep'].damage==30,'item summon damage is recorded under the item pet instead of the normal Hunter pet')
|
|
D.threatCalEnabled=false
|
|
check(not D.dpsLogActive,"missing DPSLog API keeps RAW producer")
|
|
CombatLogGetCurrentEventInfo=function() return 'SWING_DAMAGE','0x1','Hunter',1,0,'0xF1','Mob',64,0,30,-1,1,0,0,0,'1' end
|
|
D.dpsLogInitialized=nil; D.dpsLogRawCommitted=nil; D.dpsLogInitialize()
|
|
check(D.dpsLogProbing and D.dpsLogFrame.events.COMBAT_LOG_EVENT_UNFILTERED,"DPSLog API registers optional event and probes delivery")
|
|
fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 30.')
|
|
check(not D.actors['0x1'] or D.actors['0x1'].damage==0,"RAW before structured event cannot double count")
|
|
fire(D.dpsLogFrame,'COMBAT_LOG_EVENT_UNFILTERED')
|
|
check(D.actors['0x1'].damage==30 and D.actors['0x1'].crits==1 and D.currentEnemyDamage['0xF1']==30,"lazy structured melee maps amount crit and target once")
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 30.')
|
|
check(D.actors['0x1'].damage==30 and D.actors['0x1'].threat['0xF1']==30,"RAW after structured event cannot double count damage or threat")
|
|
D.dpsLogReceive('SPELL_PERIODIC_DAMAGE','0x1',nil,1,0,'0xF1','Mob',64,0,1978,'Serpent Sting',8,20,-1,8,0,0,0,nil)
|
|
check(D.actors['0x1'].damage==50 and D.actors['0x1'].spells['Serpent Sting'].damage==20,"periodic damage preserves spell and unresolved source name")
|
|
D.dpsLogReceive('SPELL_HEAL','0x1','Hunter',1,0,'0x1','Hunter',1,0,136,'Mend Pet',8,100,40,0,'1')
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_SELF_BUFF','Your Mend Pet critically heals Hunter for 100.')
|
|
check(D.actors['0x1'].healing==60 and D.actors['0x1'].healCrits==1,"structured healing subtracts overheal and ignores duplicate RAW")
|
|
D.dpsLogReceive('SPELL_PERIODIC_HEAL','0x1',nil,1,0,'0x1',nil,1,0,136,'Mend Pet',8,100,100,0,nil)
|
|
check(D.actors['0x1'].healing==60,"full overheal adds no effective healing")
|
|
D.dpsLogReceive('SPELL_SUMMON','0x1','Hunter',1,0,'0xFB01','Searing Totem',1,0,3599,'Searing Totem',4)
|
|
D.dpsLogReceive('SPELL_SUMMON','0x1','Hunter',1,0,'0xFB02','Stoneskin Totem',1,0,8071,'Stoneskin Totem',8)
|
|
D.dpsLogReceive('SPELL_DAMAGE','0xFB01',nil,1,0,'0xF1','Mob',64,0,3606,'Searing Bolt',4,50,-1,4,0,0,0,nil)
|
|
check(D.actors['0xFB01'].name=='Searing Totem' and D.actors['0xFB01'].damage==50 and D.actors['0xFB01'].ownerKey=='0x1',"summon GUID preserves totem identity and owner after another summon")
|
|
check(not D.actors['0xFB02'] or D.actors['0xFB02'].damage==0,"Stoneskin inherits no Searing damage")
|
|
D.dpsLogReceive('SPELL_SUMMON','0x1','Hunter',1,0,'0xFB03','Mechanical Dragonling',1,0,123,'Summon Dragonling',1)
|
|
check(D.guidToActor['0xFB03'].isPet and not D.guidToActor['0xFB03'].isTotem,"item summon gets explicit owner without being marked totem")
|
|
D.dpsLogReceive('SPELL_SUMMON','0x99','Outsider',1,0,'0xFB04','Other Totem',1,0,3599,'Searing Totem',4)
|
|
check(not D.guidToActor['0xFB04'],"outsider summon never joins roster")
|
|
local prior=D.dpsLogRejected
|
|
D.dpsLogReceive('SPELL_DAMAGE','0x1','Hunter',1,0,'0xF1','Mob',64,0,1,'Invalid',1,'bad')
|
|
check(D.dpsLogRejected==prior+1 and D.actors['0x1'].damage==50,"malformed suffix rejected without altering totals")
|
|
D.dpsLogReceive('UNIT_DIED','0x0000000000000000',nil,2147483648,0,'0xF1','Mob',64,0)
|
|
check(D.dpsLogRejected==prior+1,"null source GUID is valid for source-less events")
|
|
D.threatCalEnabled=true; D.threatCalNewSession()
|
|
D.dpsLogReceive('SPELL_ENERGIZE','0xFB01',nil,1,0,'0x1','Hunter',1,0,5677,'Mana Spring',8,20,0)
|
|
local evs=D.threatCalSession.events
|
|
check(evs[table.getn(evs)].kind=='power-observation' and evs[table.getn(evs)].amount==20,"resource events use bounded calibration without inventing threat")
|
|
D.dpsLogReceive('SPELL_DAMAGE','0x1',nil,1,0,'0xF1','Mob',64,0,75,'Auto Shot',1,10,-1,1,0,0,0,nil)
|
|
local found=false
|
|
for _,e in ipairs(D.threatCalSession.events) do if e.combatEvent and e.combatEvent.spellId==75 then found=true end end
|
|
check(found and D.dpsLogCurrent==nil,"local threat calibration retains structured spell and target context")
|
|
do
|
|
-- The vanilla DPSLog shield header names the original melee attacker
|
|
-- first, followed by the shield owner. Replay both directions, not a
|
|
-- Jadefire-only exclusion that would also drop real friendly retaliation.
|
|
fresh()
|
|
local function shield(attacker,owner,spellId,spell,amount,attackerName,ownerName)
|
|
return D.dpsLogReceive('DAMAGE_SHIELD',attacker,attackerName,1304,1,owner,ownerName,68168,2,
|
|
spellId,spell,2,amount,-1,2,0,0,0,nil)
|
|
end
|
|
for i=1,11 do shield('0x1','0xF1',13578,'Jadefire',50,'Hunter','Jadefire Satyr') end
|
|
for i=1,5 do shield('0x2','0xF1',13578,'Jadefire',50,'Wolf','Jadefire Satyr') end
|
|
check(not D.inCombat and not D.actors['0x1'] and not D.actors['0x2'],
|
|
'enemy Jadefire shield cannot create 550 player plus 250 pet outgoing damage or open a damage segment')
|
|
check(not next(D.currentEnemyDamage) and D.guidToActor['0x1'].name=='Hunter'
|
|
and D.guidToActor['0x2'].name=='Wolf','reversed enemy shields do not pollute target totals or roster names')
|
|
D.dpsLogReceive('SWING_DAMAGE','0x1','Hunter',1304,0,'0xF1','Jadefire Satyr',68168,0,900,-1,1,0,0,0,nil)
|
|
D.dpsLogReceive('SWING_DAMAGE','0x2','Wolf',2584,0,'0xF1','Jadefire Satyr',68168,0,433,-1,1,0,0,0,nil)
|
|
shield('0x1','0xF1',13578,'Jadefire',50,'Hunter','Jadefire Satyr')
|
|
check(D.actors['0x1'].damage==900 and D.actors['0x2'].damage==433
|
|
and not D.actors['0x1'].spells.Jadefire and not D.actors['0x2'].spells.Jadefire,
|
|
'enemy retaliation cannot inflate existing player and pet totals or ability rows')
|
|
local context=D.breakdownContext({mode='damage',segment='current'})
|
|
local _,total=D.targetBreakdownEntries(context,'0x1',nil,{})
|
|
check(total==1333 and D.actors['0x1'].damageTargets['0xF1'].damage==900,
|
|
'target and owner-pet breakdown totals exclude incoming shield damage too')
|
|
check(shield('0xF1','0x1',467,'Thorns',23,'Enemy','Hunter'),
|
|
'a friendly shield is accepted even though the original attacker is outside the roster')
|
|
check(D.actors['0x1'].damage==923 and D.actors['0x1'].spells.Thorns.damage==23
|
|
and D.actors['0x1'].damageTargets['0xF1'].spells.Thorns.spellId==467,
|
|
'friendly retaliation retains its owner, spell ID and actual enemy destination')
|
|
local shieldEvent
|
|
for _,e in ipairs(D.threatCalSession.events) do
|
|
if e.combatEvent and e.combatEvent.subevent=='DAMAGE_SHIELD' then shieldEvent=e.combatEvent end
|
|
end
|
|
check(shieldEvent and shieldEvent.sourceGuid=='0x1' and shieldEvent.destGuid=='0xF1'
|
|
and shieldEvent.sourceFlags==68168 and shieldEvent.destFlags==1304
|
|
and shieldEvent.sourceRaidFlags==2 and shieldEvent.destRaidFlags==1
|
|
and shieldEvent.shieldDirectionCorrected and D.dpsLogCurrent==nil,
|
|
'shield GUIDs, flags and raid flags are normalized together and recorded in diagnostics')
|
|
shield('0xF1','0x2',467,'Thorns',17,'Enemy','Wolf')
|
|
check(D.actors['0x2'].damage==450 and D.actors['0x2'].spells.Thorns.damage==17
|
|
and D.actors['0x2'].ownerKey=='0x1' and D.actors['0x2'].damageTargets['0xF1'].damage==450,
|
|
'a buffed pet owns its retaliation and keeps the owner relationship')
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_SPELL_DAMAGESHIELDS_ON_OTHERS',"0x2's Thorns hits 0xF1 for 17.")
|
|
check(D.actors['0x2'].damage==450,'RAW shield text cannot duplicate structured outgoing retaliation')
|
|
shield('0xF1','0x99',467,'Thorns',17,'Enemy','Outsider')
|
|
check(not D.actors['0x99'] and not D.guidToActor['0x99'],'unrelated friendly shield owners stay outside group totals')
|
|
D.dpsLogReceive('SPELL_DAMAGE','0x1','Hunter',1304,0,'0xF1','Enemy',68168,0,75,'Auto Shot',1,10,-1,1,0,0,0,nil)
|
|
D.dpsLogReceive('SPELL_HEAL','0x1','Hunter',1304,0,'0x2','Wolf',2584,0,136,'Mend Pet',8,100,40,0,nil)
|
|
check(D.actors['0x1'].damage==933 and D.actors['0x1'].healing==60,
|
|
'ordinary spell damage and healing keep their original source-target direction')
|
|
end
|
|
D.threatCalEnabled=false; D.dpsLogActive=false
|
|
D.dpsLogInitialized=nil; D.dpsLogRawCommitted=nil; D.dpsLogInitialize(); fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 19.')
|
|
NOW=NOW+0.6; D.dpsLogFrame.scripts.OnUpdate()
|
|
check(not D.dpsLogActive and not D.dpsLogProbing and D.actors['0x1'].damage==19,"API without event delivery replays RAW and falls back")
|
|
fire(D.dpsLogFrame,'COMBAT_LOG_EVENT_UNFILTERED')
|
|
check(D.actors['0x1'].damage==19,"late structured event cannot duplicate fallback damage")
|
|
CombatLogGetCurrentEventInfo=nil
|
|
fresh(); fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 17.')
|
|
check(D.actors['0x1'].damage==17,"legacy RAW remains functional without optional backend")
|
|
local function resetDpsDiscovery()
|
|
D.dpsLogInitialized=nil; D.dpsLogRawCommitted=nil; D.dpsLogActive=false
|
|
D.dpsLogProbing=false; D.dpsLogRegistered=false; D.dpsLogNextCheck=0
|
|
D.dpsLogInitialApiType=nil; D.dpsLogInitAttempts=0
|
|
CombatLogGetCurrentEventInfo=nil
|
|
D.dpsLogInitialize()
|
|
end
|
|
resetDpsDiscovery(); D.threatCalEnabled=true; D.threatCalNewSession()
|
|
check(not D.dpsLogInitialized and D.threatCalSession.dpsLogStatus.apiType=='nil'
|
|
and D.threatCalSession.dpsLogStatus.received~=nil,'absent startup API is retryable and saved even without events')
|
|
local lateApi=function() return 'SWING_DAMAGE','0x1','Hunter',1,0,'0xF1','Mob',64,0,23,-1,1,0,0,0,nil end
|
|
CombatLogGetCurrentEventInfo=lateApi
|
|
fire(D.dpsLogFrame,'PLAYER_ENTERING_WORLD')
|
|
check(D.dpsLogProbing and D.threatCalSession.dpsLogStatus.initialApiType=='nil'
|
|
and D.threatCalSession.dpsLogStatus.apiType=='function','world entry detects API published after addon load')
|
|
fresh(); fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 23.')
|
|
fire(D.dpsLogFrame,'PLAYER_ENTERING_WORLD')
|
|
check(table.getn(D.dpsLogQueue)==1,'repeated world entry preserves pending probe and queued RAW')
|
|
fire(D.dpsLogFrame,'COMBAT_LOG_EVENT_UNFILTERED')
|
|
check(D.dpsLogActive and D.actors['0x1'].damage==23,'late API delivers first hit once after queued RAW')
|
|
resetDpsDiscovery(); CombatLogGetCurrentEventInfo=lateApi
|
|
D.dpsLogFrame.scripts.OnUpdate()
|
|
check(D.dpsLogProbing,'timer discovers API published after world entry')
|
|
resetDpsDiscovery(); fresh(); CombatLogGetCurrentEventInfo=lateApi
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 23.')
|
|
fire(D.dpsLogFrame,'COMBAT_LOG_EVENT_UNFILTERED')
|
|
check(D.dpsLogActive and D.actors['0x1'].damage==23,'first RAW checks late API before committing any amount')
|
|
resetDpsDiscovery(); fresh()
|
|
fire(D.events,'RAW_COMBATLOG','CHAT_MSG_COMBAT_SELF_HITS','You hit 0xF1 for 23.')
|
|
CombatLogGetCurrentEventInfo=lateApi
|
|
fire(D.dpsLogFrame,'PLAYER_ENTERING_WORLD'); fire(D.dpsLogFrame,'COMBAT_LOG_EVENT_UNFILTERED')
|
|
check(not D.dpsLogActive and D.actors['0x1'].damage==23
|
|
and string.find(D.dpsLogFallback,'reload required',1,true),'API arriving after counted RAW cannot silently switch or duplicate')
|
|
fire(D.threatCalFrame,'PLAYER_LOGOUT')
|
|
check(D.threatCalSession.dpsLogStatus.rawCommitted and D.threatCalSession.dpsLogStatus.apiType=='function'
|
|
and D.threatCalSession.dpsLogStatus.fallback==D.dpsLogFallback,'logout saves actual API availability and reason for RAW input')
|
|
resetDpsDiscovery(); CombatLogGetCurrentEventInfo=lateApi
|
|
local register=D.dpsLogFrame.RegisterEvent
|
|
D.dpsLogFrame.RegisterEvent=function() error('event unavailable') end
|
|
D.dpsLogInitialize()
|
|
check(not D.dpsLogInitialized and string.find(D.dpsLogRegistrationError,'event unavailable',1,true),'failed event registration records error and remains retryable')
|
|
D.dpsLogFrame.RegisterEvent=register; D.dpsLogInitialize()
|
|
check(D.dpsLogProbing and D.dpsLogRegistrationError==nil,'event registration can recover after delayed availability')
|
|
GetWeirdUtilsVersion=function(name) if name=='logsessions' then return '1.1.0' end end
|
|
NOW=NOW+1
|
|
local moduleSession={}; D.dpsLogSaveStatus(moduleSession)
|
|
check(moduleSession.dpsLogStatus.modules.versions.logsessions=='1.1.0'
|
|
and moduleSession.dpsLogStatus.modules.versions.dpslog=='not reported','module status distinguishes missing DPSLog from registered sibling DLL')
|
|
GetWeirdUtilsVersion=function() error('version query failed') end
|
|
NOW=NOW+1
|
|
D.dpsLogSaveStatus(moduleSession)
|
|
check(moduleSession.dpsLogStatus.modules.versions.dpslog=='query failed','DLL version query errors do not break calibration')
|
|
GetWeirdUtilsVersion=nil
|
|
D.threatCalEnabled=false
|
|
-- DPSLog Community Edition delivers events through DpsLogPopEvent polling and no
|
|
-- longer fires the native COMBAT_LOG_EVENT_UNFILTERED. When polling is present, a
|
|
-- native event comes from an unrelated addon or client mod; processing it used to
|
|
-- reject a foreign header and, during the probe, drop the whole session to combat
|
|
-- text (community reports of "unsupported header" with DPSLog installed).
|
|
resetDpsDiscovery()
|
|
CombatLogGetCurrentEventInfo=function() return 1234.5,'SWING_DAMAGE','0x1','Hunter',1,'0xF1','Mob',64,30 end
|
|
local popQueue={}
|
|
DpsLogPopEvent=function()
|
|
local e=table.remove(popQueue,1)
|
|
if not e then return nil end
|
|
return e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8],e[9],e[10],e[11],e[12],e[13],e[14],e[15],e[16]
|
|
end
|
|
D.dpsLogInitialize()
|
|
check(D.dpsLogProbing and type(DpsLogPopEvent)=='function','CE install probes with polling available')
|
|
fresh(); local priorReject=D.dpsLogRejected
|
|
fire(D.dpsLogFrame,'COMBAT_LOG_EVENT_UNFILTERED')
|
|
check(D.dpsLogProbing and not D.dpsLogActive and D.dpsLogRejected==priorReject,
|
|
'a foreign native combat-log event is ignored while polling is available and cannot end the probe')
|
|
table.insert(popQueue,{'SWING_DAMAGE','0x1','Hunter',1,0,'0xF1','Mob',64,0,30,-1,1,0,0,0,'1'})
|
|
NOW=NOW+0.1; D.dpsLogFrame.scripts.OnUpdate()
|
|
check(D.dpsLogActive and D.actors['0x1'].damage==30 and D.dpsLogRejected==priorReject,
|
|
'polling delivers the first real event and selects DPSLog without any reject')
|
|
-- An old-DLL install (no polling) must still process the native event as before.
|
|
DpsLogPopEvent=nil
|
|
resetDpsDiscovery()
|
|
CombatLogGetCurrentEventInfo=function() return 'SWING_DAMAGE','0x1','Hunter',1,0,'0xF1','Mob',64,0,22,-1,1,0,0,0,'1' end
|
|
D.dpsLogInitialize(); fresh()
|
|
fire(D.dpsLogFrame,'COMBAT_LOG_EVENT_UNFILTERED')
|
|
check(D.dpsLogActive and D.actors['0x1'].damage==22,'without polling the native event still delivers DPSLog damage')
|
|
resetDpsDiscovery(); D.threatCalEnabled=false
|
|
print("Checks: "..count)
|