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@59
|
70 ["Hide"] = function(self) if f then bsk.print("Release!");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@56
|
79 local admin = bsk.admin
|
John@59
|
80 f = AceGUI:Create("Frame")
|
John@1
|
81
|
John@59
|
82 f:SetCallback("OnClose",function(widget) escapeButton.shown = false; AceGUI:Release(widget) end)
|
John@56
|
83 f:SetTitle("BSK")
|
John@56
|
84 f:SetLayout("Flow")
|
John@56
|
85 f:SetHeight(680)
|
John@56
|
86 f:SetWidth(580)
|
John@1
|
87
|
John@58
|
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@56
|
147 local alb1 = AceGUI:Create("Button")
|
John@56
|
148 alb1:SetWidth(100)
|
John@56
|
149 alb1:SetText("Open Bids")
|
John@56
|
150 local alb2 = AceGUI:Create("Button")
|
John@56
|
151 alb2:SetWidth(100)
|
John@56
|
152 alb2:SetText("Assign")
|
John@56
|
153 local alb3 = AceGUI:Create("Button")
|
John@56
|
154 alb3:SetWidth(100)
|
John@56
|
155 alb3:SetText("Suicide")
|
John@38
|
156
|
John@56
|
157 local spacer = AceGUI:Create("Label")
|
John@56
|
158 spacer:SetText(" ")
|
John@56
|
159 spacer:SetFullWidth(true)
|
John@56
|
160 local spacer2 = AceGUI:Create("Label")
|
John@56
|
161 spacer2:SetText(" ")
|
John@56
|
162 spacer2:SetFullWidth(true)
|
John@38
|
163
|
John@56
|
164 local biddingZone = AceGUI:Create("SimpleGroup")
|
John@56
|
165 biddingZone:SetLayout("Flow")
|
John@56
|
166 biddingZone:SetFullWidth(true)
|
John@1
|
167
|
John@56
|
168 local label = AceGUI:Create("Label")
|
John@56
|
169 label:SetText("Bidding now open for ...")
|
John@56
|
170 local biddingOn = AceGUI:Create("InteractiveLabel")
|
John@58
|
171 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
|
172 biddingOn:SetText(biddingOn.userdata[1])
|
John@56
|
173 biddingOn:SetFullWidth(true)
|
John@58
|
174 biddingOn:SetCallback("OnEnter", function(widget) _G.GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); _G.GameTooltip:SetHyperlink(widget.userdata[1]); _G.GameTooltip:Show() end )
|
John@56
|
175 biddingOn:SetCallback("OnLeave", function(widget) _G.GameTooltip:Hide() end )
|
John@56
|
176 local b1 = AceGUI:Create("SelectorList")
|
John@56
|
177 b1:SetNumLines(6)
|
John@56
|
178 b1:SetInteractive(admin)
|
John@56
|
179 local dummydata = {copy(tree[1]),copy( tree[2] ),copy( tree[3] )}
|
John@56
|
180 for i,v in pairs(dummydata) do v.disabled = false end
|
John@56
|
181 dummydata[2].text = dummydata[2].text .. " (roll 73)"
|
John@56
|
182 b1:SetList(dummydata)
|
John@56
|
183 local bidTitle = AceGUI:Create("Label")
|
John@56
|
184 bidTitle:SetText("Current bids")
|
John@56
|
185 bidTitle:SetFullWidth(true)
|
John@56
|
186
|
John@56
|
187 local bidRetractButton = AceGUI:Create("Button")
|
John@56
|
188 bidRetractButton:SetText("Place Bid")
|
John@56
|
189 bidRetractButton:SetWidth(100)
|
John@56
|
190 local rollButton = AceGUI:Create("Button")
|
John@56
|
191 rollButton:SetText("Offset Roll")
|
John@56
|
192 rollButton:SetWidth(100)
|
John@56
|
193
|
John@56
|
194 b1.alignoffset = 0.25 -- or else g1 won't align well
|
John@56
|
195 local g1 = AceGUI:Create("SimpleGroup")
|
John@56
|
196 g1.alignoffset = 0.25
|
John@56
|
197 g1:SetWidth(120)
|
John@56
|
198 g1:SetLayout("List")
|
John@56
|
199 local adminForce = AceGUI:Create("Button")
|
John@56
|
200 adminForce:SetText("Force bid")
|
John@56
|
201 adminForce:SetWidth(100)
|
John@56
|
202 local adminRetract = AceGUI:Create("Button")
|
John@56
|
203 adminRetract:SetText("Retract bid")
|
John@56
|
204 adminRetract:SetWidth(100)
|
John@56
|
205 g1:AddChildren(adminForce,adminRetract)
|
John@56
|
206
|
John@56
|
207
|
John@56
|
208
|
John@56
|
209 local suicideSelected = AceGUI:Create("Button")
|
John@56
|
210 suicideSelected:SetFullWidth(true)
|
John@56
|
211 suicideSelected:SetText("Suicide")
|
John@56
|
212 local undo = AceGUI:Create("Button")
|
John@56
|
213 undo:SetText("Undo")
|
John@56
|
214 undo:SetFullWidth(true)
|
John@56
|
215 local filter = AceGUI:Create("CheckBox")
|
John@56
|
216 filter:SetLabel("Only show active")
|
John@56
|
217 filter:SetFullWidth(true)
|
John@56
|
218
|
John@56
|
219 left:AddChildren(filter)
|
John@56
|
220 if admin then left:AddChildren(suicideSelected,undo) end
|
John@56
|
221 biddingZone:AddChildren(spacer,label,biddingOn,bidRetractButton,rollButton,spacer2,bidTitle,b1)
|
John@56
|
222 if admin then biddingZone:AddChildren(g1) end
|
John@56
|
223 right:AddChildren(t2)
|
John@56
|
224 if admin then right:AddChildren(alb1,alb2,alb3) end
|
John@56
|
225 right:AddChildren(biddingZone)
|
John@56
|
226 f:AddChildren(left,right)
|
John@58
|
227
|
John@58
|
228
|
John@1
|
229 end
|