Files
benilla-octo/crates/benilla-app/assets/ui/GameTime.xml
T
SamandClaude Fable 5 d1140829d7 the interface code is ours: the transcription debt is paid
- forty files that carried the reference's literal Lua are rewritten as our own expression of the behaviour — worst identical run 61 lines down to 7 — and the README now says exactly that
- the overlap gate measures the code itself across all four reference corpora, and ratchets: the number may only go down
- a lost session ends at the login screen instead of silently re-authenticating and stealing the account back
- a building's skybox is a real model: Caverns of Time's white ceiling becomes its painted nebula and additive stars

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-14 19:21:03 +07:00

138 lines
6.4 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!--
The minimap's time-of-day indicator (GameTimeFrame) — our implementation of the behaviour the
1.12 FrameXML GameTime.xml + GameTime.lua specify, in their own file split (the reference TOC
loads GameTime.xml right after Minimap.xml, and the manifest mirrors that beside
MinimapCluster.xml). The Lua below is ours; the published names (GameTimeFrame_Update,
GameTime_GetTime, GAMETIME_DAWN/DUSK, GameTimeTexture) and every number are the reference's,
because addons call the first by name and the second are measurements of the real interface.
This closes the "day/night indicator" line in MinimapCluster.xml's OUT list.
The 50×50 frame overhanging the cluster's top-right corner shows
Interface\Minimap\UI-TOD-Indicator (128×64: the sun disc on the left half, the moon on the
right — verified by extraction); GameTimeFrame_Update re-reads GetGameTime() every OnUpdate,
and when the game minute changed it re-seats the 50-px texcoord window — +0.5 across the
dawn/dusk thresholds (before 5:30 AM / from 9:00 PM game time = night) — and refreshes the
tooltip if it is showing. Hover formats the same clock into the tooltip. GetGameTime() is the
app's SMSG_LOGIN_SETTIMESPEED clock, pushed on the minute (`crate::minimap::feed_game_time`).
The frame declares no enableMouse yet its tooltip hovers: the real XML `<Scripts>` walker
auto-enables the mouse kind when it attaches a mouse handler (wow-re
`ui/scratch/scripts-auto-enable.md`, resolved 2026-08-07) — benilla's loader models the same
law (`loader/scripts.rs`), so this file stays attribute-free like the reference.
Deltas from the reference's behaviour, each deliberate:
- No TEXT() wrapper around the format strings (this file set's convention: the ref's
build-time no-op localization macro; CharacterFrame.xml's note).
- TwentyFourHourTime = 1 is SET here: the reference sets it in Localization.lua's
LocalizeFrames() — this install is enGB, and enGB is a 24-hour locale — called at
VARIABLES_LOADED. benilla fires that event since decision 1128 and could carry this as a saved
variable (it is on 1128's follow-on list), but the value here is a LOCALE fact, not a player
toggle: this install is enGB and enGB is a 24-hour locale. So the tooltip reads "21:07" exactly
as the reference client on this install does; the 12-hour AM/PM path below is implemented and
kept live for the day a locale/CVar drives it.
-->
<Ui xmlns="http://www.blizzard.com/wow/ui/">
<Script><![CDATA[
-- Set here rather than by Localization.lua's LocalizeFrames — see the header.
TwentyFourHourTime = 1;
-- The reference's own thresholds, in minutes since midnight (game time), and its own
-- global names: an addon that wants to know when night falls reads exactly these.
GAMETIME_DAWN = ( 5 * 60) + 30; -- 5:30 AM
GAMETIME_DUSK = (21 * 60) + 0; -- 9:00 PM
-- UI-TOD-Indicator is one 128x64 sheet carrying two 50-px icons side by side: the sun at
-- u=0, the moon exactly half a sheet to its right. So the whole day/night decision is
-- which of the two u origins the 50-px window sits on.
local TOD_ICON_WIDTH = 50/128;
local TOD_ICON_HEIGHT = 50/64;
local TOD_NIGHT_ORIGIN = 0.5;
function GameTimeFrame_Update()
local hour, minute = GetGameTime();
local minuteOfDay = (hour * 60) + minute;
-- OnUpdate calls this every frame; only a changed game MINUTE is worth any work.
if minuteOfDay == this.timeOfDay then
return;
end
this.timeOfDay = minuteOfDay;
local origin = 0;
if minuteOfDay < GAMETIME_DAWN or minuteOfDay >= GAMETIME_DUSK then
origin = TOD_NIGHT_ORIGIN;
end
GameTimeTexture:SetTexCoord(origin, origin + TOD_ICON_WIDTH, 0, TOD_ICON_HEIGHT);
-- A tooltip we still own is showing last minute's clock; re-word it in place.
if GameTooltip:IsOwned(this) then
GameTimeFrame_UpdateTooltip(hour, minute);
end
end
-- The one clock formatter, since the tooltip and the getter below want the same string in
-- two different wrappers. TwentyFourHourTime picks the plain HH:MM form; otherwise the
-- hour folds into 1..12 (midnight and noon both being 12) and the AM/PM half is carried by
-- which format string is used, not by any text this file spells out.
local function clockText(hour, minute)
if TwentyFourHourTime then
return format(TIME_TWENTYFOURHOURS, hour, minute);
end
local afternoon = (hour >= 12);
if hour > 12 then
hour = hour - 12;
elseif hour == 0 then
hour = 12;
end
if afternoon then
return format(TIME_TWELVEHOURPM, hour, minute);
end
return format(TIME_TWELVEHOURAM, hour, minute);
end
function GameTimeFrame_UpdateTooltip(hours, minutes)
GameTooltip:SetText(clockText(hours, minutes));
end
function GameTime_GetTime()
return clockText(GetGameTime());
end
]]></Script>
<Frame name="GameTimeFrame" parent="MinimapCluster">
<Size>
<AbsDimension x="50" y="50"/>
</Size>
<Anchors>
<Anchor point="TOPRIGHT">
<Offset>
<AbsDimension x="4" y="-19"/>
</Offset>
</Anchor>
</Anchors>
<HitRectInsets>
<AbsInset left="6" right="0" top="5" bottom="10"/>
</HitRectInsets>
<Layers>
<Layer level="ARTWORK">
<Texture name="GameTimeTexture" file="Interface\Minimap\UI-TOD-Indicator"/>
</Layer>
</Layers>
<Scripts>
<OnLoad>
this.timeOfDay = 0;
this:SetFrameLevel(this:GetFrameLevel() + 2);
GameTimeFrame_Update();
</OnLoad>
<OnEnter>
GameTooltip:SetOwner(this, "ANCHOR_BOTTOMLEFT");
GameTimeFrame_UpdateTooltip(GetGameTime());
</OnEnter>
<OnLeave>
GameTooltip:Hide();
</OnLeave>
<OnUpdate>
GameTimeFrame_Update();
</OnUpdate>
</Scripts>
</Frame>
</Ui>