diff --git a/Buy.lua b/Buy.lua index 3284c9c..c8b8337 100644 --- a/Buy.lua +++ b/Buy.lua @@ -1,4 +1,4 @@ -local processScanResults +local processScanResults, createOrder, updateOrder local entries local selectedEntries = {} local searchQuery @@ -22,7 +22,7 @@ end ----------------------------------------- -function condensedSelection() +function createOrder() local selection = {} for entry,_ in pairs(selectedEntries) do local key = entry.name.."_"..entry.stackSize.."_"..entry.buyoutPrice @@ -39,13 +39,14 @@ end ----------------------------------------- function AuctionatorBuyBuySelectedButton_OnClick() - + AuctionatorBuySearchButton:Disable() AuctionatorBuyBuySelectedButton:Disable() - local selection = condensedSelection(selectedEntries) - local selectedCount = Auctionator_SetSize(selectedEntries) + local order = createOrder(selectedEntries) + local orderedCount = Auctionator_SetSize(selectedEntries) local purchasedCount = 0 + entries = nil selectedEntries = {} @@ -55,15 +56,19 @@ function AuctionatorBuyBuySelectedButton_OnClick() query = searchQuery, onReadDatum = function(datum) local key = datum.name.."_"..datum.stackSize.."_"..datum.buyoutPrice - if selection[key] then + if order[key] then - PlaceAuctionBid("list", datum.pageIndex, datum.buyoutPrice) - purchasedCount = purchasedCount + 1 - Auctionator_Log(string.format("[Auctionator] Auction purchased", purchasedCount, selectedCount)) - if selection[key] > 1 then - selection[key] = selection[key] - 1 + if GetMoney() >= datum.buyoutPrice then + PlaceAuctionBid("list", datum.pageIndex, datum.buyoutPrice) + purchasedCount = purchasedCount + 1 else - selection[key] = nil + + end + + if order[key] > 1 then + order[key] = order[key] - 1 + else + order[key] = nil end return false @@ -72,14 +77,14 @@ function AuctionatorBuyBuySelectedButton_OnClick() end end, onComplete = function(data) - Auctionator_Log(string.format("[Auctionator] Final report: %i out of %i auctions purchased", purchasedCount, selectedCount)) processScanResults(data) Auctionator_Buy_ScrollbarUpdate() AuctionatorBuySearchButton:Enable() + Auctionator_Buy_ShowReport(false, orderedCount, purchasedCount) end, onAbort = function() - Auctionator_Log(string.format("[Auctionator] Final report: %i out of %i auctions purchased", purchasedCount, selectedCount)) AuctionatorBuySearchButton:Enable() + Auctionator_Buy_ShowReport(false, orderedCount, purchasedCount) end } end @@ -132,14 +137,17 @@ function Auctionator_Buy_ScrollbarUpdate() AuctionatorBuyMessage:Hide() end - if Auctionator_SetSize(selectedEntries) > 0 then + local total = 0 + for entry, _ in selectedEntries do + total = total + entry.buyoutPrice + end + MoneyFrame_Update("AuctionatorBuyTotal", Auctionator_Round(total)) + + if Auctionator_SetSize(selectedEntries) > 0 and GetMoney() >= total then AuctionatorBuyBuySelectedButton:Enable() else AuctionatorBuyBuySelectedButton:Disable() end - - local line -- 1 through 15 of our window to scroll - local dataOffset -- an index into our data calculated from the scroll offset local numrows if not entries then @@ -149,10 +157,10 @@ function Auctionator_Buy_ScrollbarUpdate() end FauxScrollFrame_Update(AuctionatorBuyScrollFrame, numrows, 19, 16); - + for line = 1,19 do - dataOffset = line + FauxScrollFrame_GetOffset(AuctionatorBuyScrollFrame) + local dataOffset = line + FauxScrollFrame_GetOffset(AuctionatorBuyScrollFrame) local lineEntry = getglobal("AuctionatorBuyEntry"..line) if numrows <= 19 then @@ -188,4 +196,20 @@ function Auctionator_Buy_ScrollbarUpdate() lineEntry:Hide() end end + + function Auctionator_Buy_ShowReport(completed, orderedCount, purchasedCount) + AuctionatorBuyReport:Show() + + AuctionatorBuyReportHTML:SetText("
" + .."" + ..string.format("%i out of the %i ordered auctions have been purchased", purchasedCount, orderedCount) + .."
" + .."") + + AuctionatorBuyReportHTML:SetSpacing(3) + + AuctionatorBuyAuthorText:SetText("Author: "..AuctionatorAuthor) + end end \ No newline at end of file diff --git a/Buy.xml b/Buy.xml index 807a6b7..1bd8ccb 100644 --- a/Buy.xml +++ b/Buy.xml @@ -72,16 +72,12 @@ - +" + .."Figuring out a good buyout price when posting auctions can be tedious and time-consuming. If you're like most people, you first browse the current " + .."auctions to get a sense of how much your item is currently selling for. Then you undercut the lowest price by a bit. If you're creating multiple auctions " + .."you're bouncing back and forth between the Browse tab and the Auctions tab, doing lots of division in " + .."your head, and doing lots of clicking and typing." + .."
" + .."Auctionator makes this whole process easy and streamlined. When you select an item to auction, Auctionator displays a summary of all the current auctions for " + .."that item sorted by per-item price. Auctionator also calculates a recommended buyout price based on the cheapest per-item price for your item. If you're " + .."selling a stack rather than a single item, Auctionator bases its recommended buyout price on the cheapest stack of the same size." + .."
" + .."If you don't like Auctionator's recommendation, you can click on any line in the summary and Auctionator will recalculate the recommended buyout price based " + .."on that auction. Of course, you can always override Auctionator's recommendation by just typing in your own buyout price." + .."
" + .."With Auctionator, creating an auction is usually just a matter of picking an item to auction and clicking the Create Auction button." + .."
" + .."") + + AuctionatorDescriptionHTML:SetSpacing(3) + AuctionatorAuthorText:SetText("Author: "..AuctionatorAuthor) end @@ -16,29 +35,9 @@ function Auctionator_ShowOptionsFrame() AuctionatorOptionsFrame:SetBackdropColor(0,0,0,100) AuctionatorConfigFrameTitle:SetText("Auctionator Options for "..UnitName("player")) - - local expText = "" - .."" - .."Figuring out a good buyout price when posting auctions can be tedious and time-consuming. If you're like most people, you first browse the current " - .."auctions to get a sense of how much your item is currently selling for. Then you undercut the lowest price by a bit. If you're creating multiple auctions " - .."you're bouncing back and forth between the Browse tab and the Auctions tab, doing lots of division in " - .."your head, and doing lots of clicking and typing." - .."
" - .."Auctionator makes this whole process easy and streamlined. When you select an item to auction, Auctionator displays a summary of all the current auctions for " - .."that item sorted by per-item price. Auctionator also calculates a recommended buyout price based on the cheapest per-item price for your item. If you're " - .."selling a stack rather than a single item, Auctionator bases its recommended buyout price on the cheapest stack of the same size." - .."
" - .."If you don't like Auctionator's recommendation, you can click on any line in the summary and Auctionator will recalculate the recommended buyout price based " - .."on that auction. Of course, you can always override Auctionator's recommendation by just typing in your own buyout price." - .."
" - .."With Auctionator, creating an auction is usually just a matter of picking an item to auction and clicking the Create Auction button." - .."
" - .."" AuctionatorExplanation:SetText("Auctionator is an addon designed to make it easier and faster to setup your auctions at the auction house.") - AuctionatorDescriptionHTML:SetText(expText) - AuctionatorDescriptionHTML:SetSpacing(3) + AuctionatorVersionText:SetText("Version: "..AuctionatorVersion) diff --git a/Options.xml b/Options.xml index bc20feb..cc15bb3 100644 --- a/Options.xml +++ b/Options.xml @@ -4,7 +4,7 @@