diff --git a/api/config.lua b/api/config.lua index ab5598bf..9ca05ec9 100644 --- a/api/config.lua +++ b/api/config.lua @@ -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") diff --git a/modules/gui.lua b/modules/gui.lua index 7a797947..e7e2cba4 100644 --- a/modules/gui.lua +++ b/modules/gui.lua @@ -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() diff --git a/modules/panel.lua b/modules/panel.lua index 0344ef51..f1255619 100644 --- a/modules/panel.lua +++ b/modules/panel.lua @@ -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)