changeset 65:69fd720f853e

Add display_bcast_from option.
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Fri, 27 Apr 2012 09:12:45 +0000
parents 359d0159d6ca
children 43913e02a1ef
files core.lua gui.lua text_tabs.lua
diffstat 3 files changed, 53 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/core.lua	Fri Apr 20 04:41:10 2012 +0000
+++ b/core.lua	Fri Apr 27 09:12:45 2012 +0000
@@ -58,7 +58,9 @@
                 dropped double axes today"
 - is_heroic     true if item is heroic; missing otherwise
 - cache_miss    if GetItemInfo failed; SHOULD be missing (changes other fields)
-- bcast_from    if rebroadcast from another player; missing otherwise
+- bcast_from    player's name if received rebroadcast from that player;
+                missing otherwise; can be deleted as a result of in-game
+                fiddling of loot data
 - extratext     text in Note column, including disposition and rebroadcasting
 - extratext_byhand    true if text edited by player directly; missing otherwise
 
@@ -124,6 +126,7 @@
 	},
 	['forum_current'] = '[item] by name',
 	['display_disabled_LODs'] = false,
+	['display_bcast_from'] = true,
 }
 local virgin = "First time loaded?  Hi!  Use the /ouroloot or /loot command"
 	.." to show the main display.  You should probably browse the instructions"
@@ -273,7 +276,7 @@
 		r = 1000*r + d
 	end
 	-- If it's a big enough number to obviously be a release, then make
-	-- sure it's big enough to overcome many small point releases.
+	-- sure it's big enough to overcome many small previous point releases.
 	while r > 2000 and r < 2000000 do
 		r = 1000*r
 	end
@@ -463,6 +466,8 @@
 			s:Print(virgin, s.format_hypertext('help',"click here",ITEM_QUALITY_UNCOMMON))
 			virgin = nil
 		end,10,self)
+	else
+		virgin = nil
 	end
 	opts = OuroLootSV_opts
 	local stored_datarev = opts.datarev
@@ -1083,7 +1088,8 @@
 				end
 			end
 
-			self.dprint('loot', "CHAT_MSG_LOOT, person is", person, ", itemstring is", itemstring, ", count is", count)
+			self.dprint('loot', "CHAT_MSG_LOOT, person is", person,
+				", itemstring is", itemstring, ", count is", count)
 			if not itemstring then return end    -- "So-and-So selected Greed", etc, not actual looting
 
 			-- Name might be colorized, remove the highlighting
@@ -1128,7 +1134,7 @@
 
 	if cmd == "" then
 		if InCombatLockdown() then
-			return self:Print("Can't display window in combat.")
+			return self:Print("Shouldn't display window in combat.")
 		else
 			return self:BuildMainDisplay()
 		end
@@ -1660,7 +1666,6 @@
 		end
 
 		if self.bossmods[x].r (self, _do_boss) then
-			--self.bossmod_registered = x
 			self.bossmod_registered = self.bossmods[x].n
 		else
 			self:Print("|cffff1010Boss mod registration failed|r")
@@ -1684,7 +1689,7 @@
 
 	-- Given a loot index, searches backwards for a timestamp.  Returns that
 	-- index and the time entry, or nil if it falls off the beginning.  Pass an
-	-- optional second index to search no earlier than it.
+	-- optional second index to search no earlier than that.
 	-- May also be able to make good use of this in forum-generation routine.
 	function addon:find_previous_time_entry(i,stop)
 		stop = stop or 0
--- a/gui.lua	Fri Apr 20 04:41:10 2012 +0000
+++ b/gui.lua	Fri Apr 27 09:12:45 2012 +0000
@@ -253,6 +253,7 @@
 				return
 			end
 
+			local display_bcast_from = OuroLootSV_opts.display_bcast_from
 			-- XXX FIXME a major weakness here is that we're constantly replacing
 			-- what's already been created.  Lots of garbage.  Trying to detect what
 			-- actually needs to be replaced is even worse.  We'll live with
@@ -272,11 +273,12 @@
 						break
 					end
 				end end
-				local ex = eoi_st_lootrow_col3_colortable[e.disposition or ""].text
-				if e.bcast_from and e.extratext then
+				local ex = e.disposition or ""
+				ex = eoi_st_lootrow_col3_colortable[ex].text
+				if e.bcast_from and display_bcast_from and e.extratext then
 					ex = e.extratext .. " (from " .. e.bcast_from .. ")"
-				elseif e.bcast_from then
-					ex = "(from " .. e.bcast_from .. ")"
+				elseif e.bcast_from and display_bcast_from then
+					ex = ex .. " (from " .. e.bcast_from .. ")"
 				elseif e.extratext then
 					ex = e.extratext
 				end
@@ -1506,15 +1508,18 @@
 
 -- Tab 6:  Options / Advanced
 do
+	-- Local ref to OuroLootSV_opts, which may be reassigned after load.
+	-- So instead this is updated when the tab is displayed.
+	local opts
 	local function mkoption (opt, label, width, desc, opt_func)
 		local w = mkbutton("CheckBoxSmallLabel", nil, "", desc)
 		w:SetRelativeWidth(width)
 		w:SetType("checkbox")
 		w:SetLabel(label)
 		if opt then
-			w:SetValue(OuroLootSV_opts[opt])
+			w:SetValue(opts[opt])
 			w:SetCallback("OnValueChanged", opt_func or (function(_w,event,value)
-				OuroLootSV_opts[opt] = value
+				opts[opt] = value
 			end))
 		end
 		return w
@@ -1688,6 +1693,8 @@
 	end
 
 	tabs_OnGroupSelected["opt"] = function(container,specials)
+		opts = OuroLootSV_opts
+
 		--container:SetLayout("List")
 		container:SetLayout("Fill")
 		local scroll, grp, w
@@ -1738,25 +1745,34 @@
 			[[Show loadable plugins even if they've been disabled (and offer to enable them).  Relog to take effect.]])
 		grp:AddChild(w)
 
+		-- showing the "(from Rebroadcasterdude)" in the notes column
+		w = mkoption('display_bcast_from', "Show rebroadcasting player", 0.49,
+			[[Include "(from Player_Name)" in the Notes column for loot that was broadcast to you.]],
+			function(_w,_e,value)
+				opts.display_bcast_from = value
+				addon.loot_clean = nil
+			end)
+		grp:AddChild(w)
+
 		-- possible keybindings
 		do
 			local pair = GUI:Create("SimpleGroup")
 			pair:SetLayout("Flow")
 			pair:SetRelativeWidth(0.95)
 			local editbox, checkbox
-			editbox = mkbutton("EditBox", nil, OuroLootSV_opts.keybinding_text,
+			editbox = mkbutton("EditBox", nil, opts.keybinding_text,
 				[[Keybinding text format is fragile!  Relog to take effect.]])
 			editbox:SetRelativeWidth(0.5)
 			editbox:SetLabel("Keybinding text")
 			editbox:SetCallback("OnEnterPressed", function(_w,event,value)
-				OuroLootSV_opts.keybinding_text = value
+				opts.keybinding_text = value
 			end)
-			editbox:SetDisabled(not OuroLootSV_opts.keybinding)
+			editbox:SetDisabled(not opts.keybinding)
 			checkbox = mkoption('keybinding', "Register keybinding", 0.5,
 				[[Register a keybinding to toggle the loot display.  Relog to take effect.]],
 				function (_w,_,value)
-					OuroLootSV_opts.keybinding = value
-					editbox:SetDisabled(not OuroLootSV_opts.keybinding)
+					opts.keybinding = value
+					editbox:SetDisabled(not opts.keybinding)
 				end)
 			pair:AddChild(checkbox)
 			pair:AddChild(editbox)
@@ -1773,7 +1789,7 @@
 			local current
 			for k,v in ipairs(addon.bossmods) do
 				list[k] = v.n
-				if v.n == OuroLootSV_opts.bossmod then
+				if v.n == opts.bossmod then
 					current = k
 				end
 			end
@@ -1783,7 +1799,7 @@
 			w:SetList(list)
 			w:SetValue(current)
 			w:SetCallback("OnValueChanged", function(_w,event,choice)
-				OuroLootSV_opts.bossmod = list[choice]
+				opts.bossmod = list[choice]
 			end)
 			grp:AddChild(w)
 		end
@@ -1796,7 +1812,7 @@
 		do
 			local list = {}
 			local cache_warn, cache_warned = false, false
-			for id in pairs(OuroLootSV_opts.itemfilter) do
+			for id in pairs(opts.itemfilter) do
 				local iname, _, iquality = GetItemInfo(id)
 				if iname then
 					list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r"
@@ -1816,12 +1832,12 @@
 				end
 				local id = tonumber(ilink:match("item:(%d+)"))
 				list[id] = ITEM_QUALITY_COLORS[iquality].hex .. iname .. "|r"
-				OuroLootSV_opts.itemfilter[id] = true
+				opts.itemfilter[id] = true
 				addon:Print("Now filtering out", ilink)
 			end)
 			w:SetCallback("OnListItemClicked", function(_w, _, key_id, val_name)
 				--local ilink = select(2,GetItemInfo(key_id))
-				OuroLootSV_opts.itemfilter[tonumber(key_id)] = nil
+				opts.itemfilter[tonumber(key_id)] = nil
 				--addon:Print("No longer filtering out", ilink)
 				addon:Print("No longer filtering out", val_name)
 			end)
--- a/text_tabs.lua	Fri Apr 20 04:41:10 2012 +0000
+++ b/text_tabs.lua	Fri Apr 27 09:12:45 2012 +0000
@@ -35,11 +35,12 @@
     CONTAINER:  widget container (already has 'Regenerate' button in it)
     MKBUTTON:  function to create more AceGUI widgets, as follows:
 
-mkbutton ("WidgetType", 'display key', "Text On Widget", "the mouseover display text")
-mkbutton ( [Button]     'display key', "Text On Widget", "the mouseover display text")
-mkbutton ( [Button]      [text]        "Text On Widget", "the mouseover display text")
+mkbutton ("WidgetType", 'display key', "Text On Widget", "mouseover text")
+mkbutton ( [Button]     'display key', "Text On Widget", "mouseover text")
+mkbutton ( [Button]      [text]        "Text On Widget", "mouseover text")
 
-The 'display key' parameter will almost certainly be specified as nil for these functions.
+The 'display key' parameter will almost certainly be specified as nil for
+these functions.
 ]]
 
 local forum_warned_heroic
@@ -60,7 +61,7 @@
 
 		if e.kind == 'loot' then
 			-- Assuming nobody names a toon "offspec" or "gvault"
-			-- 16Apr2011:  armory finds 20 Gvaults and 77 Offspecs... hulk smash.
+			-- 16Apr2011: armory finds 20 Gvaults and 77 Offspecs... hulk smash.
 			local disp = e.disposition or e.person
 			if disp == 'offspec' then
 				disp = e.person .. " " .. 'offspec'
@@ -82,7 +83,8 @@
 			cache[#cache+1] = t
 
 		elseif e.kind == 'boss' and e.reason == 'kill' then
-			-- first boss in an instance gets an instance tag, others get a blank line
+			-- The first boss in an instance gets an instance tag, others
+			-- get a blank line
 			if generated.last_instance == e.instance then
 				cache[#cache+1] = ""
 			else
@@ -177,8 +179,8 @@
 			-- (e.g., "we're dropping to 10-man for the PvP boss")
 			local i,o = do_attendance (e.raidersnap, e.maxsize / MEMBERS_PER_RAID_GROUP)
 
-			cache[#cache+1] = ("\n%s -- %s\n{+} %s\n{-} %s\n"):format(e.instance,
-				e.bossname, i, o)
+			cache[#cache+1] = ("\n%s -- %s\n{+} %s\n{-} %s\n"):
+				format(e.instance, e.bossname, i, o)
 
 		elseif e.kind == 'time' then
 			cache[#cache+1] = e.startday.text