/trunk
## Version: 30000.wowi:revision |
## Title: |cffff6000p|rStats |
## Notes: Replaces the tooltip on MinimapTracking with a more informative one. Also supports LDB |
## OptionalDeps: LibStub, CallbackHandler-1.0, LibSimpleOptions-1.0, LibDataBroker-1.1 |
## SavedVariablesPerCharacter: pStatsDB |
Libs\LibSimpleOptions\LibStub\LibStub.lua |
Libs\LibSimpleOptions\LibSimpleOptions-1.0.lua |
Libs\CallbackHandler\CallbackHandler-1.0.lua |
Libs\CallbackHandler\LibStub\LibStub.lua |
Libs\CallbackHandler\CallBackHandler-1.0\CallbackHandler-1.0.lua |
Libs\LibDataBroker\LibDataBroker-1.1.lua |
pStats.lua |
pStatsConfig.lua |
local dataobj, elapsed = LibStub:GetLibrary('LibDataBroker-1.1'):NewDataObject('Stats', {text = '2.0 MiB', icon = [=[Interface\AddOns\pStats\icon]=]}), 0.5 |
CreateFrame('Frame'):SetScript('OnUpdate', function(self, al) |
elapsed = elapsed + al |
if(elapsed > 0.5) then |
dataobj.text = formats(gcinfo()) |
elapsed = 0 |
end |
end) |
function dataobj.OnLeave() |
GameTooltip:SetClampedToScreen(true) |
GameTooltip:Hide() |
end |
function dataobj.OnEnter(self) |
local db = pStatsDB |
local db = pStatsDB or {colors = {0, 1, 1}, sorted = true} |
local r, g, b = unpack(db.colors) |
local down, up, latency = GetNetStats() |
local fps = format('%.1f fps', GetFramerate()) |
MiniMapTrackingButton:SetScript('OnMouseWheel', OnMouseWheel) |
MiniMapTrackingButton:SetScript('OnClick', dataobj.OnClick) |
MiniMapTrackingButton:SetScript('OnEnter', dataobj.OnEnter) |
MiniMapTrackingButton:SetScript('OnLeave', dataobj.OnLeave) |
## Interface: 30000 |
## Author: p3lim |
## Version: 30000.wowi:revision |
## Title: |cffff6000p|rStats_Config |
## Notes: Options module for pStats |
## RequiredDeps: pStats |
## LoadOnDemand: 1 |
LibSimpleOptions\LibStub\LibStub.lua |
LibSimpleOptions\LibSimpleOptions-1.0.lua |
pStats_Config.lua |
local db = pStatsDB or {colors = {0, 1, 1}, sorted = true} + +LibStub('LibSimpleOptions-1.0').AddOptionsPanel('pStats', function(self) + local title, sub = self:MakeTitleTextAndSubText('pStats', 'These options allow you to customize the looks of pStats.') + + self:MakeButton( + 'name', 'Class Color', + 'description', 'Set text color based on player class', + 'func', function() + local l, class = UnitClass('player') + local c = RAID_CLASS_COLORS[class] + pStatsDB.colors[1] = c.r + pStatsDB.colors[2] = c.g + pStatsDB.colors[3] = c.b + self:Refresh() + end + ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -16) + + self:MakeColorPicker( + 'name', 'Custom Color', + 'description', 'Set custom text colors with a palette', + 'hasAlpha', false, + 'defaultR', 0, 'defaultG', 1, 'defaultB', 1, + 'getFunc', function() return unpack(db.colors) end, + 'setFunc', function(r, g, b) + pStatsDB.colors[1] = r + pStatsDB.colors[2] = g + pStatsDB.colors[3] = b + end + ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -46) + + self:MakeToggle( + 'name', 'Toggle sorting method', + 'description', 'Check to sort by memory.\nUn-check to sort by name', + 'default', true, + 'current', db.sorted, + 'setFunc', function(value) + pStatsDB.sorted = value + end + ):SetPoint('TOPLEFT', sub, 'BOTTOMLEFT', 0, -76) +end) |