John@38
|
1 local AceGUI = LibStub("AceGUI-3.0")
|
John@42
|
2 local bsk=bsk
|
John@42
|
3 local _G=_G
|
John@42
|
4 local table=table
|
John@42
|
5 local pairs=pairs
|
John@42
|
6 local ipairs=ipairs
|
John@42
|
7 local string=string
|
John@42
|
8 local tostring=tostring
|
John@42
|
9 local type=type
|
John@42
|
10 local getn=getn
|
John@42
|
11 setfenv(1,bsk)
|
John@1
|
12
|
John@56
|
13 local copy = function(t)
|
John@56
|
14 local c = {}
|
John@56
|
15 if not t then return c end
|
John@56
|
16 for i,v in pairs(t) do c[i] = v end
|
John@56
|
17 return c
|
John@56
|
18 end
|
John@56
|
19 local colorize = function(str,color)
|
John@56
|
20 if str==nil or str=="" then return "" end
|
John@56
|
21 if type(color) == "table" then
|
John@56
|
22 color = string.format("%02x%02x%02x",255*color.r,255*color.g,255*color.b)
|
John@56
|
23 end
|
John@56
|
24 if color == nil then return str end
|
John@56
|
25 return "|cff"..tostring(color or "ffffff")..str.."|r"
|
John@56
|
26 end
|
John@1
|
27
|
John@56
|
28 local CreateListSelector = function(OnValueChanged)
|
John@56
|
29 PersonList:RefreshRaidList()
|
John@56
|
30 local pulldown = AceGUI:Create("Dropdown")
|
John@56
|
31 local pull = {}
|
John@56
|
32 local ltemp = 0
|
John@56
|
33 local lids = LootLists:GetAllIds()
|
John@56
|
34 for _,v in pairs(lids) do
|
John@56
|
35 local l = LootLists:Select(v)
|
John@56
|
36 pull[l:GetId()] = l:GetName()
|
John@56
|
37 --local entry = {value=i,text=v.name}
|
John@56
|
38 if l:GetLength() > 0 then
|
John@56
|
39 pulldown:SetItemDisabled(i,true)
|
John@56
|
40 if ltemp == 0 then
|
John@56
|
41 ltemp = l:GetId()
|
John@51
|
42 end
|
John@51
|
43 end
|
John@1
|
44 end
|
John@56
|
45 pulldown:SetWidth(175)
|
John@56
|
46 pulldown:SetList(pull)
|
John@56
|
47 pulldown:SetCallback("OnValueChanged", OnValueChanged)
|
John@56
|
48 if ltemp > 0 then pulldown:SetValue(ltemp); OnValueChanged(nil,nil,ltemp) end -- sadly, SetValue doesn't fire a OnValueChanged
|
John@56
|
49 return pulldown
|
John@1
|
50 end
|
John@1
|
51
|
John@56
|
52 local tree = {}
|
John@56
|
53 local ovc = function(t1,value)
|
John@56
|
54 tree = {}
|
John@56
|
55 local l = LootLists:Select(value)
|
John@56
|
56 for le in l:OrderedListEntryIter() do
|
John@56
|
57 local line = {value=le:GetId(),text=le:GetName(),icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]}
|
John@56
|
58 line.iconCoords=_G.CLASS_ICON_TCOORDS[le:GetClass()]
|
John@56
|
59 line.text=colorize(line.text,_G.RAID_CLASS_COLORS[le:GetClass()])
|
John@56
|
60 line.disabled = not PersonList:IsActive(le:GetId())
|
John@56
|
61 table.insert(tree,line)
|
John@56
|
62 end
|
John@56
|
63 t1:SetList(tree)
|
John@56
|
64 end
|
John@59
|
65 local f
|
John@59
|
66 local escapeButton =
|
John@59
|
67 {
|
John@59
|
68 shown = false,
|
John@59
|
69 ["IsShown"] = function(self) return self.shown end,
|
John@60
|
70 ["Hide"] = function(self) if f then AceGUI:Release(f); self.shown=false end end
|
John@59
|
71 }
|
John@38
|
72
|
John@42
|
73 function CreateGUI()
|
John@59
|
74 -- special registration procedure to be closable with the escape button
|
John@59
|
75 --escapeButton.shown = true
|
John@59
|
76 --_G["BSK_ESCAPEBUTTON"] = escapeButton
|
John@59
|
77 --table.insert(_G.UISpecialFrames, "BSK_ESCAPEBUTTON")
|
John@59
|
78
|
John@60
|
79 if f then return end -- no second gui please
|
John@60
|
80 local admin = bsk.admin or true
|
John@59
|
81 f = AceGUI:Create("Frame")
|
John@1
|
82
|
John@60
|
83 f:SetCallback("OnClose",function(widget) escapeButton.shown = false; AceGUI:Release(widget); f=nil end)
|
John@56
|
84 f:SetTitle("BSK")
|
John@56
|
85 f:SetLayout("Flow")
|
John@56
|
86 f:SetHeight(680)
|
John@56
|
87 f:SetWidth(580)
|
John@1
|
88
|
John@56
|
89 local left = AceGUI:Create("InlineGroup")
|
John@56
|
90 left:SetLayout("List")
|
John@56
|
91 left:SetWidth(175)
|
John@56
|
92 left:SetFullHeight(true)
|
John@56
|
93 left.alignoffset=0.25 -- hack, as per http://forums.wowace.com/showthread.php?t=17114
|
John@1
|
94
|
John@56
|
95 local right = AceGUI:Create("InlineGroup")
|
John@56
|
96 right:SetLayout("Flow")
|
John@56
|
97 right:SetWidth(700-175-160)
|
John@56
|
98 right:SetFullHeight(true)
|
John@56
|
99 right.alignoffset=0.25
|
John@38
|
100
|
John@56
|
101 local t1 = AceGUI:Create("SelectorList")
|
John@56
|
102 t1:SetNumLines(25)
|
John@56
|
103 t1:SetFullWidth(true)
|
John@56
|
104 t1:SetInteractive(admin)
|
John@38
|
105
|
John@56
|
106 local listChange = function(_,_,value)
|
John@56
|
107 ovc(t1,value)
|
John@56
|
108 end
|
John@56
|
109 local p1 = CreateListSelector(listChange)
|
John@56
|
110 p1:SetFullWidth(true)
|
John@38
|
111
|
John@56
|
112 left:AddChild(p1)
|
John@56
|
113 left:AddChild(t1)
|
John@38
|
114
|
John@56
|
115 local t2 = AceGUI:Create("SelectorList")
|
John@56
|
116 t2:SetNumLines(7)
|
John@56
|
117 t2:SetFullWidth(true)
|
John@56
|
118 t2:EnableButtonTooltips(true)
|
John@56
|
119 t2:SetList({
|
John@56
|
120 {
|
John@56
|
121 value=1,
|
John@56
|
122 text = "|cffa335ee|Hitem:77109:4080:4009:0:0:0:0:0:85:0|h[Band of Reconstruction]|h|r",
|
John@56
|
123 link = "|cffa335ee|Hitem:77109:4080:4009:0:0:0:0:0:85:0|h[Band of Reconstruction]|h|r",
|
John@56
|
124 },
|
John@56
|
125 {
|
John@56
|
126 value=2,
|
John@56
|
127 text = "|cffa335ee|Hitem:19351:0:0:0:0:0:0:0:85:0|h[Maladath, Runed Blade of the Black Flight]|h|r",
|
John@56
|
128 link = "|cffa335ee|Hitem:19351:0:0:0:0:0:0:0:85:0|h[Maladath, Runed Blade of the Black Flight]|h|r"
|
John@56
|
129 },
|
John@56
|
130 {
|
John@56
|
131 value=3,
|
John@56
|
132 text = "|cffa335ee|Hitem:31986:0:0:0:0:0:0:0:85:0|h[Merciless Gladiator's Crossbow of the Phoenix]|h|r",
|
John@56
|
133 link = "|cffa335ee|Hitem:31986:0:0:0:0:0:0:0:85:0|h[Merciless Gladiator's Crossbow of the Phoenix]|h|r"
|
John@56
|
134 },
|
John@56
|
135 {
|
John@56
|
136 value=4,
|
John@56
|
137 text = "|cffa335ee|Hitem:65003:0:0:0:0:0:0:0:85:0|h[Reclaimed Ashkandi, Greatsword of the Brotherhood]|h|r",
|
John@56
|
138 link = "|cffa335ee|Hitem:65003:0:0:0:0:0:0:0:85:0|h[Reclaimed Ashkandi, Greatsword of the Brotherhood]|h|r"
|
John@56
|
139 },
|
John@56
|
140 {
|
John@56
|
141 value=5,
|
John@56
|
142 text = "|cffff8000|Hitem:19019:0:0:0:0:0:0:0:85:0|h[Thunderfury, Blessed Blade of the Windseeker]|h|r",
|
John@56
|
143 link = "|cffff8000|Hitem:19019:0:0:0:0:0:0:0:85:0|h[Thunderfury, Blessed Blade of the Windseeker]|h|r"
|
John@56
|
144 },
|
John@56
|
145 })
|
John@38
|
146
|
John@60
|
147 local alb1, alb2, alb3
|
John@60
|
148 if admin then
|
John@60
|
149 alb1 = AceGUI:Create("Button")
|
John@60
|
150 alb1:SetWidth(100)
|
John@60
|
151 alb1:SetText("Open Bids")
|
John@60
|
152
|
John@60
|
153 alb2 = AceGUI:Create("Button")
|
John@60
|
154 alb2:SetWidth(100)
|
John@60
|
155 alb2:SetText("Assign")
|
John@60
|
156
|
John@60
|
157 alb3 = AceGUI:Create("Button")
|
John@60
|
158 alb3:SetWidth(100)
|
John@60
|
159 alb3:SetText("Suicide")
|
John@60
|
160 end
|
John@38
|
161
|
John@56
|
162 local spacer = AceGUI:Create("Label")
|
John@56
|
163 spacer:SetText(" ")
|
John@56
|
164 spacer:SetFullWidth(true)
|
John@56
|
165 local spacer2 = AceGUI:Create("Label")
|
John@56
|
166 spacer2:SetText(" ")
|
John@56
|
167 spacer2:SetFullWidth(true)
|
John@38
|
168
|
John@56
|
169 local biddingZone = AceGUI:Create("SimpleGroup")
|
John@56
|
170 biddingZone:SetLayout("Flow")
|
John@56
|
171 biddingZone:SetFullWidth(true)
|
John@1
|
172
|
John@56
|
173 local label = AceGUI:Create("Label")
|
John@56
|
174 label:SetText("Bidding now open for ...")
|
John@56
|
175 local biddingOn = AceGUI:Create("InteractiveLabel")
|
John@58
|
176 biddingOn.userdata = { "|cffa335ee|Hitem:65003:0:0:0:0:0:0:0:85:0|h[Reclaimed Ashkandi, Greatsword of the Brotherhood]|h|r" }
|
John@58
|
177 biddingOn:SetText(biddingOn.userdata[1])
|
John@56
|
178 biddingOn:SetFullWidth(true)
|
John@58
|
179 biddingOn:SetCallback("OnEnter", function(widget) _G.GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); _G.GameTooltip:SetHyperlink(widget.userdata[1]); _G.GameTooltip:Show() end )
|
John@56
|
180 biddingOn:SetCallback("OnLeave", function(widget) _G.GameTooltip:Hide() end )
|
John@56
|
181 local b1 = AceGUI:Create("SelectorList")
|
John@56
|
182 b1:SetNumLines(6)
|
John@56
|
183 b1:SetInteractive(admin)
|
John@56
|
184 local dummydata = {copy(tree[1]),copy( tree[2] ),copy( tree[3] )}
|
John@56
|
185 for i,v in pairs(dummydata) do v.disabled = false end
|
John@56
|
186 dummydata[2].text = dummydata[2].text .. " (roll 73)"
|
John@56
|
187 b1:SetList(dummydata)
|
John@56
|
188 local bidTitle = AceGUI:Create("Label")
|
John@56
|
189 bidTitle:SetText("Current bids")
|
John@56
|
190 bidTitle:SetFullWidth(true)
|
John@56
|
191
|
John@56
|
192 local bidRetractButton = AceGUI:Create("Button")
|
John@56
|
193 bidRetractButton:SetText("Place Bid")
|
John@56
|
194 bidRetractButton:SetWidth(100)
|
John@56
|
195 local rollButton = AceGUI:Create("Button")
|
John@56
|
196 rollButton:SetText("Offset Roll")
|
John@56
|
197 rollButton:SetWidth(100)
|
John@56
|
198
|
John@60
|
199 local g1, suicideSelected, undo
|
John@60
|
200 if admin then
|
John@60
|
201 b1.alignoffset = 0.25 -- or else g1 won't align well
|
John@60
|
202 g1 = AceGUI:Create("SimpleGroup")
|
John@60
|
203 g1.alignoffset = 0.25
|
John@60
|
204 g1:SetWidth(120)
|
John@60
|
205 g1:SetLayout("List")
|
John@56
|
206
|
John@60
|
207 adminForce = AceGUI:Create("Button")
|
John@60
|
208 adminForce:SetText("Force bid")
|
John@60
|
209 adminForce:SetWidth(100)
|
John@56
|
210
|
John@60
|
211 adminRetract = AceGUI:Create("Button")
|
John@60
|
212 adminRetract:SetText("Retract bid")
|
John@60
|
213 adminRetract:SetWidth(100)
|
John@56
|
214
|
John@60
|
215 g1:AddChildren(adminForce,adminRetract)
|
John@60
|
216
|
John@60
|
217 suicideSelected = AceGUI:Create("Button")
|
John@60
|
218 suicideSelected:SetFullWidth(true)
|
John@60
|
219 suicideSelected:SetText("Suicide")
|
John@60
|
220
|
John@60
|
221 undo = AceGUI:Create("Button")
|
John@60
|
222 undo:SetText("Undo")
|
John@60
|
223 undo:SetFullWidth(true)
|
John@60
|
224 end
|
John@60
|
225
|
John@60
|
226
|
John@56
|
227 local filter = AceGUI:Create("CheckBox")
|
John@56
|
228 filter:SetLabel("Only show active")
|
John@56
|
229 filter:SetFullWidth(true)
|
John@56
|
230
|
John@56
|
231 left:AddChildren(filter)
|
John@56
|
232 if admin then left:AddChildren(suicideSelected,undo) end
|
John@56
|
233 biddingZone:AddChildren(spacer,label,biddingOn,bidRetractButton,rollButton,spacer2,bidTitle,b1)
|
John@56
|
234 if admin then biddingZone:AddChildren(g1) end
|
John@56
|
235 right:AddChildren(t2)
|
John@56
|
236 if admin then right:AddChildren(alb1,alb2,alb3) end
|
John@56
|
237 right:AddChildren(biddingZone)
|
John@56
|
238 f:AddChildren(left,right)
|
John@58
|
239
|
John@58
|
240
|
John@1
|
241 end
|