diff text_tabs.lua @ 109:ce45011fab4c

- Test for errors during startup before trying to manipulate data. - Thin encapsulation around dispositions. Abstract everything except the insertion into GUI dropdowns (that comes next).
author Farmbuyer of US-Kilrogg <farmbuyer@gmail.com>
date Wed, 08 Aug 2012 14:43:26 -0400
parents fe04f5c4114a
children 67bf97136273
line wrap: on
line diff
--- a/text_tabs.lua	Mon Aug 06 14:57:14 2012 -0400
+++ b/text_tabs.lua	Wed Aug 08 14:43:26 2012 -0400
@@ -61,17 +61,21 @@
 		local e = loot[i]
 
 		if e.kind == 'loot' then
-			-- Assuming nobody names a toon "offspec" or "gvault"
-			-- 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'
-			elseif disp == 'gvault' then
-				--disp = "guild vault (".. e.person .. ")"
-				disp = "guild vault"
+			local destination = e.person
+			if e.disposition then
+				local disp = e.disposition
+				local disptext = addon:_test_disposition(disp,'text')
+				if disp == 'offspec' then
+					destination = e.person .. " " .. disptext
+				elseif disp == 'gvault' then
+					--destination = ("%s (%s)"):format(disptext,e.person)
+					destination = disptext
+				else
+					destination = disptext
+				end
 			end
 			if e.extratext_byhand then
-				disp = disp .. " -- " .. e.extratext
+				destination = destination .. " -- " .. e.extratext
 			end
 			if e.variant and not forum_warned_heroic then
 				forum_warned_heroic = true
@@ -80,7 +84,7 @@
 			local t = fmt:gsub('%$I', e.id)
 			             :gsub('%$N', e.itemname)
 			             :gsub('%$X', e.count or "")
-			             :gsub('%$T', disp)
+			             :gsub('%$T', destination)
 			cache[#cache+1] = t
 
 		elseif e.kind == 'boss' and e.reason == 'kill' then
@@ -210,4 +214,5 @@
 
 addon:register_text_generator ("attend", [[Attendance]], [[Attendance list for each kill]], att, att_specials)
 
+addon.FILES_LOADED = addon.FILES_LOADED + 1
 -- vim:noet