Code:
local a = CreateFrame("Frame")
local e
local bankopened, itemlist = nil, {}
local function GetItems()
for bag=0, (bankopened and NUM_BAG_SLOTS+NUM_BANKBAGSLOTS or NUM_BAG_SLOTS) do
local itb = itemlist["bag"..tostring(bag)]
local items = {bag=bag}
for slot=1, GetContainerNumSlots(bag) do
local _,count = GetContainerItemInfo(bag, slot)
if count then
local name = GetItemInfo((GetContainerItemID(bag,slot)))
items[slot]={i=name,n=count}
end
end
if itb and itb.n then
local a = itb.n
items.n = a
itemlist[a] = items
itemlist["bag"..tostring(bag)] = items
else
tinsert(itemlist,items)
items.n = #itemlist
itemlist["bag"..tostring(bag)]= items
end
end
table.sort(itemlist, function(a,b) return a.bag < b.bag end)
end
a:SetScript("OnEvent", function(self, event)
if event == "BANKFRAME_OPENED" then
bankopened = true
GetItems()
elseif event == "BANKFRAME_CLOSED" then
bankopened = false
else
GetItems()
end
end)
a:RegisterEvent("BAG_UPDATE")
a:RegisterEvent("BANKFRAME_OPENED")
a:RegisterEvent("BANKFRAME_CLOSED")
SlashCmdList["REPORTITEMS"] = function()
local o = ""
for _,bagdata in ipairs(itemlist) do
local bagnum = bagdata.bag
local add = (bagnum == 0 and "Backpack" or bagnum <= NUM_BAG_SLOTS and "Bag #"..bagnum or "Bank bag #"..bagnum-NUM_BAG_SLOTS).." : "
local t = {}
for i,k in pairs(bagdata) do
if i ~= "bag" and i~="n" then
if type(k) ~= "table" then
print(_,i,type(k),strlen(tostring(k)) > 8 and tostring(k):sub(1,8).."..." or k)
else
tinsert(t, k.i.." ("..k.n..")")
end
end
end
add = add..table.concat(t, ", ")
o=o..add.."\n\n"
end
if not e then
e=CreateFrame("EditBox", nil, UIParent)
e:SetFrameStrata("FULLSCREEN_DIALOG")
e:SetFontObject(GameFontHighlightSmall)
e:SetTextColor(1,1,1)
e:SetMultiLine(true)
e.bg = e:CreateTexture(nil, "BACKGROUND")
e.bg:SetPoint("TOPLEFT")
e.bg:SetPoint("BOTTOMRIGHT", 0, -50)
e.bg:SetTexture(0.3,0.3,0.3)
e.close = CreateFrame("Button", nil, e)
e.close:SetPoint("BOTTOM", 0, 10)
e.close:SetHeight(30)
e.close:SetWidth(100)
e.close.bg = e.close:CreateTexture(nil, "BACKGROUND")
e.close.bg:SetAllPoints()
e.close.bg:SetTexture(0.8,0.2,0.2)
e.close:SetScript("OnClick", function() e:Hide() end)
e.close:RegisterForClicks("AnyUp")
e.close.text = e.close:CreateFontString(nil, "ARTWORK")
e.close.text:SetFontObject(GameFontHighlightSmall)
e.close.text:SetTextColor(0.8,0.8,0.8)
e.close.text:SetAllPoints()
e.close.text:SetText("Close")
e:SetAutoFocus(false)
e:ClearFocus()
e:SetTextInsets(10,10,10,10)
e:Hide()
e:SetScript("OnEditFocusGained", function(self) self:HighlightText() end)
e:SetPoint("TOPLEFT", 40, -40)
e:SetPoint("BOTTOMRIGHT", -40, 90)
end
e:Show()
e:SetText(o)
end
SLASH_REPORTITEMS1 = "/reportitems"
The code I promised you.