panel: option to use server time instead of local

This commit is contained in:
Road-block
2019-03-31 14:59:21 +02:00
committed by shagu
parent 37df84bd98
commit 06494be3b6
3 changed files with 21 additions and 3 deletions
+1
View File
@@ -47,6 +47,7 @@ function pfUI:LoadConfig()
pfUI:UpdateConfig("global", nil, "hidebuff", "0")
pfUI:UpdateConfig("global", nil, "hidewbuff", "0")
pfUI:UpdateConfig("global", nil, "twentyfour", "1")
pfUI:UpdateConfig("global", nil, "servertime", "0")
pfUI:UpdateConfig("global", nil, "autosell", "0")
pfUI:UpdateConfig("global", nil, "autorepair", "0")
pfUI:UpdateConfig("gui", nil, "reloadmarker", "0")
+1
View File
@@ -1690,6 +1690,7 @@ pfUI:RegisterModule("gui", function ()
CreateConfig(nil, T["Only Count Bagspace On Regular Bags"], C.panel.bag, "ignorespecial", "checkbox")
CreateConfig(nil, T["Enable Micro Bar"], C.panel.micro, "enable", "checkbox")
CreateConfig(nil, T["Enable 24h Clock"], C.global, "twentyfour", "checkbox")
CreateConfig(nil, T["Servertime"], C.global, "servertime", "checkbox")
end)
CreateGUIEntry(T["Panel"], T["Auto Hide"], function()
+19 -3
View File
@@ -26,7 +26,7 @@ pfUI:RegisterModule("panel", function()
noon = " PM"
end
time = date("%I:%M %p")
servertime = string.format("%.2d:%.2d", h, m) .. noon
servertime = string.format("%.2d:%.2d %s", h, m, noon)
else
time = date("%H:%M")
servertime = string.format("%.2d:%.2d", h, m)
@@ -54,11 +54,27 @@ pfUI:RegisterModule("panel", function()
widget:SetScript("OnUpdate",function()
if ( this.tick or 1) > GetTime() then return else this.tick = GetTime() + 1 end
local h, m = GetGameTime()
local noon = "AM"
local time = ""
if C.global.twentyfour == "0" then
pfUI.panel:OutputPanel("time", date("%I:%M:%S %p"), widget.Tooltip, widget.Click)
if C.global.servertime == "1" then
if h > 12 then
h = h - 12
noon = "PM"
end
time = string.format("%.2d:%.2d %s", h, m, noon)
else
time = date("%I:%M:%S %p")
end
else
pfUI.panel:OutputPanel("time", date("%H:%M:%S"), widget.Tooltip, widget.Click)
if C.global.servertime == "1" then
time = string.format("%.2d:%.2d", h, m)
else
time = date("%H:%M:%S")
end
end
pfUI.panel:OutputPanel("time", time, widget.Tooltip, widget.Click)
end)
widget.timerFrame = CreateFrame("Frame", "pfUITimer", UIParent)