From f951383efd9527193a8500358e4d893a8dd1d6db Mon Sep 17 00:00:00 2001 From: Scott Sibley Date: Wed, 18 May 2011 09:33:31 +0000 Subject: [PATCH] Added a line for showing achievement points. Also, you can retrieve a fairly raw table of PVP and Arena stats. Grab it with UnitPVPStats(unit). This function is entirely untested, so please report bugs. Please refer to PluginTalents for table format. Also, there's another function added: CalculateArenaPoints(teamRating, teamSize) No new lines were created for UnitPVPStats and CalculateArenaPoints. --- Localization/enUS.lua | 2 ++ Modules/UnitTooltip/UnitTooltip.lua | 21 ++++++++++++++++++++- StarTip.lua | 13 +++++++++---- 3 files changed, 31 insertions(+), 5 deletions(-) diff --git a/Localization/enUS.lua b/Localization/enUS.lua index 14f7657..1f1fc1d 100644 --- a/Localization/enUS.lua +++ b/Localization/enUS.lua @@ -187,6 +187,8 @@ L["Columns"] = true L["How wide the marquee is. If your text is cut short then increase this value."] = true L["Don't right trim"] = true L["Prevent trimming white space to the right of text"] = true +L["Feats"] = true +L["Feats:"] = true -- Mouse Gestures L["Left Button"] = true diff --git a/Modules/UnitTooltip/UnitTooltip.lua b/Modules/UnitTooltip/UnitTooltip.lua index ac3042d..2cdc3b0 100644 --- a/Modules/UnitTooltip/UnitTooltip.lua +++ b/Modules/UnitTooltip/UnitTooltip.lua @@ -691,7 +691,23 @@ return Colorize(format("%s: %d%% (%.2f%%)", L["Threat"], threatpct, rawthreatpct enabled = true, update = 300, leftUpdating = true - } + }, + [35] = { + name = L["Feats"], + left = [[return L["Feats:"]; ]], + right = [[ +if not UnitIsPlayer(unit) then return end +local feats = UnitFeats(unit) +if feats and feats > 0 then + return feats +else + return "Loading Achievements..." +end +]], + enabled = true, + update = 500, + rightUpdating = true + } } for i, v in ipairs(defaultLines) do @@ -847,15 +863,18 @@ function mod:CreateLines() if v.rightObj then environment.self = v.rightObj right = mod.evaluator.ExecuteCode(environment, v.name .. " right", v.right) + if type(right) == "number" then right = right .. "" end end if v.leftObj then environment.self = v.leftObj left = mod.evaluator.ExecuteCode(environment, v.name .. " left", v.left) + if type(left) == "number" then left = left .. "" end end else if v.leftObj then environment.self = v.leftObj left = mod.evaluator.ExecuteCode(environment, v.name .. " left", v.left) + if type(left) == "number" then left = left .. "" end end right = '' end diff --git a/StarTip.lua b/StarTip.lua index 5018c9b..14e8314 100644 --- a/StarTip.lua +++ b/StarTip.lua @@ -162,8 +162,9 @@ local options = { type = "input", set = function(info, v) tinsert(timers, v) - StarTip:RebuildOpts() + tinsert(StarTip.db.profile.timers, v) StarTip:SetupTimers() + StarTip:RebuildOpts() end, order = 1 }, @@ -172,7 +173,7 @@ local options = { desc = L["Use this to restore the defaults"], type = "execute", func = function() - StarTip.db.profile.timers = nil + StarTip.db.profile.timers = nil -- this is replaced in SetupTimers StarTip:SetupTimers() StarTip:RebuildOpts() end, @@ -450,6 +451,9 @@ function StarTip:OnInitialize() GameTooltip:Hide() end +local defaultTimers = { +} + function StarTip:SetupTimers() if not self.db.profile.timers then self.db.profile.timers = {} @@ -634,7 +638,7 @@ end function StarTip.OnTooltipSetUnit(...) local _, unit = GameTooltip:GetUnit() - + if not unit or StarTip.tooltipHidden then GameTooltip:Hide() return end hideTimer = hideTimer or LibTimer:New("StarTip.Hide", 100, false, hideTooltip, nil, StarTip.db.profile.errorLevel) @@ -654,7 +658,7 @@ function StarTip.OnTooltipSetUnit(...) --StarTip.fading = false StarTip.unit = unit - + if not StarTip.justSetUnit then for k, v in StarTip:IterateModules() do if v.SetUnit and v:IsEnabled() then v:SetUnit() end @@ -903,3 +907,4 @@ function StarTip:MODIFIER_STATE_CHANGED(ev, modifier, up, ...) end end end + -- 1.7.9.5