changeset 93:ea20a28327b5

More tweaks in preparation for MoP.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Wed, 18 Jul 2012 07:42:16 +0000
parents 01cfbfa96dd6
children db1d5d09e5f5
files core.lua gui.lua
diffstat 2 files changed, 25 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/core.lua	Tue Jul 17 03:24:36 2012 +0000
+++ b/core.lua	Wed Jul 18 07:42:16 2012 +0000
@@ -327,8 +327,13 @@
 do
 	local cc = {}
 	local function extract (color_info)
-		local hex = ("|cff%.2x%.2x%.2x"):format(255*color_info.r,
-			255*color_info.g, 255*color_info.b)
+		local hex
+		if color_info.colorStr then   -- MoP
+			hex = "|c" .. color_info.colorStr
+		else                          -- pre-MoP
+			hex = ("|cff%.2x%.2x%.2x"):format(255*color_info.r,
+				255*color_info.g, 255*color_info.b)
+		end
 		return { r=color_info.r, g=color_info.g, b=color_info.b, a=1, hex=hex }
 	end
 	local function fill_out_class_colors()
@@ -340,8 +345,9 @@
 	if CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS.RegisterCallback then
 		CUSTOM_CLASS_COLORS:RegisterCallback(fill_out_class_colors)
 	end
-	fill_out_class_colors()
-	addon.class_colors = cc
+	addon.class_colors = cc                               -- this stays around
+	addon.fill_out_class_colors = fill_out_class_colors   -- this doesn't
+
 	-- What I really want is to have the hooked :Print understand a special
 	-- format specifier like "%Cs" and do the colorizing automatically.
 	function addon:colorize (text, class)
@@ -379,6 +385,7 @@
 local pprint, tabledump = addon.pprint, flib.tabledump
 local CopyTable = _G.CopyTable
 local GetNumRaidMembers = _G.GetNumGroupMembers or _G.GetNumRaidMembers
+local IsInRaid = _G.IsInRaid or (function() return GetNumRaidMembers() > 0 end)
 -- 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
@@ -501,13 +508,13 @@
 	if (GetLFGMode()) and (GetLFGModeType() == 'raid') then
 		t,r = 'LFR', 25
 	elseif diffcode == 1 then
-		if GetNumRaidMembers() > 0 then
+		if IsInRaid() then
 			t,r = "10",10
 		else
 			t,r = "5",5
 		end
 	elseif diffcode == 2 then
-		if GetNumRaidMembers() > 0 then
+		if IsInRaid() then
 			t,r = "25",25
 		else
 			t,r = "5h",5
@@ -918,6 +925,13 @@
 		end
 	end
 
+	-- Copy these over once, now that other addons have mostly loaded.  Any
+	-- future tweaks via CUSTOM_CLASS_COLORS will trigger the same callback.
+	if addon.fill_out_class_colors then
+		addon.fill_out_class_colors()
+		addon.fill_out_class_colors = nil
+	end
+
 	while opts.keybinding do
 		if InCombatLockdown() then
 			local reload = self.format_hypertext ([[the options tab]],
@@ -1711,7 +1725,7 @@
 	self:RegisterEvent("PLAYER_ENTERING_WORLD",
 		function() self:ScheduleTimer("RAID_ROSTER_UPDATE", 5, "PLAYER_ENTERING_WORLD") end)
 	self.popped = true
-	if GetNumRaidMembers() > 0 then
+	if IsInRaid() then
 		self.dprint('flow', ">:Activate calling RRU")
 		self:RAID_ROSTER_UPDATE("Activate")
 	elseif self.debug.notraid then
@@ -1925,7 +1939,7 @@
 end
 
 function addon:_check_version (otherrev)
-	self.dprint('comm', "revchecking against", otherrev)
+	self.dprint('comm', version_large, "revchecking against", otherrev)
 	otherrev = tonumber(otherrev)
 	if otherrev == version_large then
 		-- normal case
--- a/gui.lua	Tue Jul 17 03:24:36 2012 +0000
+++ b/gui.lua	Wed Jul 18 07:42:16 2012 +0000
@@ -69,6 +69,7 @@
 local pprint, tabledump = addon.pprint, flib.tabledump
 local GetItemInfo, ITEM_QUALITY_COLORS = GetItemInfo, ITEM_QUALITY_COLORS
 local GetNumRaidMembers = GetNumGroupMembers or GetNumRaidMembers
+local IsInRaid = IsInRaid or (function() return GetNumRaidMembers() > 0 end)
 
 -- En masse forward decls of symbols defined inside local blocks
 local _generate_text, _populate_text_specials, _markup
@@ -1379,7 +1380,7 @@
 		specials:AddChild(b)
 
 		local people = { "<nobody>" }
-		for i=1,GetNumRaidMembers() do
+		for i = 1, GetNumRaidMembers() do
 			tinsert(people,(GetRaidRosterInfo(i)))
 		end
 		table.sort(people)
@@ -2124,7 +2125,6 @@
 		-- the nubtoggle!
 		w = mkoption('gui_noob', [[Show UI Tips]], 0.85,
 			[[Toggles display of the "helpful tips" box on the right side.  Useful if you've just installed/upgraded.]])
-		w:SetImage[[Interface\OptionsFrame\UI-OptionsFrame-NewFeatureIcon]]
 		grp:AddChild(w)
 		w = GUI:Create("Spacer") w:SetFullWidth(true) w:SetHeight(10) grp:AddChild(w)
 
@@ -3003,7 +3003,7 @@
 		data.name = text
 		dialog:Hide()  -- technically a "different" one about to be shown
 		StaticPopupDialogs["OUROL_EOI_INSERT"].autoCompleteParams =
-			AUTOCOMPLETE_LIST_TEMPLATES[GetNumRaidMembers() > 0 and "IN_GROUP" or "IN_GUILD"]
+			AUTOCOMPLETE_LIST_TEMPLATES[IsInRaid() and "IN_GROUP" or "IN_GUILD"]
 		local getrecipient = StaticPopup_Show("OUROL_EOI_INSERT","recipient")
 		StaticPopupDialogs["OUROL_EOI_INSERT"].autoCompleteParams = nil
 		getrecipient.data = data