Thread Tools Display Modes
05-05-11, 07:52 AM   #1
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
4.2 COMBAT_LOG_EVENT_UNFILTERED changed (again)

  • 4.1: timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags
  • 4.2: timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags
It seems that Blizzard has run out of space on the original UnitFlags, so they had to add another pair of UnitFlags parameters, and for now at least, moved the Raid Target Icon Flags into there
  • FrameXML
    Blizzard_CombatLog.lua L2180 CombatLog_OnEvent
    Blizzard_CombatLog.lua L2037 CombatLog_String_GetIcon
-- credits to the wowace.com, us.battle.net threads

Last edited by Ketho : 05-25-11 at 04:49 PM.
  Reply With Quote
05-05-11, 11:38 AM   #2
Rilgamon
Premium Member
 
Rilgamon's Avatar
Premium Member
AddOn Author - Click to view addons
Join Date: Sep 2009
Posts: 822
hehe, we're not even trough with the first change
__________________
The cataclysm broke the world ... and the pandas could not fix it!
  Reply With Quote
05-12-11, 12:31 PM   #3
Ketho
A Pyroguard Emberseer
 
Ketho's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2010
Posts: 1,026
This time Blizzard wasn't so lazy and properly updated the TOC on the PTRs to 40200 which is less of a hassle
I'm interested in the solutions for forwards compatibility, and I want to share some myself
  • Quoting the forwards compatible fix of Omegal:
    Code:
    -- fix for 4.2 which introduces some new argument
    -- this is a temporary work-around which just drops the new argument for a quick and easy fix that is compatible with 4.2
    if tonumber((select(4, GetBuildInfo()))) >= 40200 then
    	local oldHandler = mod.COMBAT_LOG_EVENT_UNFILTERED
    	function mod:COMBAT_LOG_EVENT_UNFILTERED(timestamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, mysteryArgument, destGUID, destName, destFlags, anotherMysteryArgument, ...)
    		return oldHandler(self, timestamp, event, hideCaster, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags, ...)
    	end
    end
  • Here is my own (Ace3) fowards compatible fix:
    Lua Code:
    1. local toc = select(4, GetBuildInfo())
    2.  
    3. function MyAddOn:COMBAT_LOG_EVENT_UNFILTERED(event, ...)
    4.     local timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags
    5.     local spellID, spellName, spellSchool
    6.     local SuffixParam1, SuffixParam2, SuffixParam3, SuffixParam4, SuffixParam5, SuffixParam6, SuffixParam7, SuffixParam8, SuffixParam9
    7.  
    8.     local suffixPos
    9.     if toc >= 40200 then
    10.         timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ...
    11.         suffixPos = 12
    12.     else
    13.         timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = ...
    14.         suffixPos = 10
    15.     end
    16.  
    17.     local prefix = strsub(subevent, 1, 5)
    18.     if prefix == "SWING" then
    19.         SuffixParam1, SuffixParam2, SuffixParam3, SuffixParam4, SuffixParam5, SuffixParam6, SuffixParam7, SuffixParam8, SuffixParam9 = select(suffixPos, ...)
    20.     elseif prefix == "SPELL" or prefix == "RANGE" then
    21.         spellID, spellName, spellSchool, SuffixParam1, SuffixParam2, SuffixParam3, SuffixParam4, SuffixParam5, SuffixParam6, SuffixParam7, SuffixParam8, SuffixParam9 = select(suffixPos, ...)
    22.     end
    23.  
    24.     -- do stuff
    25. end
I've also seen some addons use a "tail call" solution for patch 4.1.0,
but I'm not sure how it would be done now for patch 4.2.0

Edit:
Myself I still don't really understand the mod stuff/solution though, but somehow it looks like a way better solution .. (><)

Last edited by Ketho : 05-12-11 at 12:48 PM.
  Reply With Quote
05-12-11, 01:00 PM   #4
Ailae
A Rage Talon Dragon Guard
 
Ailae's Avatar
AddOn Author - Click to view addons
Join Date: Dec 2007
Posts: 318
It saves a reference to the old handler for CLEU and then declares a new one. The new one then has the new parameters in the function-call (so things line up correctly) and then just passes the all parameters besides the new ones to the old handler.
__________________
Oh, the simulated horror!
  Reply With Quote
05-13-11, 10:29 PM   #5
Xinhuan
A Chromatic Dragonspawn
 
Xinhuan's Avatar
AddOn Author - Click to view addons
Join Date: Feb 2007
Posts: 174
I use this for pre-4.1, 4.1 and 4.2 compat:

lua Code:
  1. local TOC -- Pre-4.1 CLEU compat
  2. local dummyTable = {}
  3. local recurse = true
  4. do
  5.     -- Because GetBuildInfo() still returns 40000 on the PTR
  6.     local major, minor, rev = strsplit(".", (GetBuildInfo()))
  7.     TOC = major*10000 + minor*100
  8. end
  9. function Omen:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, eventtype, hideCaster, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...)
  10.     -- Pre-4.1 CLEU compat
  11.     if TOC < 40100 and hideCaster ~= dummyTable then
  12.         -- Insert a dummy for the new argument introduced in 4.1 and perform a tail call
  13.         return self:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, eventtype, dummyTable, hideCaster, srcGUID, srcName, srcFlags, dstGUID, dstName, dstFlags, ...)
  14.     elseif TOC >= 40200 and recurse then
  15.         local arg1 = ...
  16.         recurse = false
  17.         return self:COMBAT_LOG_EVENT_UNFILTERED(event, timestamp, eventtype, hideCaster, srcGUID, srcName, srcFlags, dstName, dstFlags, arg1, select(3, ...))
  18.     end
  19.     recurse = true
  20.  
  21.     -- Rest of Omen code
  22. end

It only uses tailcalls if the version is NOT 4.1, so for standard users suffer no performance penalties. Omegal's solution is essentially the same thing, just that he created a second function to call the original, and I instead made the function call itself.

Note the unorthodox way of calculating the TOC only because for most of the 4.1 PTR testing, the 4th return of GetBuildInfo() returned 40000 rather than 40100.
__________________
Author of Postal, Omen3, GemHelper, BankItems, WoWEquip, GatherMate, GatherMate2, Routes and Cartographer_Routes
  Reply With Quote

WoWInterface » Developer Discussions » Tutorials & Other Helpful Info. » 4.2 COMBAT_LOG_EVENT_UNFILTERED changed (again)

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off