Quantcast

Fix Party/Raid exempt list

Erik L. Vonderscheer [01-19-11 - 06:22]
Fix Party/Raid exempt list

Add AceTimer-3.0 for said exempt list if an UNKNOWN party member is discovered
Filename
.pkgmeta
TradeFilter3.lua
TradeFilter3.toc
TradeFilter3Options.lua
diff --git a/.pkgmeta b/.pkgmeta
index 9815f21..510d3c8 100644
--- a/.pkgmeta
+++ b/.pkgmeta
@@ -40,6 +40,9 @@ externals:
  libs/AceGUI-3.0:
   url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceGUI-3.0
   tag: latest
+ libs/AceTimer-3.0:
+  url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceTimer-3.0
+  tag: latest
  libs/AceAddon-3.0:
   url: svn://svn.wowace.com/wow/ace3/mainline/trunk/AceAddon-3.0
   tag: latest
diff --git a/TradeFilter3.lua b/TradeFilter3.lua
index 5e5d9ce..22db252 100644
--- a/TradeFilter3.lua
+++ b/TradeFilter3.lua
@@ -255,37 +255,61 @@ function TF3:GetColoredName(userID, cName)
 end

 --[[ Party Functions ]]--
-function TF3:GetParty()
+function TF3:GetParty(arg)
 	local currentParty = TF3.currentPartyMembers
 	local numPartyMembers = GetNumPartyMembers()
 	local numRaidMembers = GetNumRaidMembers()
-	if (numRaidMembers > 0 and #currentParty ~= numRaidMembers) then
-		TF3:WipeTable(TF3.currentPartyMembers)
-		for i=1, numRaidMembers do
-			local partymember = UnitName("raid"..i)
-			if partymember then
-				currentParty[i] = partymember
-				if (TF3.db.profile.debug) then
-					TF3:FindFrame(debugFrame, "|cFFFFFF80" .. currentParty[i] .. " " .. L["PADD"] .. "|r\n")
+	if (arg == "raid") then
+		if (numRaidMembers > 0 and #currentParty ~= numRaidMembers) then
+			TF3:WipeTable(TF3.currentPartyMembers)
+			for i=1, numRaidMembers, 1 do
+				local partyid = GetPartyMember(i)
+				local partymember = UnitName("raid"..i)
+				if (partymember and partyid and partymember ~= UNKNOWN) then
+					currentParty[i] = partymember
+					if (TF3.db.profile.debug) then
+						TF3:FindFrame(debugFrame, "|cFFFFFF80" .. partymember .. " " .. L["PADD"] .. "|r\n")
+					end
+				elseif (partymember == UNKNOWN or not partyid) then
+					if (TF3.db.profile.debug) then
+						TF3:FindFrame(debugFrame, "|cFFFFFF80" .. L["MIPM"] .. "|r")
+					end
+					self:ScheduleTimer("GetParty", 10, "raid")
+					break
 				end
 			end
-		end
-	elseif (numPartyMembers > 0 and #currentParty ~= numPartyMembers) then
-		TF3:WipeTable(currentParty)
-		for i=1, numPartyMembers do
-			local partymember = UnitName("party"..i)
-			if partymember then
-				currentParty[i] = partymember
-				if (TF3.db.profile.debug) then
-					TF3:FindFrame(debugFrame, "|cFFFFFF80" .. currentParty[i] .. " " .. L["PADD"] .. "|r\n")
-				end
+		elseif (numPartyMembers == 0) then
+			if (TF3.db.profile.debug) then
+				TF3:FindFrame(debugFrame, "|cFFFFFF80" .. L["Wiping party exempt list"] .. "|r")
 			end
+			TF3:WipeTable(currentParty)
 		end
-	elseif (numPartyMembers == 0 and numRaidMembers == 0) then
-		if (TF3.db.profile.debug) then
-			TF3:FindFrame(debugFrame, "|cFFFFFF80" .. L["Wiping party exempt list"] .. "|r")
+	end
+	if (arg == "party") then
+		if (numPartyMembers > 0 and #currentParty ~= numPartyMembers) then
+			TF3:WipeTable(currentParty)
+			for i=1, numPartyMembers, 1 do
+				local partyid = GetPartyMember(i)
+				local partymember = UnitName("party"..i)
+				if (partymember and partyid and partymember ~= UNKNOWN) then
+					currentParty[i] = partymember
+					if (TF3.db.profile.debug) then
+						TF3:FindFrame(debugFrame, "|cFFFFFF80" .. partymember .. " " .. L["PADD"] .. "|r\n")
+					end
+				elseif (partymember == UNKNOWN or not partyid) then
+					if (TF3.db.profile.debug) then
+						TF3:FindFrame(debugFrame, "|cFFFFFF80" .. L["MIPM"] .. "|r")
+					end
+					self:ScheduleTimer("GetParty", 10, "party")
+					break
+				end
+			end
+		elseif (numPartyMembers == 0) then
+			if (TF3.db.profile.debug) then
+				TF3:FindFrame(debugFrame, "|cFFFFFF80" .. L["Wiping party exempt list"] .. "|r")
+			end
+			TF3:WipeTable(currentParty)
 		end
-		TF3:WipeTable(currentParty)
 	end
 end

diff --git a/TradeFilter3.toc b/TradeFilter3.toc
index 90e365f..39c8aaa 100644
--- a/TradeFilter3.toc
+++ b/TradeFilter3.toc
@@ -37,6 +37,7 @@ libs\AceConsole-3.0\AceConsole-3.0.xml
 libs\AceDB-3.0\AceDB-3.0.xml
 libs\AceDBOptions-3.0\AceDBOptions-3.0.xml
 libs\AceEvent-3.0\AceEvent-3.0.xml
+libs\AceTimer-3.0\AceTimer-3.0.xml
 libs\AceGUI-3.0\AceGUI-3.0.xml
 libs\AceLocale-3.0\AceLocale-3.0.xml
 libs\AceConfig-3.0\AceConfig-3.0.xml
diff --git a/TradeFilter3Options.lua b/TradeFilter3Options.lua
index 0a4ec0a..65e250d 100644
--- a/TradeFilter3Options.lua
+++ b/TradeFilter3Options.lua
@@ -795,17 +795,23 @@ function TF3:getOptions()
 									end,
 									name = L["Exempt Party Members"],
 									args = {
-		--~ 								rescan_party = {
-		--~ 									type = 'execute',
-		--~ 									order = 1,
-		--~ 									name = "GetParty()",
-		--~ 									func = function() TF3:GetParty() end,
-		--~ 								},
+--~ 		 								rescan_party = {
+--~ 		 									type = 'execute',
+--~ 		 									order = 1,
+--~ 		 									name = "GetParty(\"pary\")",
+--~ 		 									func = function() TF3:GetParty("party") end,
+--~ 		 								},
+--~ 		 								rescan_raid = {
+--~ 		 									type = 'execute',
+--~ 		 									order = 2,
+--~ 		 									name = "GetParty(\"raid\")",
+--~ 		 									func = function() TF3:GetParty("raid") end,
+--~ 		 								},
 										currentPartyMembers_table_content = {
 											type = 'description',
 											fontSize = "medium",
 											disabled = true,
-											order = 2,
+											order = 3,
 											name = function()
 												local ret = ""
 												for k,v in pairs(TF3.currentPartyMembers) do