Quantcast

Add lines for PVP information. Displays PVP rank, which falls back to a little harmless humor if no rank is available. Also displays lifetime honorable kills, and arena team names and points.

Scott Sibley [06-19-11 - 02:51]
Add lines for PVP information. Displays PVP rank, which falls back to a little harmless humor if no rank is available. Also displays lifetime honorable kills, and arena team names and points.
Filename
Localization/enUS.lua
Modules/UnitTooltip/UnitTooltip.lua
diff --git a/Localization/enUS.lua b/Localization/enUS.lua
index 1f1fc1d..2c10b84 100644
--- a/Localization/enUS.lua
+++ b/Localization/enUS.lua
@@ -189,6 +189,15 @@ L["Don't right trim"] = true
 L["Prevent trimming white space to the right of text"] = true
 L["Feats"] = true
 L["Feats:"] = true
+L["PVP Rank"] = true
+L["PVP Rank:"] = true
+L["Fetching..."] = true
+L["n00b {-1)"] = true
+L["Alliance"] = true
+L["Horde"] = true
+L["Arena 2s"] = true
+L["Arena 3s"] = true
+L["Arena 5s"] = true

 -- Mouse Gestures
 L["Left Button"] = true
diff --git a/Modules/UnitTooltip/UnitTooltip.lua b/Modules/UnitTooltip/UnitTooltip.lua
index 2cdc3b0..b783a5a 100644
--- a/Modules/UnitTooltip/UnitTooltip.lua
+++ b/Modules/UnitTooltip/UnitTooltip.lua
@@ -699,6 +699,7 @@ return Colorize(format("%s: %d%% (%.2f%%)", L["Threat"], threatpct, rawthreatpct
 if not UnitIsPlayer(unit) then return end
 local feats = UnitFeats(unit)
 if feats and feats > 0 then
+	self:Stop()
     return feats
 else
     return "Loading Achievements..."
@@ -707,7 +708,89 @@ end
 		enabled = true,
 		update = 500,
 		rightUpdating = true
-	}
+	},
+	[36] = {
+		name = L["PVP Rank"],
+		left = [[return L["PVP Rank:"]; ]],
+		right = [[
+if not UnitIsPlayer(unit) then return end
+local pvp = UnitPVPStats(unit);
+if pvp then
+  self:Stop()
+  local fctn = Faction(unit)
+  if fctn == L["Alliance"] then
+    fctn = L["Horde"]
+  elseif fctn == L["Horde"] then
+    fctn = L["Alliance"]
+  end
+  return (pvp.text and Texture(pvp.texture, 12) .. pvp.text or Texture("Interface\\PvPRankBadges\\PvPRank"..fctn..".blp", 12) .. L["n00b (-1)"]) .. " HKs " .. pvp.lifetimeHK
+else
+  return L["Fetching..."]
+end
+]],
+		enabled = true,
+		update = 300,
+		rightUpdating = true,
+		cols = strlen("Interface\\PvPRankBadges\\PvPRank06.blp") + 50
+	},
+	[37] = {
+		name = L["Arena 2s"],
+		left = [[
+local pvp = UnitPVPStats(unit);
+if not pvp then return "" end
+local team = pvp.teams[2]
+if not team then return "" end
+local text = ""
+if team and type(team.teamSize) == "number" and team.teamSize > 0 then
+    local points = CalculateArenaPoints(team.teamRating or 0, team.teamSize)
+    text = format("2v2 %s %s (%d pts)", Texture("Interface\\PVPFrame\\PVP-Banner-2.blp", 12), team.teamName or "Error", points)
+end
+return text
+]],
+		enabled = true,
+		update = 300,
+		leftUpdating = true,
+		cols = 100
+	},
+	[38] = {
+		name = L["Arena 3s"],
+		left = [[
+local pvp = UnitPVPStats(unit);
+if not pvp then return "" end
+local team = pvp.teams[3]
+if not team then return "" end
+local text = ""
+if team and type(team.teamSize) == "number" and team.teamSize > 0 then
+    local points = CalculateArenaPoints(team.teamRating, team.teamSize)
+    text = format("3v3 %s %s (%d pts)", Texture("Interface\\PVPFrame\\PVP-Banner-3.blp", 12), team.teamName or "Error", points)
+end
+return text
+]],
+		enabled = true,
+		update = 300,
+		leftUpdating = true,
+		cols = 100
+	},
+	[39] = {
+		name = L["Arena 5s"],
+		left = [[
+local pvp = UnitPVPStats(unit);
+if not pvp then return "" end
+local team = pvp.teams[5]
+if not team then return "" end
+local text = ""
+if team and type(team.teamSize) == "number" and team.teamSize > 0 then
+    local points = CalculateArenaPoints(team.teamRating, team.teamSize) or 0
+    text = format("5v5 %s %s (%d pts)", Texture("Interface\\PVPFrame\\PVP-Banner-5.blp", 12), team.teamName or "Error", points)
+end
+return text
+]],
+		enabled = true,
+		update = 300,
+		leftUpdating = true,
+		cols = 100
+	},
+
 }

 for i, v in ipairs(defaultLines) do
@@ -1371,6 +1454,20 @@ function mod:RebuildOpts()
 									self:CreateLines()
 								end,
 								order = 10
+							},
+							limited = {
+								name = L["Clip length"],
+								desc = L["Whether to clip the string's length when it is longer than the value of Columns."],
+								type = "toggle",
+								get = function()
+									return v.limited or WigetText.defaults.limited
+								end,
+								set = function(info, val)
+									v.limited = val
+									v.limitedDirty = true
+									sel:CreateLines()
+								end,
+								order = 11
 							}
 						},
 						order = 9