forked from kemayo/wow-bankstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.lua
More file actions
99 lines (82 loc) · 3.47 KB
/
debug.lua
File metadata and controls
99 lines (82 loc) · 3.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
local myname, ns = ...
local core = BankStack
local Debug = core.Debug
local encode_bagslot = core.encode_bagslot
local bag_ids = core.bag_ids
local bag_stacks = core.bag_stacks
local bag_maxstacks = core.bag_maxstacks
local function createtex(parent, layer, w, h, ...)
local tex = parent:CreateTexture(nil, layer)
tex:SetWidth(w) tex:SetHeight(h)
tex:SetPoint(...)
return tex
end
local frame
local function getFrame()
if not frame then
local name = myname .. 'DebugFrame'
frame = CreateFrame("Frame", name, UIParent, "UIPanelDialogTemplate")
frame:SetFrameStrata("DIALOG")
frame:SetMovable(true)
frame:SetClampedToScreen(true)
frame:RegisterForDrag("LeftButton")
frame:SetWidth(832)
frame:SetHeight(447)
frame:SetPoint("TOPLEFT", 0, -104)
frame:Hide()
frame.Title:SetText(myname)
local titlebg = _G[name .. 'TitleBG']
local titlebutton = CreateFrame("Frame", nil, frame)
titlebutton:SetPoint("TOPLEFT", titlebg)
titlebutton:SetPoint("BOTTOMRIGHT", titlebg)
titlebutton:EnableMouse(true)
titlebutton:RegisterForDrag("LeftButton")
titlebutton:SetScript("OnDragStart", function(self)
frame.moving = true
frame:StartMoving()
end)
titlebutton:SetScript("OnDragStop", function(self)
frame.moving = nil
frame:StopMovingOrSizing()
end)
local scrollframe = CreateFrame("ScrollFrame", name .. "ScrollFrame", frame, "UIPanelScrollFrameTemplate")
scrollframe:SetWidth(832 - 41)
scrollframe:SetHeight(447 - 41)
scrollframe:SetPoint("TOPLEFT", 12, -30)
local editbox = CreateFrame("EditBox", name .. "Text", scrollframe)
editbox:SetWidth(scrollframe:GetWidth())
editbox:SetHeight(scrollframe:GetHeight())
editbox:SetFontObject(GameFontHighlightSmall)
editbox:SetMultiLine(true)
editbox:SetAutoFocus(false)
editbox:SetScript("OnCursorChanged", ScrollingEdit_OnCursorChanged)
editbox:SetScript("OnUpdate", function(self, elapsed) ScrollingEdit_OnUpdate(self, elapsed, self:GetParent()) end)
editbox:SetScript("OnEditFocusGained", function(self) self:HighlightText(0) end)
editbox:SetScript("OnEscapePressed", editbox.ClearFocus)
scrollframe:SetScrollChild(editbox)
frame.scrollframe = scrollframe
frame.editbox = editbox
end
frame.editbox:SetText("")
return frame
end
SlashCmdList["BANKSTACKDEBUG"] = core.CommandDecorator(function(bags)
getFrame()
for i, bag, slot in core.IterateBags(bags, nil, "both") do
local bagslot = encode_bagslot(bag, slot)
local itemid = bag_ids[bagslot]
if itemid then
local name, _, rarity, level, _, _, _, _, equipLoc, _, price, class, subClass = GetItemInfo(itemid)
frame.editbox:Insert(("%d | %d.%d | %d | %s | %d/%d | %d | %d | %s | %d | %d.%d\n"):format(i, bag, slot, itemid, name, bag_stacks[bagslot], bag_maxstacks[bagslot], rarity, level, equipLoc, price, class, subClass))
else
frame.editbox:Insert(("%d | %d.%d | EMPTY\n"):format(i, bag, slot))
end
-- if (not core.db.ignore_bags[bag] and not core.db.ignore[bagslot]) then
-- end
end
frame:Show()
frame.scrollframe:SetVerticalScroll(0)
frame.editbox:HighlightText(0)
frame.editbox:SetCursorPosition(0)
end, 'bags', 1)
SLASH_BANKSTACKDEBUG1 = "/bankstackdebug"