Permalink
Browse files

disallow subsequent clicks until the next BAG_UPDATE

  • Loading branch information...
1 parent 5fea4e0 commit c01cf5d95d5b027523c6e88f663fa129ac58d220 @durcyn committed Oct 12, 2012
Showing with 10 additions and 0 deletions.
  1. +10 −0 shop.lua
View
@@ -26,6 +26,8 @@ local items = {
[75014] = {bag = 87687, count = 20}, -- Raw Crocolisk Belly
}
+local throttle = false
+
local f = CreateFrame("Frame")
f:SetScript("OnEvent", function(frame, event, ...) if f[event] then f[event](frame, event, ...) end end)
f:RegisterEvent("MERCHANT_SHOW")
@@ -43,6 +45,7 @@ end)
btn:SetScript("OnLeave", function() GameTooltip:Hide() end)
btn:SetScript("OnClick", function()
+ if throttle then return end
local groceries = {}
local havebags = {}
for bag = 0,4 do
@@ -80,6 +83,8 @@ btn:SetScript("OnClick", function()
end
end
end
+ throttle = true
+ f:RegisterEvent("BAG_UPDATE")
end)
function f:MERCHANT_SHOW()
@@ -90,3 +95,8 @@ end
function f:MERCHANT_CLOSED()
btn:Hide()
end
+
+function f:BAG_UPDATE()
+ f:UnregisterEvent("BAG_UPDATE")
+ throttle = false
+end

0 comments on commit c01cf5d

Please sign in to comment.