diff core.lua @ 90:92e0db376858

Some initial prep for MoP API transition. (Some of this can be removed post-MoP-release, but fewer changes will need to be made the day of.)
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Sun, 01 Jul 2012 17:16:42 +0000
parents 939569ded66f
children 01cfbfa96dd6
line wrap: on
line diff
--- a/core.lua	Thu Jun 28 19:44:53 2012 +0000
+++ b/core.lua	Sun Jul 01 17:16:42 2012 +0000
@@ -110,6 +110,8 @@
 
 
 ------ Constants
+local RAID_ROSTER_UPDATE_EVENT =
+	(select(4,GetBuildInfo()) >= 50000) and 'GROUP_ROSTER_UPDATE' or 'RAID_ROSTER_UPDATE'
 local option_defaults = {
 	['datarev'] = 20,    -- cheating, this isn't actually an option
 	['popup_on_join'] = true,
@@ -377,7 +379,8 @@
 local wipe = _G.table.wipe
 
 local pprint, tabledump = addon.pprint, flib.tabledump
-local CopyTable, GetNumRaidMembers = _G.CopyTable, _G.GetNumRaidMembers
+local CopyTable = _G.CopyTable
+local GetNumRaidMembers = _G.GetNumGroupMembers or _G.GetNumRaidMembers
 -- En masse forward decls of symbols defined inside local blocks
 local _register_bossmod, makedate, create_new_cache, _init, _log
 local _history_by_loot_id, _setup_unique_replace, _unavoidable_collision
@@ -883,7 +886,7 @@
 
 function addon:OnEnable()
 	self:RegisterEvent("PLAYER_LOGOUT")
-	self:RegisterEvent("RAID_ROSTER_UPDATE")
+	self:RegisterEvent(RAID_ROSTER_UPDATE_EVENT,"RAID_ROSTER_UPDATE")
 
 	-- Cribbed from Talented.  I like the way jerry thinks: the first string
 	-- argument can be a format spec for the remainder of the arguments.
@@ -1088,7 +1091,7 @@
 	_G.ReloadUI()
 end
 function addon:PLAYER_LOGOUT()
-	self:UnregisterEvent("RAID_ROSTER_UPDATE")
+	self:UnregisterEvent(RAID_ROSTER_UPDATE_EVENT)
 	self:UnregisterEvent("PLAYER_ENTERING_WORLD")
 
 	local worth_saving = #g_loot > 0 or _G.next(g_loot.raiders)
@@ -1237,7 +1240,7 @@
 			self:RegisterEvent("CHAT_MSG_LOOT")
 			_register_bossmod(self)
 			docheck = true
-		elseif event == "RAID_ROSTER_UPDATE" then
+		elseif event == RAID_ROSTER_UPDATE_EVENT then
 			-- hot code path, be careful
 
 			-- event registration from onload, joined a raid, maybe show popup
@@ -1706,7 +1709,7 @@
 -- Both of these need to be (effectively) idempotent.
 function addon:Activate (opt_threshold, opt_bcast_only)
 	self.dprint('flow', ":Activate is running")
-	self:RegisterEvent("RAID_ROSTER_UPDATE")
+	self:RegisterEvent(RAID_ROSTER_UPDATE_EVENT,"RAID_ROSTER_UPDATE")
 	self:RegisterEvent("PLAYER_ENTERING_WORLD",
 		function() self:ScheduleTimer("RAID_ROSTER_UPDATE", 5, "PLAYER_ENTERING_WORLD") end)
 	self.popped = true
@@ -1748,7 +1751,7 @@
 function addon:Deactivate()
 	self.enabled = false
 	self.rebroadcast = false
-	self:UnregisterEvent("RAID_ROSTER_UPDATE")
+	self:UnregisterEvent(RAID_ROSTER_UPDATE_EVENT)
 	self:UnregisterEvent("PLAYER_ENTERING_WORLD")
 	self:UnregisterEvent("CHAT_MSG_LOOT")
 	self:Print("Deactivated.")