Quantcast

The Targeting module should now work in parties, and it'll also scan pets now.

Scott Sibley [07-03-11 - 03:47]
The Targeting module should now work in parties, and it'll also scan pets now.
Filename
Modules/Targeting/Targeting.lua
diff --git a/Modules/Targeting/Targeting.lua b/Modules/Targeting/Targeting.lua
index ca2a80c..406eb5f 100644
--- a/Modules/Targeting/Targeting.lua
+++ b/Modules/Targeting/Targeting.lua
@@ -18,14 +18,34 @@ function mod:OnDisable()
 end

 function mod:SetUnit()
-	if UnitInRaid("player") then
+	if UnitInRaid("player") or UnitInParty("player") and UnitExists(StarTip.unit) then
 		local txt = ''
+		local guid = UnitGUID(StarTip.unit)
 		for i=1, GetNumRaidMembers() do
-			if UnitExists("mouseover") and UnitGUID("mouseover") == UnitGUID("raid" .. i .. "target") then
+			if guid == UnitGUID("raid" .. i .. "target") then
 				local c = RAID_CLASS_COLORS[select(2, UnitClass("raid" .. i))]
 				local name = UnitName("raid" .. i)
 				txt = txt .. ("|cFF%02x%02x%02x%s|r "):format(c.r*255, c.g*255, c.b*255, name)
 			end
+			if guid == UnitGUID("raid" .. i .. "pettarget") then
+				local c = RAID_CLASS_COLORS[select(2, UnitClass("raid" .. i))]
+				local name = UnitName("raid"..i.."pet")
+				txt = txt .. ("|cFF%02x%02x%02x%s (pet)|r "):format(c.r*255, c.g*255, c.b*255, name)
+			end
+		end
+		if not UnitInRaid("player") then
+			for i = 1, GetNumPartyMembers() do
+				if UnitGUID(StarTip.unit) == UnitGUID("party" .. i .. "target") then
+					local c = RAID_CLASS_COLORS[select(2, UnitClass("party" .. i))]
+					local name = UnitName("party" .. i)
+					txt = txt .. ("|cFF%02x%02x%02x%s|r "):format(c.r*255, c.g*255, c.b*255, name)
+				end
+				if UnitGUID(StarTip.unit) == UnitGUID("party" .. i .. "pettarget") then
+					local c = RAID_CLASS_COLORS[select(2, UnitClass("party" .. i))]
+					local name = UnitName("party" .. i .. "pettarget")
+					txt = txt .. ("|cFF%02x%02x%02x%s (pet)|r "):format(c.r*255, c.g*255, c.b*255, name)
+				end
+			end
 		end
 		if txt ~= '' then
 			GameTooltip:AddLine("Targeting: " .. txt, .5, .5, 1, 1)