WoWInterface SVN pStats

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /
    from Rev 27 to Rev 28
    Reverse comparison

Rev 27 → Rev 28

trunk/pStats/pStats.lua
1,22 → 1,17
--[[
 
Copyright (c) 2009, Adrian L Lange
All rights reserved.
 
You're allowed to use this addon, free of monetary charge,
but you are not allowed to modify, alter, or redistribute
this addon without express, written permission of the author.
 
--]]
 
local function GetClassColors()
local function classColors()
local _, enClass = UnitClass('player')
local colorTable = CUSTOM_CLASS_COLORS and CUSTOM_CLASS_COLORS[enClass] or RAID_CLASS_COLORS[enClass]
 
return colorTable.r, colorTable.g, colorTable.b
end
 
local function ReformatValue(value)
local function formatValue(value)
if(value > 999) then
return string.format('%.1f MiB', value / 1024)
else
24,14 → 19,14
end
end
 
local function OnEnter(self)
local r, g, b = GetClassColors()
local function onEnter(self)
local r, g, b = classColors()
local _, _, latency = GetNetStats()
local addons, total = {}, 0
 
GameTooltip:SetOwner(self, 'ANCHOR_BOTTOMLEFT', 0, self:GetHeight())
GameTooltip:ClearLines()
GameTooltip:AddDoubleLine(string.format('%.1f fps', GetFramerate()), string.format('%d ms', latency), r, g, b, r, g, b)
GameTooltip:AddDoubleLine(string.format('%01d fps', GetFramerate()), string.format('%d ms', latency), r, g, b, r, g, b)
GameTooltip:AddLine('\n')
 
UpdateAddOnMemoryUsage()
47,23 → 42,15
table.sort(addons, function(a,b) return a[2] > b[2] end)
 
for key, value in next, addons do
GameTooltip:AddDoubleLine(value[1], ReformatValue(value[2]), 1, 1, 1)
GameTooltip:AddDoubleLine(value[1], formatValue(value[2]), 1, 1, 1)
end
 
GameTooltip:AddLine('\n')
GameTooltip:AddDoubleLine('User AddOn memory usage:', ReformatValue(total), r, g, b, r, g, b)
GameTooltip:AddDoubleLine('Default UI memory usage:', ReformatValue(gcinfo() - total), r, g, b, r, g, b)
GameTooltip:AddDoubleLine('Total memory usage:', ReformatValue(gcinfo()), r, g, b, r, g, b)
GameTooltip:AddDoubleLine('User AddOn memory usage:', formatValue(total), r, g, b, r, g, b)
GameTooltip:AddDoubleLine('Default UI memory usage:', formatValue(gcinfo() - total), r, g, b, r, g, b)
GameTooltip:AddDoubleLine('Total memory usage:', formatValue(gcinfo()), r, g, b, r, g, b)
GameTooltip:Show()
end
 
local function OnClick(self)
if(GameTooltip:GetOwner() == self) then
GameTooltip:Hide()
end
 
ToggleDropDownMenu(1, nil, MiniMapTrackingDropDown, 'MiniMapTracking')
end
 
MiniMapTrackingButton:SetScript('OnClick', OnClick)
MiniMapTrackingButton:SetScript('OnEnter', OnEnter)
\ No newline at end of file +MiniMapTrackingButton:HookScript('OnClick', GameTooltip_Hide) +MiniMapTrackingButton:SetScript('OnEnter', onEnter) \ No newline at end of file