-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGoldMakersGUI.lua
198 lines (178 loc) · 6.97 KB
/
GoldMakersGUI.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
local AceGUI = LibStub("AceGUI-3.0")
local GoldMakers = LibStub("AceAddon-3.0"):GetAddon("GoldMakers")
local addon = GetAddOnMetadata(..., "Title")
local versionAddon = GetAddOnMetadata(..., "version")
function GoldMakers.mainUI()
local window = AceGUI:Create("Window")
window:SetLayout("Flow")
window:SetTitle(addon .. " v" .. versionAddon .. " - Random Farm Generator")
window:SetWidth(465)
window:SetHeight(100)
window:EnableResize(false)
window:SetCallback("OnClose",
function()
profiledb.display = false
end
)
local output = AceGUI:Create("SimpleGroup")
output:SetLayout("flow")
output:SetFullWidth(true)
output:SetFullHeight(true)
local buttonDungeon = AceGUI:Create("Button")
buttonDungeon:SetText("Dungeon")
buttonDungeon:SetWidth(110)
buttonDungeon:SetCallback("OnClick",
function()
local container = output:GetUserData("container")
if container then
output:ReleaseChildren()
local output = AceGUI:Create("SimpleGroup")
output:SetLayout("flow")
output:SetFullWidth(true)
end
local label = AceGUI:Create("Label")
label:SetHeight(50)
label:SetFullWidth(true)
label:SetJustifyH("CENTER")
local dungeon = GoldMakers:GenerateDungeon()
if dungeon ~= false then
local data = "You have been chosen to farm |cffff9933" .. dungeon.name .. "|r"
label:SetText(data)
output:SetUserData("container", data)
output:AddChild(label)
else
local data = "You need to select some dungeons on addon configurations."
label:SetText(data)
output:SetUserData("container", data)
output:AddChild(label)
end
end
)
local buttonOpenWorld = AceGUI:Create("Button")
buttonOpenWorld:SetText("Open World")
buttonOpenWorld:SetWidth(110)
buttonOpenWorld:SetCallback("OnClick",
function()
local container = output:GetUserData("container")
if container then
output:ReleaseChildren()
local output = AceGUI:Create("SimpleGroup")
output:SetLayout("flow")
output:SetFullWidth(true)
end
local label = AceGUI:Create("InteractiveLabel")
label:SetHeight(50)
label:SetFullWidth(true)
label:SetJustifyH("CENTER")
local world = GoldMakers:GenerateOpenWorld()
if world ~= false then
local data = "You have been chosen to farm |cffff9933" .. world.name .. "|r"
label:SetText(data)
output:SetUserData("container", data)
output:AddChild(label)
else
local data = "You need to select some open world farms on addon configurations."
label:SetText(data)
output:SetUserData("container", data)
output:AddChild(label)
end
end
)
local buttonMaterial = AceGUI:Create("Button")
buttonMaterial:SetText("Material")
buttonMaterial:SetWidth(110)
buttonMaterial:SetCallback("OnClick",
function()
local container = output:GetUserData("container")
if container then
output:ReleaseChildren()
local output = AceGUI:Create("SimpleGroup")
output:SetLayout("flow")
output:SetFullWidth(true)
end
local label = AceGUI:Create("InteractiveLabel")
label:SetHeight(50)
label:SetFullWidth(true)
label:SetJustifyH("CENTER")
local material = GoldMakers:GenerateMaterial()
if material ~= false then
local data = "You have been chosen to farm " .. material.name
label:SetCallback("OnEnter",
function()
GameTooltip:SetOwner(label.frame, "ANCHOR_CURSOR")
GameTooltip:SetHyperlink(material.code)
GameTooltip:Show()
end
)
label:SetCallback("OnLeave",
function()
GameTooltip:Hide()
end
)
label:SetText(data)
output:SetUserData("container", data)
output:AddChild(label)
else
local data = "You need to select some materials on addon configurations."
label:SetText(data)
output:SetUserData("container", data)
output:AddChild(label)
end
end
)
local buttonPet = AceGUI:Create("Button")
buttonPet:SetText("Pet")
buttonPet:SetWidth(110)
buttonPet:SetCallback("OnClick",
function()
local container = output:GetUserData("container")
if container then
output:ReleaseChildren()
local output = AceGUI:Create("SimpleGroup")
output:SetLayout("flow")
output:SetFullWidth(true)
end
local label = AceGUI:Create("InteractiveLabel")
label:SetHeight(50)
label:SetFullWidth(true)
label:SetJustifyH("CENTER")
local pet = GoldMakers:GeneratePet()
if pet ~= false then
local data = "You have been chosen to farm " .. pet.name
label:SetCallback("OnEnter",
function()
GameTooltip:SetOwner(label.frame, "ANCHOR_CURSOR")
local _, speciesID, level, breedQuality = strsplit(":", pet.code)
BattlePetToolTip_Show(tonumber(speciesID), tonumber(level), tonumber(breedQuality))
end
)
label:SetCallback("OnLeave",
function()
BattlePetTooltip:Hide()
end
)
label:SetText(data)
output:SetUserData("container", data)
output:AddChild(label)
else
local data = "You need to select some pets on addon configurations."
label:SetText(data)
output:SetUserData("container", data)
output:AddChild(label)
end
end
)
window:AddChild(buttonDungeon)
window:AddChild(buttonOpenWorld)
window:AddChild(buttonMaterial)
window:AddChild(buttonPet)
window:AddChild(output)
window:Hide()
return window
end
function GoldMakers.mainUIHide(window)
window:Hide()
end
function GoldMakers.mainUIShow(window)
window:Show()
end