changeset 17:d929c40cdb09

Small boosts, better version display. Do not wedge when receiving initial boss broadcast of a wipe while outside a raid instance.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Thu, 25 Aug 2011 08:50:33 +0000
parents 5ee4edd24c13
children ca797c0f32d4
files bossmods.lua core.lua gui.lua
diffstat 3 files changed, 20 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/bossmods.lua	Thu Aug 25 00:45:31 2011 +0000
+++ b/bossmods.lua	Thu Aug 25 08:50:33 2011 +0000
@@ -67,7 +67,10 @@
 		-- list?  probably too specific to guild practices.
 		local raiders = {}
 		for i = 1, GetNumRaidMembers() do
-			tinsert(raiders, (GetRaidRosterInfo(i)))
+			local name = GetRaidRosterInfo(i)
+			if name then
+				tinsert (raiders, name)
+			end
 		end
 		table.sort(raiders)
 
--- a/core.lua	Thu Aug 25 00:45:31 2011 +0000
+++ b/core.lua	Thu Aug 25 08:50:33 2011 +0000
@@ -1,4 +1,4 @@
-local addon = select(2,...)
+local nametag, addon = ...
 
 --[==[
 g_loot's numeric indices are loot entries (including titles, separators,
@@ -90,7 +90,8 @@
 -- Play cute games with namespaces here just to save typing.  WTB Lua 5.2 PST.
 do local _G = _G setfenv (1, addon)
 
-	revision		= 15
+	commrev			= 15  -- number
+	revision		= _G.GetAddOnMetadata(nametag,"Version") or "?"
 	ident			= "OuroLoot2"
 	identTg			= "OuroLoot2Tg"
 	status_text		= nil
@@ -975,7 +976,7 @@
 		possible_st:SetData(g_loot)
 	end
 
-	self.status_text = ("v2r%d communicating as ident %s"):format(self.revision,self.ident)
+	self.status_text = ("%s communicating as ident %s commrev %d"):format(self.revision,self.ident,self.commrev)
 	self:RegisterComm(self.ident)
 	self:RegisterComm(self.identTg, "OnCommReceivedNocache")
 
@@ -1064,8 +1065,8 @@
 				}
 				candidates = candidates or {}
 				tinsert(candidates,c)
-				break
 			end
+			break
 		end
 		self.dprint('loot',"<<_do_boss out")
 	end
@@ -1074,6 +1075,10 @@
 
 	function addon:_mark_boss_kill (index)
 		local e = g_loot[index]
+		if not e then
+			self:Print("Something horribly wrong;", index, "is not a valid entry!")
+			return
+		end
 		if not e.bosskill then
 			self:Print("Something horribly wrong;", index, "is not a boss entry!")
 			return
@@ -1171,7 +1176,7 @@
 	-- optional second index to search no earlier than it.
 	-- May also be able to make good use of this in forum-generation routine.
 	function addon:find_previous_time_entry(i,stop)
-		local stop = stop or 0
+		stop = stop or 0
 		while i > stop do
 			if g_loot[i].kind == 'time' then
 				return i, g_loot[i]
@@ -1257,7 +1262,8 @@
 		if is == should_be then --pprint('loot', "equal, yay")
 			return
 		end
-		if is < should_be then --pprint('loot', "...the hell? bailing")
+		if (type(is)~='number') or (type(should_be)~='number') or (is < should_be) then
+			--pprint('loot', "...the hell? bailing")
 			return
 		end
 		if g_loot[should_be].kind == 'time' then
@@ -1471,7 +1477,7 @@
 			addon.enabled and "tracking" or (addon.rebroadcast and "broadcasting" or "disabled"))
 	end
 	OCR_funcs.pong = function (sender, _, rev, status)
-		local s = ("|cff00ff00%s|r v2r%s is |cff00ffff%s|r"):format(sender,rev,status)
+		local s = ("|cff00ff00%s|r %s is |cff00ffff%s|r"):format(sender,rev,status)
 		addon:Print("Echo: ", s)
 		adduser (sender, s, status=="tracking" or status=="broadcasting" or nil)
 	end
--- a/gui.lua	Thu Aug 25 00:45:31 2011 +0000
+++ b/gui.lua	Thu Aug 25 08:50:33 2011 +0000
@@ -44,6 +44,7 @@
 
 local g_loot			= nil
 local g_generated		= nil
+local window_title		= "Ouro Loot"
 
 local pairs, ipairs, tinsert, tremove, tonumber = pairs, ipairs, table.insert, table.remove, tonumber
 
@@ -361,6 +362,7 @@
 	g_loot = loot_pointer
 	g_generated = nil
 	tabgroup_tabs = {}
+	window_title = "Ouro Loot " .. self.revision
 	for _,v in ipairs(_taborder) do
 		tinsert (tabgroup_tabs, {value=v, text=_tabtexts[v].title})
 		-- By default, tabs are editboxes with generated text
@@ -1732,7 +1734,7 @@
 	end
 	_d = display
 	self.display = display
-	display:SetTitle("Ouro Loot")
+	display:SetTitle(window_title)
 	display:SetStatusText(self.status_text)
 	display:SetLayout("Flow")
 	display:SetStatusTable{width=900,height=550}   -- default height is 500