Quantcast

Add a more detailed owner string

Adrian L Lange [08-07-09 - 17:06]
Add a more detailed owner string
Filename
oUF_P3lim.lua
diff --git a/oUF_P3lim.lua b/oUF_P3lim.lua
index dd24c3f..943c911 100644
--- a/oUF_P3lim.lua
+++ b/oUF_P3lim.lua
@@ -5,7 +5,7 @@

 --]]

-local format = string.format
+local match, format, gsub = string.match, string.format, string.gsub

 local localized, class = UnitClass('player')
 local texture = [=[Interface\AddOns\oUF_P3lim\media\minimalist]=]
@@ -86,7 +86,20 @@ local function castbarTime(self, duration)
 end

 local function hookTooltip(self)
-	GameTooltip:AddLine(format('Casted by %s', self.owner and UnitName(self.owner) or UNKNOWN))
+	if(self.owner) then
+		if(self.owner == 'vehicle' or self.owner == 'pet') then
+			GameTooltip:AddLine(format('Cast by %s <%s>', UnitName(self.owner), UnitName('player')))
+		elseif(self.owner:match('^partypet[1-4]$')) then
+			GameTooltip:AddLine(format('Cast by %s <%s>', UnitName(self.owner), UnitName(format('party%d', self.owner:gsub('^partypet(%d)$', '%1')))))
+		elseif(self.owner:match('^raidpet[1-40]$')) then
+			GameTooltip:AddLine(format('Cast by %s <%s>', UnitName(self.owner), UnitName(format('raid%d', self.owner:gsub('^raidpet(%d)$', '%1')))))
+		else
+			GameTooltip:AddLine(format('Cast by %s', UnitName(self.owner)))
+		end
+	else
+		GameTooltip:AddLine(format('Cast by %s', UNKNOWN))
+	end
+
 	GameTooltip:Show()
 end