From 77b8fb7513de63315e2d25450707bffbaa1895db Mon Sep 17 00:00:00 2001 From: shagu Date: Sun, 22 Dec 2024 10:42:27 +0100 Subject: [PATCH] turtle-wow: add support for custom continent clock --- modules/turtle-wow.lua | 55 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/modules/turtle-wow.lua b/modules/turtle-wow.lua index 0cb415fd..83d8f3df 100644 --- a/modules/turtle-wow.lua +++ b/modules/turtle-wow.lua @@ -43,6 +43,61 @@ pfUI:RegisterModule("turtle-wow", "vanilla", function () WorldMapFrameTitle:Hide() end + if pfUI.panel and pfPanelWidgetClock then + pfPanelWidgetClock.Tooltip = function() + GameTooltip:ClearLines() + GameTooltip_SetDefaultAnchor(GameTooltip, this) + local servertime, zonetime, time + local zh, zm = GetGameTime() + local sh, sm = zh, zm + + -- convert custom zonetime to servertime + SetMapToCurrentZone() + if GetCurrentMapContinent() == 1 then + sh = sh + 12 + sh = sh >= 24 and sh - 24 or sh + end + + -- perform am/pm calculations + if C.global.twentyfour == "0" then + local zn, sn = " AM", " AM" + + if zh > 12 then + zh = zh - 12 + zn = " PM" + end + + if sh > 12 then + sh = sh - 12 + sn = " PM" + end + + time = date("%I:%M %p") + servertime = string.format("%.2d:%.2d %s", sh, sm, sn) + zonetime = string.format("%.2d:%.2d %s", zh, zm, zn) + else + time = date("%H:%M") + servertime = string.format("%.2d:%.2d", sh, sm) + zonetime = string.format("%.2d:%.2d", zh, zm) + end + + -- create the tooltip + GameTooltip:AddLine("|cff555555" .. T["Time"]) + GameTooltip:AddDoubleLine(T["Localtime"], "|cffffffff" .. time) + GameTooltip:AddDoubleLine(T["Servertime"], "|cffffffff".. servertime) + GameTooltip:AddDoubleLine(T["Zonetime"], "|cffffffff".. zonetime) + GameTooltip:AddLine(" ") + if TimeManagerFrame then + GameTooltip:AddDoubleLine(T["Left Click"], "|cffffffff" .. T["Show/Hide TimeManager"]) + else + GameTooltip:AddDoubleLine(T["Left Click"], "|cffffffff" .. T["Show/Hide Timer"]) + GameTooltip:AddDoubleLine(T["Right Click"], "|cffffffff" .. T["Reset Timer"]) + end + GameTooltip:Show() + end + end + + HookScript(libdebuff, "OnEvent", function() if event == "CHAT_MSG_SPELL_SELF_DAMAGE" then -- refresh paladin judgements on holy strike