-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSortByBuyout.lua
73 lines (59 loc) · 2.39 KB
/
SortByBuyout.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
local version = "1.0.0"
--local frame = CreateFrame("Frame")
--frame:SetFrameStrata("LOW")
--local auctionSortButton = CreateFrame("Button","auctionSortButton",_G["AuctionFrame"],"UIPanelButtonTemplate") --frameType, frameName, frameParent, frameTemplate
--auctionSortButton:SetSize(150,20)
local auctionSortButton = CreateFrame("Button","auctionSortButton",getglobal("AuctionFrame"),"UIPanelButtonTemplate") --frameType, frameName, frameParent, frameTemplate
auctionSortButton:SetWidth(150)
auctionSortButton:SetHeight(20)
auctionSortButton:SetFrameStrata("HIGH")
--auctionSortButton:SetPoint("CENTER",0,320)
--auctionSortButton:SetPoint("CENTER",40,300)
--auctionSortButton:SetPoint("RIGHT",_G["AuctionFrame"],"TOPRIGHT",-24,0)
--auctionSortButton:SetPoint("TOP",_G["AuctionFrame"],"TOP",0,0)
-- auctionSortButton.text = _G[name.."Text"]
-- auctionSortButton.text:SetText("Hello World")
auctionSortButton:SetText("sort by buyout")
auctionSortButton:SetScript("OnClick", function(self, arg1)
SortAuctionItems("list", "buyout")
end)
--auctionSortButton:Hide()
--auctionSortButton:Click("foo bar") -- will print "foo bar" in the chat frame.
--auctionSortButton:Click("blah blah") -- will print "blah blah" in the chat frame.
function updateSortByBuyoutButton()
if (auctionHouseVisible == true) then
auctionSortButton:Show()
else
auctionSortButton:Hide()
end
end
function updateAll()
updateSortByBuyoutButton()
end
auctionHouseVisible = false
addonIsLoaded = false
--/run print((select(4, GetBuildInfo())));
--/run print(GetBuildInfo());
function SortByBuyout_OnEvent(event)
--print(string.format("event: %s", event));
if event == "AUCTION_HOUSE_SHOW" then
auctionHouseVisible = true
auctionSortButton:SetPoint("TOPRIGHT",getglobal("AuctionFrame"),"TOPRIGHT",-22,-12)
updateSortByBuyoutButton()
--auctionSortButton:Show()
elseif event == "AUCTION_HOUSE_CLOSED" then
auctionHouseVisible = false
--auctionSortButton:Hide()
updateSortByBuyoutButton()
end
end
function SortByBuyout_OnLoad()
print(string.format("%s: v%s by Redbu11 is loaded susscessfully\nThank you for using my addon", "SortByBuyout", version));
addonIsLoaded = true
--frame:SetScript("OnEvent", dispatchEvents)
this:RegisterEvent("ADDON_LOADED")
this:RegisterEvent("AUCTION_HOUSE_SHOW")
this:RegisterEvent("AUCTION_HOUSE_CLOSED")
end
--Init
--init()