Files
benilla-octo/crates/benilla-app/assets/ui/ItemTextFrame.xml
T
SamandClaude Fable 5 44ff435304 the addon arc: the AddOns folder opens
- benilla loads real 1.12 addons from Interface/AddOns — TOC, XML and Lua through one loader, with per-addon saved variables, Bindings.xml and the lifecycle events addons expect
- both AddOns screens are in: the character-select list with per-addon enable state, and the ESC menu's in-game list
- the API surface is measured, not guessed — a corpus harness runs hundreds of real 1.12 addons and ranks exactly which globals, templates and verbs they demand
- the Lua dialect is the client's own, read off the binary — 5.0 semantics with the 1.12 additions, and UI source files are bytes, not UTF-8

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-11 18:18:31 +07:00

338 lines
19 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.
<Ui>
<!--
The item-text reader — letters, books, plaques (the mail arc's "permanent copy" lands
here). Transcribed from the reference ItemTextFrame.xml (354 l) + ItemTextFrame.lua
(104 l); geometry/art quoted verbatim, names the reference's own. Driven by the engine's
item-text seam (benilla-ui/src/script/item_text.rs) + crate::ui_item_text's feed/drain:
the app fires the reference event flow ITEM_TEXT_BEGIN → ITEM_TEXT_READY → ITEM_TEXT_CLOSED.
ADAPTATIONS (the MailFrame.xml precedents):
· The body scroll (ItemTextScrollFrame, UIPanelScrollFrameTemplate 280×355 at -66,-76) is
a plain Frame at that exact rect with the page FontString INSIDE it (no live scrollbar);
a very long page clips. The ref's own flanking scrollbar art (UI-Character-ScrollBar
top/bottom + the black middle strip) is quoted verbatim as inert layers, so the right
edge reads exactly like the reference at rest.
· ItemTextPageText is SimpleHTML in the ref — transcribed as a FontString at the same
rect (our letters/pages are plain text; an HTML page renders as its markup, accepted).
· The Lua's ScrollFrame-only verbs (UpdateScrollChildRect, ScrollBar SetValue/Hide,
scrollBarHideable) are dropped with the live scrollbar.
· GetMaterialTextColors + the two material color tables live in the reference Fonts.xml /
UIParent.lua — inlined here Benilla-scoped (the MoneyInput-shim precedent), quoted
verbatim.
· GlobalStrings inlined: PREV "Prev", NEXT "Next", ITEM_TEXT_FROM "From," (the reference
string really is comma'd).
· ITEM_TEXT_TRANSLATION (the foreign-language progress bar) is transcribed but never
fires — no translation mechanic on our letters; the StatusBar stays hidden.
· <HitRectInsets> quoted verbatim for fidelity but currently inert (the loader ignores
the element).
-->
<Script><![CDATA[
-- ref Fonts.xml l.27-42 (quoted verbatim, Benilla-scoped).
BENILLA_MATERIAL_TEXT_COLOR_TABLE = {
["Default"] = {0.18, 0.12, 0.06},
["Stone"] = {1.0, 1.0, 1.0},
["Parchment"] = {0.18, 0.12, 0.06},
["Marble"] = {0, 0, 0},
["Silver"] = {0.12, 0.12, 0.12},
["Bronze"] = {0.18, 0.12, 0.06}
}
BENILLA_MATERIAL_TITLETEXT_COLOR_TABLE = {
["Default"] = {0, 0, 0},
["Stone"] = {0.93, 0.82, 0},
["Parchment"] = {0, 0, 0},
["Marble"] = {0.93, 0.82, 0},
["Silver"] = {0.93, 0.82, 0},
["Bronze"] = {0.93, 0.82, 0}
}
-- ref UIParent.lua l.1880-1888.
function GetMaterialTextColors(material)
local textColor = BENILLA_MATERIAL_TEXT_COLOR_TABLE[material]
local titleColor = BENILLA_MATERIAL_TITLETEXT_COLOR_TABLE[material]
if not (textColor and titleColor) then
textColor = BENILLA_MATERIAL_TEXT_COLOR_TABLE["Default"]
titleColor = BENILLA_MATERIAL_TITLETEXT_COLOR_TABLE["Default"]
end
return textColor, titleColor
end
-- ref ItemTextFrame.lua l.1-8.
function ItemTextFrame_OnLoad()
this:RegisterEvent("ITEM_TEXT_BEGIN")
this:RegisterEvent("ITEM_TEXT_TRANSLATION")
this:RegisterEvent("ITEM_TEXT_READY")
this:RegisterEvent("ITEM_TEXT_CLOSED")
end
-- ref l.10-96.
function ItemTextFrame_OnEvent(event)
if event == "ITEM_TEXT_BEGIN" then
ItemTextTitleText:SetText(ItemTextGetItem())
ItemTextScrollFrame:Hide()
ItemTextCurrentPage:Hide()
ItemTextStatusBar:Hide()
ItemTextPrevPageButton:Hide()
ItemTextNextPageButton:Hide()
local material = ItemTextGetMaterial()
if not material then material = "Parchment" end
local textColor = GetMaterialTextColors(material)
ItemTextPageText:SetTextColor(textColor[1], textColor[2], textColor[3])
return
end
if event == "ITEM_TEXT_TRANSLATION" then
ItemTextPrevPageButton:Hide()
ItemTextNextPageButton:Hide()
this.translationElapsed = 0
ItemTextStatusBar:SetMinMaxValues(0, arg1)
ItemTextStatusBar:Show()
ShowUIPanel(this)
if not this:IsVisible() then CloseItemText() end
return
end
if event == "ITEM_TEXT_READY" then
local creator = ItemTextGetCreator()
if creator then
creator = "\n\n".."From,".."\n"..creator.."\n\n" -- ITEM_TEXT_FROM
ItemTextPageText:SetText("\n"..ItemTextGetText()..creator)
else
ItemTextPageText:SetText("\n"..ItemTextGetText().."\n")
end
ItemTextScrollFrame:Show()
local page = ItemTextGetPage()
local next = ItemTextHasNextPage()
local material = ItemTextGetMaterial()
if not material then material = "Parchment" end
if material == "Parchment" then
ItemTextMaterialTopLeft:Hide()
ItemTextMaterialTopRight:Hide()
ItemTextMaterialBotLeft:Hide()
ItemTextMaterialBotRight:Hide()
else
ItemTextMaterialTopLeft:Show()
ItemTextMaterialTopRight:Show()
ItemTextMaterialBotLeft:Show()
ItemTextMaterialBotRight:Show()
ItemTextMaterialTopLeft:SetTexture("Interface\\ItemTextFrame\\ItemText-"..material.."-TopLeft")
ItemTextMaterialTopRight:SetTexture("Interface\\ItemTextFrame\\ItemText-"..material.."-TopRight")
ItemTextMaterialBotLeft:SetTexture("Interface\\ItemTextFrame\\ItemText-"..material.."-BotLeft")
ItemTextMaterialBotRight:SetTexture("Interface\\ItemTextFrame\\ItemText-"..material.."-BotRight")
end
if (page > 1) or next then
ItemTextCurrentPage:SetText(page)
ItemTextCurrentPage:Show()
if page > 1 then
ItemTextPrevPageButton:Show()
else
ItemTextPrevPageButton:Hide()
end
if next then
ItemTextNextPageButton:Show()
else
ItemTextNextPageButton:Hide()
end
end
ItemTextStatusBar:Hide()
ShowUIPanel(this)
if not this:IsVisible() then CloseItemText() end
return
end
if event == "ITEM_TEXT_CLOSED" then
HideUIPanel(this)
return
end
end
-- ref l.98-104.
function ItemTextFrame_OnUpdate(elapsed)
if ItemTextStatusBar:IsVisible() then
elapsed = this.translationElapsed + elapsed
ItemTextStatusBar:SetValue(elapsed)
this.translationElapsed = elapsed
end
end
]]></Script>
<Frame name="ItemTextFrame" toplevel="true" movable="true" enableMouse="true" hidden="true" parent="UIParent">
<Size><AbsDimension x="384" y="512"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="-104"/></Offset></Anchor></Anchors>
<HitRectInsets><AbsInset left="0" right="30" top="0" bottom="70"/></HitRectInsets>
<Layers>
<Layer level="BACKGROUND">
<Texture file="Interface\Spellbook\Spellbook-Icon">
<Size><AbsDimension x="58" y="58"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="10" y="-8"/></Offset></Anchor></Anchors>
</Texture>
</Layer>
<Layer level="BORDER">
<Texture file="Interface\ItemTextFrame\UI-ItemText-TopLeft">
<Size><AbsDimension x="256" y="256"/></Size>
<Anchors><Anchor point="TOPLEFT"/></Anchors>
</Texture>
<Texture file="Interface\Spellbook\UI-SpellbookPanel-TopRight">
<Size><AbsDimension x="128" y="256"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="256" y="0"/></Offset></Anchor></Anchors>
</Texture>
<Texture file="Interface\ItemTextFrame\UI-ItemText-BotLeft">
<Size><AbsDimension x="256" y="256"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="-256"/></Offset></Anchor></Anchors>
</Texture>
<Texture file="Interface\Spellbook\UI-SpellbookPanel-BotRight">
<Size><AbsDimension x="128" y="256"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="256" y="-256"/></Offset></Anchor></Anchors>
</Texture>
</Layer>
<Layer level="ARTWORK">
<!-- The non-parchment material corners (stone/marble/…): textures swapped in by
ITEM_TEXT_READY; hidden entirely for parchment (ref l.56-70). -->
<Texture name="ItemTextMaterialTopLeft" hidden="true">
<Size><AbsDimension x="256" y="256"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="21" y="-75"/></Offset></Anchor></Anchors>
</Texture>
<Texture name="ItemTextMaterialTopRight" hidden="true">
<Size><AbsDimension x="64" y="256"/></Size>
<Anchors><Anchor point="TOPLEFT" relativeTo="ItemTextMaterialTopLeft" relativePoint="TOPRIGHT"/></Anchors>
</Texture>
<Texture name="ItemTextMaterialBotLeft" hidden="true">
<Size><AbsDimension x="256" y="128"/></Size>
<Anchors><Anchor point="TOPLEFT" relativeTo="ItemTextMaterialTopLeft" relativePoint="BOTTOMLEFT"/></Anchors>
</Texture>
<Texture name="ItemTextMaterialBotRight" hidden="true">
<Size><AbsDimension x="64" y="128"/></Size>
<Anchors><Anchor point="TOPLEFT" relativeTo="ItemTextMaterialTopLeft" relativePoint="BOTTOMRIGHT"/></Anchors>
</Texture>
</Layer>
<Layer level="OVERLAY">
<FontString name="ItemTextTitleText" inherits="GameFontNormal">
<Size><AbsDimension x="224" y="14"/></Size>
<Anchors><Anchor point="CENTER"><Offset><AbsDimension x="6" y="230"/></Offset></Anchor></Anchors>
</FontString>
<FontString name="ItemTextCurrentPage" inherits="GameFontNormal">
<Size><AbsDimension x="192" y="0"/></Size>
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="10" y="-50"/></Offset></Anchor></Anchors>
</FontString>
</Layer>
</Layers>
<Frames>
<!-- ref ItemTextScrollFrame l.145-219: the plain-Frame stand-in (see the header) with
the ref's own flanking scrollbar art kept verbatim. -->
<Frame name="ItemTextScrollFrame" hidden="true">
<Size><AbsDimension x="280" y="355"/></Size>
<Anchors><Anchor point="TOPRIGHT"><Offset><AbsDimension x="-66" y="-76"/></Offset></Anchor></Anchors>
<Layers>
<!-- The ref declares ARTWORK before BACKGROUND here, and the order is
load-bearing: Middle anchors to Top by name, and anchors resolve at
SetPoint time — a target declared later falls back to the parent (and
the black track lands on the parchment). -->
<Layer level="ARTWORK">
<Texture name="ItemTextScrollFrameTop" file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
<Size><AbsDimension x="28" y="256"/></Size>
<Anchors><Anchor point="TOPLEFT" relativePoint="TOPRIGHT"><Offset><AbsDimension x="0" y="5"/></Offset></Anchor></Anchors>
<TexCoords left="0" right="0.484375" top="0" bottom="1.0"/>
</Texture>
<Texture name="ItemTextScrollFrameBottom" file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
<Size><AbsDimension x="28" y="107"/></Size>
<Anchors><Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT"><Offset><AbsDimension x="0" y="-3"/></Offset></Anchor></Anchors>
<TexCoords left="0.515625" right="1.0" top="0" bottom="0.4140625"/>
</Texture>
</Layer>
<Layer level="BACKGROUND">
<Texture name="ItemTextScrollFrameMiddle">
<Size><AbsDimension x="25" y="365"/></Size>
<Anchors><Anchor point="TOPRIGHT" relativeTo="ItemTextScrollFrameTop"/></Anchors>
<Color r="0" g="0" b="0" a="0.8"/>
</Texture>
</Layer>
<Layer level="OVERLAY">
<!-- ref ItemTextPageText (SimpleHTML 270×304 at 0,-15 in the scroll child)
as a FontString at the same rect. -->
<FontString name="ItemTextPageText" inherits="ItemTextFontNormal" justifyH="LEFT" justifyV="TOP">
<Size><AbsDimension x="270" y="304"/></Size>
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="-15"/></Offset></Anchor></Anchors>
</FontString>
</Layer>
</Layers>
</Frame>
<!-- ref ItemTextStatusBar l.220-251 — the ITEM_TEXT_TRANSLATION progress bar; never
fires on our letters, kept for fidelity. -->
<StatusBar name="ItemTextStatusBar" hidden="true">
<Size><AbsDimension x="250" y="21"/></Size>
<Anchors><Anchor point="BOTTOM" relativeTo="ItemTextFrame"><Offset><AbsDimension x="-5" y="128"/></Offset></Anchor></Anchors>
<Layers>
<Layer level="OVERLAY">
<Texture file="Interface\PaperDollInfoFrame\UI-Character-Skills-BarBorder">
<Size><AbsDimension x="256" y="23"/></Size>
<Anchors><Anchor point="CENTER"/></Anchors>
<TexCoords left="0" right="1.0" top="0.0625" bottom="0.75"/>
</Texture>
</Layer>
</Layers>
<Scripts>
<OnLoad>this:SetFrameLevel(this:GetFrameLevel()+1)</OnLoad>
</Scripts>
<BarTexture file="Interface\TargetingFrame\UI-TargetingFrame-BarFill"/>
<BarColor r="0.25" g="0.75" b="0.25"/>
</StatusBar>
<Button name="ItemTextPrevPageButton" hidden="true">
<Size><AbsDimension x="32" y="32"/></Size>
<Anchors><Anchor point="CENTER" relativePoint="TOPLEFT"><Offset><AbsDimension x="90" y="-56"/></Offset></Anchor></Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString inherits="GameFontNormal" justifyH="LEFT" text="Prev"><!-- PREV -->
<Anchors><Anchor point="LEFT" relativePoint="RIGHT"/></Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
PlaySound("igMainMenuOptionCheckBoxOn")
ItemTextPrevPage()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Up"/>
<PushedTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Down"/>
<DisabledTexture file="Interface\Buttons\UI-SpellbookIcon-PrevPage-Disabled"/>
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
</Button>
<Button name="ItemTextNextPageButton" hidden="true">
<Size><AbsDimension x="32" y="32"/></Size>
<Anchors><Anchor point="CENTER" relativePoint="TOPRIGHT"><Offset><AbsDimension x="-55" y="-56"/></Offset></Anchor></Anchors>
<Layers>
<Layer level="ARTWORK">
<FontString inherits="GameFontNormal" justifyH="RIGHT" text="Next"><!-- NEXT -->
<Anchors><Anchor point="RIGHT" relativePoint="LEFT"/></Anchors>
</FontString>
</Layer>
</Layers>
<Scripts>
<OnClick>
PlaySound("igMainMenuOptionCheckBoxOn")
ItemTextNextPage()
</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Up"/>
<PushedTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Down"/>
<DisabledTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Disabled"/>
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
</Button>
<Button name="ItemTextCloseButton">
<Size><AbsDimension x="32" y="32"/></Size>
<Anchors><Anchor point="CENTER" relativePoint="TOPRIGHT"><Offset><AbsDimension x="-45" y="-26"/></Offset></Anchor></Anchors>
<Scripts>
<OnClick>HideUIPanel(ItemTextFrame)</OnClick>
</Scripts>
<NormalTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Up"/>
<PushedTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Down"/>
<HighlightTexture file="Interface\Buttons\UI-Panel-MinimizeButton-Highlight" alphaMode="ADD"/>
</Button>
</Frames>
<Scripts>
<OnLoad>ItemTextFrame_OnLoad()</OnLoad>
<OnEvent>ItemTextFrame_OnEvent(event)</OnEvent>
<OnUpdate>ItemTextFrame_OnUpdate(arg1)</OnUpdate>
<OnShow>PlaySound("igMainMenuOpen")</OnShow>
<OnHide>
CloseItemText()
PlaySound("igMainMenuClose")
</OnHide>
</Scripts>
</Frame>
</Ui>