diff Gui.lua @ 79:7b8fcea357d2

Rolls are active
author John@Yosemite-PC
date Thu, 12 Apr 2012 23:50:56 -0400
parents 5b507f4125d4
children 62805e6b46c5
line wrap: on
line diff
--- a/Gui.lua	Thu Apr 12 22:19:15 2012 -0400
+++ b/Gui.lua	Thu Apr 12 23:50:56 2012 -0400
@@ -262,7 +262,26 @@
     ["RollEvent"] = function(self) self:Redraw() end,
     ["Release"] = function(self) self.widget = nil end,
     ["Redraw"] = function(self)
-        self.widget:SetList(statebids)
+        local list = {}
+        for i,v in pairs(statebids) do
+            table.insert(list,v)
+        end
+        for i,v in pairs(staterolls) do
+            local roll
+            for r,s in pairs(staterollvalues) do
+                if s.value == v.value then
+                    roll = r
+                    break
+                end
+            end
+            print("Inserting a roll ", v.value, roll)
+
+            local c = copy(v)
+            c.disabled = false
+            c.text = c.text .. " (roll "..roll..")"
+            table.insert(list,c)
+        end
+        self.widget:SetList(list)
         RListEventDispatch:Event("Redraw")
     end,
     ["SetWidget"] = function(self,w)
@@ -279,12 +298,12 @@
         --end
         self:Redraw()
     end,
-    ["Force"] = function(self,who)
+    ["Force"] = function(self,who) -- todo: remove this and the horse it rode in on
         local new = self.Convert(who,72)
         InitiateBid(new)
         --self:Redraw()
     end,
-    ["Retract"] = function(self,who)
+    ["Retract"] = function(self,who) -- todo: remove this and the horse it rode in on
         -- todo
         --for i,v in pairs(self.data) do
         --    if who.value == v.value then
@@ -350,7 +369,11 @@
             local rollButton = AceGUI:Create("Button")
             rollButton:SetText("Offset Roll")
             rollButton:SetWidth(100)
-            -- todo: callback
+            rollButton:SetCallback("OnClick", function(widget) InitiateRollRequest(SListPopulator:GetMe()) end) -- todo: wrong behavior. GetMe will nil if the person isn't on the currently selected loot list. this could easily happen. return a new thingy instead
+            local retractButton = AceGUI:Create("Button")
+            retractButton:SetText("Retract")
+            retractButton:SetWidth(100)
+            retractButton:SetCallback("OnClick", function(widget) InitiateRetract(SListPopulator:GetMe()) end)
 
             RListEventDispatch:SetTarget(b1)
             RListPopulator:SetWidget(b1)
@@ -407,7 +430,7 @@
                 g1:AddChildren(adminForce,adminRetract)
             end
 
-            self.group:AddChildren(spacer,label,biddingOn,bidRetractButton,rollButton,spacer2,bidTitle,b1)
+            self.group:AddChildren(spacer,label,biddingOn,bidRetractButton,rollButton,retractButton,spacer2,bidTitle,b1)
             if admin then self.group:AddChildren(g1) end
 
         else