A frame's comment names the stock file or 1.12 default its shape follows; a Lua comment stays where the code would otherwise be "fixed". Notes the code contradicts are gone. With XML and Lua comments stripped every file is identical, and each is well-formed. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
96 lines
4.7 KiB
XML
96 lines
4.7 KiB
XML
<!--
|
|
Our adapters over the stock `Interface\FrameXML\ContainerFrame.xml` and `.lua`, which run off
|
|
the player's patch chain: the bag windows are the stock `ContainerFrame1..12`. This file loads
|
|
after them, so its definitions win; a stock body that needs a benilla answer is wrapped here.
|
|
Deviation: benilla's keyring is a container (id -2) where the reference's is inventory slots,
|
|
so a keyring slot's tooltip comes from `GameTooltip:SetBagItem` like any bag's; the stock
|
|
keyring fork in `ContainerFrameItemButton_OnEnter` (ContainerFrame.lua l.615-620) reads the
|
|
inventory-slot space, which our keyring items are not in.
|
|
A full keyring prints the reference's empty error line: its `PutKeyInKeyRing` reads
|
|
`NO_EMPTY_KEYRING_SLOTS`, which 1.12 does not ship (it has `NO_EMPTY_KEYRING_SLOTS_ERROR`).
|
|
That is the reference's behaviour, kept.
|
|
-->
|
|
<Ui xmlns="http://www.blizzard.com/wow/ui/">
|
|
<Script><![CDATA[
|
|
-- The stock body, captured before the name is shadowed. It is nil when no client data was
|
|
-- sourced, and the call then says so rather than doing nothing.
|
|
local refItemButtonOnEnter = ContainerFrameItemButton_OnEnter
|
|
|
|
function ContainerFrameItemButton_OnEnter(button)
|
|
if not button then
|
|
button = this
|
|
end
|
|
if not button then return end
|
|
|
|
-- Our keyring is a container, so its slot takes the stock general path's calls for a
|
|
-- bag slot instead of the inventory-slot detour.
|
|
if button:GetParent():GetID() == KEYRING_CONTAINER then
|
|
if (button:GetRight() or 0) >= (GetScreenWidth() / 2) then
|
|
GameTooltip:SetOwner(button, "ANCHOR_LEFT")
|
|
else
|
|
GameTooltip:SetOwner(button, "ANCHOR_RIGHT")
|
|
end
|
|
GameTooltip:SetBagItem(KEYRING_CONTAINER, button:GetID())
|
|
ResetCursor()
|
|
return
|
|
end
|
|
|
|
if not refItemButtonOnEnter then
|
|
message("benilla: Interface\\FrameXML\\ContainerFrame.lua was not sourced from the "
|
|
.. "game data, so bag-slot tooltips cannot work. Check the client data path.")
|
|
return
|
|
end
|
|
refItemButtonOnEnter(button)
|
|
end
|
|
|
|
-- ══ The three bag verbs benilla answers differently ═══════════════════════════════════
|
|
-- Deviation: `OpenBackpack` opens every equipped bag, not only the backpack, so the
|
|
-- vendor, bank, mail and trade windows that call it from OnShow bring up every bag to sell
|
|
-- or deposit from; `CloseBackpack` is its inverse, `CloseAllBags` the unconditional form.
|
|
-- The was-open memory is keyed by bag id because `ContainerFrame1..12` are recycled across
|
|
-- bags, and every open and close goes through the stock `OpenBag`/`CloseBag`/`IsBagOpen`,
|
|
-- so their guards and any addon that replaces them apply.
|
|
BENILLA_BAG_WAS_OPEN = {}
|
|
|
|
-- The unconditional close, from the stock ShowUIPanel's centre branch: it ignores the
|
|
-- was-open memory and covers the bank bags, as the reference's CloseAllBags does
|
|
-- (l.702-707).
|
|
function BenillaCloseAllBags()
|
|
for bagId = 0, (NUM_CONTAINER_FRAMES or -1) do
|
|
CloseBag(bagId)
|
|
end
|
|
end
|
|
|
|
-- A bag already open is remembered and left alone, so CloseBackpack leaves open a window
|
|
-- the player opened; the reference's `backpackWasOpen`, one entry per bag.
|
|
function BenillaOpenBackpack()
|
|
for bagId = 0, (NUM_BAG_FRAMES or -1) do
|
|
-- OpenBag's own test, repeated so the memory agrees with it: the backpack always,
|
|
-- another bag only when its slot holds one.
|
|
if bagId == 0 or GetContainerNumSlots(bagId) > 0 then
|
|
if IsBagOpen(bagId) then
|
|
BENILLA_BAG_WAS_OPEN[bagId] = 1
|
|
else
|
|
BENILLA_BAG_WAS_OPEN[bagId] = nil
|
|
OpenBag(bagId)
|
|
end
|
|
end
|
|
end
|
|
end
|
|
|
|
function BenillaCloseBackpack()
|
|
for bagId = 0, (NUM_BAG_FRAMES or -1) do
|
|
if not BENILLA_BAG_WAS_OPEN[bagId] then
|
|
CloseBag(bagId)
|
|
end
|
|
end
|
|
end
|
|
|
|
-- Published after the stock ContainerFrame.lua has loaded, so these are the definitions its
|
|
-- callers reach (the stock `ShowUIPanel`'s `CloseAllBags`, a vendor's `OpenBackpack`).
|
|
OpenBackpack = BenillaOpenBackpack
|
|
CloseBackpack = BenillaCloseBackpack
|
|
CloseAllBags = BenillaCloseAllBags
|
|
]]></Script>
|
|
</Ui>
|