-
Notifications
You must be signed in to change notification settings - Fork 42
/
frame.lua
114 lines (111 loc) · 3.44 KB
/
frame.lua
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
select(2, ...) 'aux'
local gui = require 'aux.gui'
local scan = require 'aux.core.scan'
local post = require 'aux.tabs.post'
local search = require 'aux.tabs.search'
function event.AUX_LOADED()
for _, v in ipairs(tab_info) do
tabs:create_tab(v.name)
end
end
do
local frame = CreateFrame('Frame', 'aux_frame', UIParent, 'BackdropTemplate')
tinsert(UISpecialFrames, 'aux_frame')
gui.set_window_style(frame)
gui.set_size(frame, 768, 447)
frame:SetPoint('LEFT', 100, 0)
frame:SetToplevel(true)
frame:SetMovable(true)
frame:EnableMouse(true)
frame:RegisterForDrag('LeftButton')
frame:SetScript('OnDragStart', frame.StartMoving)
frame:SetScript('OnDragStop', frame.StopMovingOrSizing)
frame:SetClampedToScreen(true)
-- frame:CreateTitleRegion():SetAllPoints() TODO classic why
frame:SetScript('OnShow', function() PlaySound(SOUNDKIT.AUCTION_WINDOW_OPEN) end)
frame:SetScript('OnHide', function() PlaySound(SOUNDKIT.AUCTION_WINDOW_CLOSE); CloseAuctionHouse() end)
frame.content = CreateFrame('Frame', nil, frame)
frame.content:SetPoint('TOPLEFT', 4, -80)
frame.content:SetPoint('BOTTOMRIGHT', -4, 35)
frame:Hide()
M.frame = frame
end
do
local status_bar = gui.status_bar(frame.content)
status_bar:SetWidth(265)
status_bar:SetHeight(27)
status_bar:SetPoint('TOPLEFT', frame.content, 'BOTTOMLEFT', 0, -3)
status_bar:update_status(1, 1)
M.status_bar = status_bar
end
do
tabs = gui.tabs(frame, 'DOWN')
tabs._on_select = on_tab_click
function M.set_tab(id) tabs:select(id) end
end
do
local btn = gui.button(frame)
btn:SetPoint('BOTTOMRIGHT', -5, 5)
gui.set_size(btn, 60, 24)
btn:SetText('Close')
btn:SetScript('OnClick', function() frame:Hide() end)
close_button = btn
end
do
local btn = gui.button(frame, gui.font_size.small)
btn:SetPoint('RIGHT', close_button, 'LEFT' , -5, 0)
gui.set_size(btn, 60, 24)
btn:SetText(color.blizzard'Blizzard UI')
btn:SetScript('OnClick',function()
if AuctionFrame:IsVisible() then
AuctionFrame_Hide()
else
AuctionFrame_Show()
end
end)
blizzard_button = btn
end
do
local btn = gui.button(frame)
btn:SetPoint('RIGHT', blizzard_button, 'LEFT' , -5, 0)
gui.set_size(btn, 60, 24)
btn:SetText('Scan')
btn:SetScript('OnUpdate', function(self)
if select(2, CanSendAuctionQuery()) then
self:Enable()
self:SetBackdropColor(color.state.enabled())
else
self:Disable()
self:SetBackdropColor(color.content.background())
end
end)
btn:SetScript('OnClick', function()
local total
local count = 0
scan.start{
type = 'list',
sort_type = 'unitprice',
queries = {{blizzard_query = {}}},
get_all = true,
on_scan_start = function()
status_bar:update_status(0, 0)
post.clear_auctions()
search.clear_selection()
end,
on_page_loaded = function(_, _, _, page_size)
total = page_size
end,
on_auction = function(auction_record)
count = count + 1
status_bar:update_status(count / total, 0)
post.record_auction(auction_record)
end,
on_abort = function()
status_bar:update_status(1, 1)
end,
on_complete = function()
status_bar:update_status(1, 1)
end,
}
end)
end