John@38: local AceGUI = LibStub("AceGUI-3.0") John@42: local bsk=bsk John@42: local _G=_G John@42: local table=table John@42: local pairs=pairs John@42: local ipairs=ipairs John@42: local string=string John@42: local tostring=tostring John@42: local type=type John@42: local getn=getn John@42: setfenv(1,bsk) John@1: John@56: local copy = function(t) John@56: local c = {} John@56: if not t then return c end John@56: for i,v in pairs(t) do c[i] = v end John@56: return c John@56: end John@56: local colorize = function(str,color) John@56: if str==nil or str=="" then return "" end John@56: if type(color) == "table" then John@56: color = string.format("%02x%02x%02x",255*color.r,255*color.g,255*color.b) John@56: end John@56: if color == nil then return str end John@56: return "|cff"..tostring(color or "ffffff")..str.."|r" John@56: end John@1: John@56: local CreateListSelector = function(OnValueChanged) John@56: PersonList:RefreshRaidList() John@56: local pulldown = AceGUI:Create("Dropdown") John@56: local pull = {} John@56: local ltemp = 0 John@56: local lids = LootLists:GetAllIds() John@56: for _,v in pairs(lids) do John@56: local l = LootLists:Select(v) John@56: pull[l:GetId()] = l:GetName() John@56: --local entry = {value=i,text=v.name} John@56: if l:GetLength() > 0 then John@56: pulldown:SetItemDisabled(i,true) John@56: if ltemp == 0 then John@56: ltemp = l:GetId() John@51: end John@51: end John@1: end John@56: pulldown:SetWidth(175) John@56: pulldown:SetList(pull) John@56: pulldown:SetCallback("OnValueChanged", OnValueChanged) John@56: if ltemp > 0 then pulldown:SetValue(ltemp); OnValueChanged(nil,nil,ltemp) end -- sadly, SetValue doesn't fire a OnValueChanged John@56: return pulldown John@1: end John@1: John@56: local tree = {} John@56: local ovc = function(t1,value) John@56: tree = {} John@56: local l = LootLists:Select(value) John@56: for le in l:OrderedListEntryIter() do John@56: local line = {value=le:GetId(),text=le:GetName(),icon=[[Interface\Glues\CharacterCreate\UI-CharacterCreate-Classes]]} John@56: line.iconCoords=_G.CLASS_ICON_TCOORDS[le:GetClass()] John@56: line.text=colorize(line.text,_G.RAID_CLASS_COLORS[le:GetClass()]) John@56: line.disabled = not PersonList:IsActive(le:GetId()) John@56: table.insert(tree,line) John@56: end John@56: t1:SetList(tree) John@56: end John@59: local f John@59: local escapeButton = John@59: { John@59: shown = false, John@59: ["IsShown"] = function(self) return self.shown end, John@60: ["Hide"] = function(self) if f then AceGUI:Release(f); self.shown=false end end John@59: } John@38: John@42: function CreateGUI() John@59: -- special registration procedure to be closable with the escape button John@59: --escapeButton.shown = true John@59: --_G["BSK_ESCAPEBUTTON"] = escapeButton John@59: --table.insert(_G.UISpecialFrames, "BSK_ESCAPEBUTTON") John@59: John@60: if f then return end -- no second gui please John@60: local admin = bsk.admin or true John@59: f = AceGUI:Create("Frame") John@1: John@60: f:SetCallback("OnClose",function(widget) escapeButton.shown = false; AceGUI:Release(widget); f=nil end) John@56: f:SetTitle("BSK") John@56: f:SetLayout("Flow") John@56: f:SetHeight(680) John@56: f:SetWidth(580) John@1: John@56: local left = AceGUI:Create("InlineGroup") John@56: left:SetLayout("List") John@56: left:SetWidth(175) John@56: left:SetFullHeight(true) John@56: left.alignoffset=0.25 -- hack, as per http://forums.wowace.com/showthread.php?t=17114 John@1: John@56: local right = AceGUI:Create("InlineGroup") John@56: right:SetLayout("Flow") John@56: right:SetWidth(700-175-160) John@56: right:SetFullHeight(true) John@56: right.alignoffset=0.25 John@38: John@56: local t1 = AceGUI:Create("SelectorList") John@56: t1:SetNumLines(25) John@56: t1:SetFullWidth(true) John@56: t1:SetInteractive(admin) John@38: John@56: local listChange = function(_,_,value) John@56: ovc(t1,value) John@56: end John@56: local p1 = CreateListSelector(listChange) John@56: p1:SetFullWidth(true) John@38: John@56: left:AddChild(p1) John@56: left:AddChild(t1) John@38: John@56: local t2 = AceGUI:Create("SelectorList") John@56: t2:SetNumLines(7) John@56: t2:SetFullWidth(true) John@56: t2:EnableButtonTooltips(true) John@56: t2:SetList({ John@56: { John@56: value=1, John@56: text = "|cffa335ee|Hitem:77109:4080:4009:0:0:0:0:0:85:0|h[Band of Reconstruction]|h|r", John@56: link = "|cffa335ee|Hitem:77109:4080:4009:0:0:0:0:0:85:0|h[Band of Reconstruction]|h|r", John@56: }, John@56: { John@56: value=2, John@56: 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: 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: }, John@56: { John@56: value=3, John@56: 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: 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: }, John@56: { John@56: value=4, John@56: text = "|cffa335ee|Hitem:65003:0:0:0:0:0:0:0:85:0|h[Reclaimed Ashkandi, Greatsword of the Brotherhood]|h|r", John@56: link = "|cffa335ee|Hitem:65003:0:0:0:0:0:0:0:85:0|h[Reclaimed Ashkandi, Greatsword of the Brotherhood]|h|r" John@56: }, John@56: { John@56: value=5, John@56: text = "|cffff8000|Hitem:19019:0:0:0:0:0:0:0:85:0|h[Thunderfury, Blessed Blade of the Windseeker]|h|r", John@56: link = "|cffff8000|Hitem:19019:0:0:0:0:0:0:0:85:0|h[Thunderfury, Blessed Blade of the Windseeker]|h|r" John@56: }, John@56: }) John@38: John@60: local alb1, alb2, alb3 John@60: if admin then John@60: alb1 = AceGUI:Create("Button") John@60: alb1:SetWidth(100) John@60: alb1:SetText("Open Bids") John@60: John@60: alb2 = AceGUI:Create("Button") John@60: alb2:SetWidth(100) John@60: alb2:SetText("Assign") John@60: John@60: alb3 = AceGUI:Create("Button") John@60: alb3:SetWidth(100) John@60: alb3:SetText("Suicide") John@60: end John@38: John@56: local spacer = AceGUI:Create("Label") John@56: spacer:SetText(" ") John@56: spacer:SetFullWidth(true) John@56: local spacer2 = AceGUI:Create("Label") John@56: spacer2:SetText(" ") John@56: spacer2:SetFullWidth(true) John@38: John@56: local biddingZone = AceGUI:Create("SimpleGroup") John@56: biddingZone:SetLayout("Flow") John@56: biddingZone:SetFullWidth(true) John@1: John@56: local label = AceGUI:Create("Label") John@56: label:SetText("Bidding now open for ...") John@56: local biddingOn = AceGUI:Create("InteractiveLabel") John@58: 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: biddingOn:SetText(biddingOn.userdata[1]) John@56: biddingOn:SetFullWidth(true) John@58: biddingOn:SetCallback("OnEnter", function(widget) _G.GameTooltip:SetOwner(widget.frame,"ANCHOR_RIGHT"); _G.GameTooltip:SetHyperlink(widget.userdata[1]); _G.GameTooltip:Show() end ) John@56: biddingOn:SetCallback("OnLeave", function(widget) _G.GameTooltip:Hide() end ) John@56: local b1 = AceGUI:Create("SelectorList") John@56: b1:SetNumLines(6) John@56: b1:SetInteractive(admin) John@56: local dummydata = {copy(tree[1]),copy( tree[2] ),copy( tree[3] )} John@56: for i,v in pairs(dummydata) do v.disabled = false end John@56: dummydata[2].text = dummydata[2].text .. " (roll 73)" John@56: b1:SetList(dummydata) John@56: local bidTitle = AceGUI:Create("Label") John@56: bidTitle:SetText("Current bids") John@56: bidTitle:SetFullWidth(true) John@56: John@56: local bidRetractButton = AceGUI:Create("Button") John@56: bidRetractButton:SetText("Place Bid") John@56: bidRetractButton:SetWidth(100) John@56: local rollButton = AceGUI:Create("Button") John@56: rollButton:SetText("Offset Roll") John@56: rollButton:SetWidth(100) John@56: John@60: local g1, suicideSelected, undo John@60: if admin then John@60: b1.alignoffset = 0.25 -- or else g1 won't align well John@60: g1 = AceGUI:Create("SimpleGroup") John@60: g1.alignoffset = 0.25 John@60: g1:SetWidth(120) John@60: g1:SetLayout("List") John@56: John@60: adminForce = AceGUI:Create("Button") John@60: adminForce:SetText("Force bid") John@60: adminForce:SetWidth(100) John@56: John@60: adminRetract = AceGUI:Create("Button") John@60: adminRetract:SetText("Retract bid") John@60: adminRetract:SetWidth(100) John@56: John@60: g1:AddChildren(adminForce,adminRetract) John@60: John@60: suicideSelected = AceGUI:Create("Button") John@60: suicideSelected:SetFullWidth(true) John@60: suicideSelected:SetText("Suicide") John@60: John@60: undo = AceGUI:Create("Button") John@60: undo:SetText("Undo") John@60: undo:SetFullWidth(true) John@60: end John@60: John@60: John@56: local filter = AceGUI:Create("CheckBox") John@56: filter:SetLabel("Only show active") John@56: filter:SetFullWidth(true) John@56: John@56: left:AddChildren(filter) John@56: if admin then left:AddChildren(suicideSelected,undo) end John@56: biddingZone:AddChildren(spacer,label,biddingOn,bidRetractButton,rollButton,spacer2,bidTitle,b1) John@56: if admin then biddingZone:AddChildren(g1) end John@56: right:AddChildren(t2) John@56: if admin then right:AddChildren(alb1,alb2,alb3) end John@56: right:AddChildren(biddingZone) John@56: f:AddChildren(left,right) John@58: John@58: John@1: end