Files
OEVGandClaude Opus 5.5 2c58ce2aa3 Merge the ShaguTweaks Extras ClassicAPI modules into ShaguTweaks (3.7)
Bring in 27 module files from Dusk/ShaguTweaks-Extras-ClassicAPI
(8e14bb4): action bar, chat, loot, macro, merchant (Buy Em All),
minimap & world map, tooltip and unit frame modules, with their
textures. Titles are unchanged, so saved toggles carry over.

- Categories: Chat -> Chat & Social, World Map -> Minimap & World Map,
  Merchant & Auction -> Merchant; Macro is a new category.
- Texture paths point at ShaguTweaks\img.
- Not merged: Raid Frames, Bag Item Click and Bag Search Bar (Bagshui
  covers them), Auction Alt-Buy (aux covers it).
- Chat note when the old ShaguTweaks-extras addon is still enabled.
- English translation keys, notices, license copy, asset provenance,
  README, changelog and version 3.7.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019W3rwusM4i1CYaHQAYixJ7
2026-11-02 21:52:53 +00:00

58 lines
2.1 KiB
Lua
Executable File

local _G = ShaguTweaks.GetGlobalEnv()
local T = ShaguTweaks.T
local rgbhex = ShaguTweaks.rgbhex
local module = ShaguTweaks:register({
title = T["Chat Timestamps"],
description = T["Add timestamps to chat messages."],
expansions = { ["vanilla"] = true, ["tbc"] = false },
category = T["Chat & Social"],
maintainer = "@shagu (GitHub)",
enabled = false,
config = {
["chat.timestamp.bracket"] = "[]",
["chat.timestamp.format"] = 24,
["chat.timestamp.color"] = { r = .8, g = .8, b = .8, a = 1},
}
})
module.enable = function(self)
-- config shortcuts
local bracket = self.config["chat.timestamp.bracket"]
local clock = self.config["chat.timestamp.format"]
local rgb = self.config["chat.timestamp.color"]
-- parse config
local left = string.sub(bracket, 1, 1) or ""
local right = string.sub(bracket, 2, 2) or ""
local format = clock == 24 and "%H:%M:%S" or "%I:%M:%S %p"
local color = rgbhex({ rgb.r, rgb.g, rgb.b, rgb.a })
local function InstallTimestampHooks()
for i = 1, NUM_CHAT_WINDOWS do
local frame = _G["ChatFrame"..i]
if frame and not frame.ShaguTweaksExtrasTimestampAddMessage then
frame.ShaguTweaksExtrasTimestampAddMessage = frame.AddMessage
frame.AddMessage = function(self, msg, a1, a2, a3, a4, a5)
if not msg then return end
msg = color .. left .. date(format) .. right .. "|r " .. msg
self:ShaguTweaksExtrasTimestampAddMessage(msg, a1, a2, a3, a4, a5)
end
end
end
end
-- Install after the normal ShaguTweaks module pass. Chat Tweaks in the
-- main fork also wraps AddMessage, and its module order is intentionally
-- unordered. Waiting for PLAYER_ENTERING_WORLD makes timestamps the outer
-- wrapper every time, so history consistently stores the displayed time.
local installer = CreateFrame("Frame", nil, UIParent)
installer:RegisterEvent("PLAYER_ENTERING_WORLD")
installer:SetScript("OnEvent", function()
InstallTimestampHooks()
this:UnregisterAllEvents()
this:Hide()
end)
end