A Pyroguard Emberseer
Join Date: Mar 2010
Posts: 1,029
|
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:
local toc = select(4, GetBuildInfo()) function MyAddOn:COMBAT_LOG_EVENT_UNFILTERED(event, ...) local timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags local spellID, spellName, spellSchool local SuffixParam1, SuffixParam2, SuffixParam3, SuffixParam4, SuffixParam5, SuffixParam6, SuffixParam7, SuffixParam8, SuffixParam9 local suffixPos if toc >= 40200 then timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, sourceRaidFlags, destGUID, destName, destFlags, destRaidFlags = ... suffixPos = 12 else timestamp, subevent, hideCaster, sourceGUID, sourceName, sourceFlags, destGUID, destName, destFlags = ... suffixPos = 10 end local prefix = strsub(subevent, 1, 5) if prefix == "SWING" then SuffixParam1, SuffixParam2, SuffixParam3, SuffixParam4, SuffixParam5, SuffixParam6, SuffixParam7, SuffixParam8, SuffixParam9 = select(suffixPos, ...) elseif prefix == "SPELL" or prefix == "RANGE" then spellID, spellName, spellSchool, SuffixParam1, SuffixParam2, SuffixParam3, SuffixParam4, SuffixParam5, SuffixParam6, SuffixParam7, SuffixParam8, SuffixParam9 = select(suffixPos, ...) end -- do stuff 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.
|