Загрузить файлы в «/»

This commit is contained in:
Ade
2026-10-14 02:33:14 +00:00
parent 82b9bf2e03
commit 5c570522e9
3 changed files with 68 additions and 3 deletions
+2 -2
View File
@@ -29,7 +29,7 @@ function AA.Layout()
local bw = math.floor((pw - 18) / 2)
local bh = ph - 90
AA.COLS = math.max(1, math.floor((bw - 37) / AA.CELL))
AA.GROWS = math.max(1, math.floor((bh - 30) / AA.CELL))
AA.GROWS = math.max(1, math.floor((bh - 68) / AA.CELL))
AA.BI:SetWidth(bw)
AA.BI:SetHeight(bh)
AA.BB:SetWidth(bw)
@@ -44,7 +44,7 @@ function AA.Layout()
b:ClearAllPoints()
local r = math.floor((i - 1) / AA.COLS)
local c = math.mod(i - 1, AA.COLS)
b:SetPoint("TOPLEFT", B, "TOPLEFT", 9 + c * AA.CELL, -28 - r * AA.CELL)
b:SetPoint("TOPLEFT", B, "TOPLEFT", 9 + c * AA.CELL, -66 - r * AA.CELL)
end
end
+63 -1
View File
@@ -114,10 +114,12 @@ local function MakeBox(ttl, scrollName)
B.empty:SetPoint("CENTER", B, "CENTER", 0, 0)
B.empty:SetWidth(220)
B.empty:Hide()
B.ttl = ttl
B.bagBtns = {}
B.list = {}
B.cells = {}
B.sf = CreateFrame("ScrollFrame", scrollName, B, "FauxScrollFrameTemplate")
B.sf:SetPoint("TOPLEFT", B, "TOPLEFT", 0, -24)
B.sf:SetPoint("TOPLEFT", B, "TOPLEFT", 0, -62)
B.sf:SetPoint("BOTTOMRIGHT", B, "BOTTOMRIGHT", -26, 4)
B.sf:SetScript("OnVerticalScroll", function()
FauxScrollFrame_OnVerticalScroll(AA.CELL, function() UpdateGrid(B) end)
@@ -130,6 +132,66 @@ end
AA.BI = MakeBox("Inventory", "AdeAltsInvScroll")
AA.BB = MakeBox("Bank", "AdeAltsBankScroll")
-- one small button per bag: icon with "used/size" underneath
local function MakeBagBtn(B, i)
local b = CreateFrame("Button", nil, B)
b:SetWidth(36)
b:SetHeight(36)
b:SetPoint("TOPLEFT", B, "TOPLEFT", 6 + (i - 1) * 37, -25)
b.icon = b:CreateTexture(nil, "ARTWORK")
b.icon:SetWidth(22)
b.icon:SetHeight(22)
b.icon:SetPoint("TOP", b, "TOP", 0, 0)
b.icon:SetTexCoord(0.08, 0.92, 0.08, 0.92)
b.txt = b:CreateFontString(nil, "OVERLAY", "GameFontHighlightSmall")
b.txt:SetPoint("TOP", b.icon, "BOTTOM", 0, -1)
b:SetHighlightTexture("Interface\\Buttons\\ButtonHilight-Square")
b:SetScript("OnEnter", function()
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
GameTooltip:AddLine(this.label or "Bag")
GameTooltip:AddLine(this.used .. " of " .. this.size .. " slots used (" .. (this.size - this.used) .. " free)", 1, 1, 1)
GameTooltip:Show()
end)
b:SetScript("OnLeave", function() GameTooltip:Hide() end)
B.bagBtns[i] = b
return b
end
local function FillColor(used, size)
local f = size > 0 and used / size or 0
if f >= 0.95 then return "|cffff4040" elseif f >= 0.75 then return "|cffffd100" end
return "|cff40ff40"
end
-- info: "size:used:bagItemId~..." (nil = not cached); bank: true for the bank box
function AA.ShowBagStrip(B, info, bank)
local n, tu, ts = 0, 0, 0
if info and info ~= "" then
for size, used, id in string.gfind(info, "(%d+):(%d+):(%d+)") do
n = n + 1
size, used, id = tonumber(size), tonumber(used), tonumber(id)
tu, ts = tu + used, ts + size
local b = B.bagBtns[n] or MakeBagBtn(B, n)
b.size, b.used = size, used
if id > 0 then
b.icon:SetTexture(AA.ItemTex(id))
b.label = AA.ItemName(id)
else
b.icon:SetTexture("Interface\\Buttons\\Button-Backpack-Up")
b.label = bank and "Bank" or "Backpack"
end
b.txt:SetText(FillColor(used, size) .. used .. "/" .. size .. "|r")
b:Show()
end
end
for i = n + 1, table.getn(B.bagBtns) do B.bagBtns[i]:Hide() end
if n > 0 then
B.title:SetText(B.ttl .. " " .. FillColor(tu, ts) .. tu .. "/" .. ts .. "|r")
else
B.title:SetText(B.ttl)
end
end
function AA.SetBoxList(B, list)
B.list = list or {}
AA.ResetScroll(B.sf)
+3
View File
@@ -81,6 +81,7 @@ local function ShowBags(c)
AA.BB:Show()
AA.BI.empty:Hide()
AA.SetBoxList(AA.BI, c.inv)
AA.ShowBagStrip(AA.BI, c.invBags, false)
if c.invTs and c.invTs > 0 then
AA.BI.note:SetText("updated " .. AA.Ago(c.invTs))
else
@@ -92,9 +93,11 @@ local function ShowBags(c)
AA.BB.empty:Hide()
if c.bankTs and c.bankTs > 0 then
AA.SetBoxList(AA.BB, c.bank)
AA.ShowBagStrip(AA.BB, c.bankBags, true)
AA.BB.note:SetText("updated " .. AA.Ago(c.bankTs))
else
AA.SetBoxList(AA.BB, {})
AA.ShowBagStrip(AA.BB, nil, true)
AA.BB.note:SetText("")
AA.BB.empty:SetText("Bank not cached yet.\nOpen the bank on this character once.")
AA.BB.empty:Show()