Advertisement
Guest User

version 3 of OG-CODE

a guest
Dec 15th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. function private.purchaseall()
  2. StaticPopupDialogs["WRECKIT"] = {
  3. OnShow = function (self, data)
  4. self.editBox:SetText("Input value here")
  5. end,
  6. OnAccept = function (self, data, data2)
  7. local bidValue = self.editBox:GetText()
  8. --OG code right here
  9.  
  10. local enableres = lib.GetSetting("reserve.enable")
  11. local reserve = lib.GetSetting("reserve") or 1
  12. local money = GetMoney()
  13. for _, sortedRow in ipairs(gui.sheet.sort) do
  14. local bidqueue = gui.frame.cancel.value or 0
  15. local balance = money - bidqueue --account for money we've already "spent"
  16.  
  17. local data = gui.sheet:GetRowData(sortedRow)
  18. local link = data[1]
  19. local seller = data[8]
  20. local stack = data[4]
  21. local bid = data[6]
  22. local minbid = data[12]
  23. local curbid = data[13]
  24. local buyout = data[5]
  25. local reason = data[7]
  26. local price = 0
  27.  
  28. if strmatch(reason, ":buy") then
  29. price = buyout
  30. elseif strmatch(reason, ":bid") then
  31. price = 10*stack
  32. -- 10 is copper value mulitplied by stack size
  33. elseif buyout > 0 then
  34. price = buyout
  35. else
  36. price = 10*stack
  37. -- 10 is copper value mulitplied by stack size
  38. end
  39.  
  40. if ((balance-price) > reserve or not enableres) then
  41. AucAdvanced.Buy.QueueBuy(link, seller, stack, minbid, buyout, price, private.cropreason(reason))
  42.  
  43. else
  44. aucPrint("Purchase cancelled: Reserve reached")
  45. end
  46. end
  47.  
  48.  
  49.  
  50. end,
  51. hasEditBox = true
  52. timeout = 0,
  53. whileDead = true,
  54. hideOnEscape = true,
  55. preferredIndex = 3, -- avoid some UI taint, see http://www.wowace.com/announcements/how-to-avoid-some-ui-taint/
  56. }
  57. StaticPopup_Show ("WRECKIT")
  58. [private.removeall]()
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement