From 99d184bfaae7aefff6a01a18eec0f9965f79ec0b Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Wed, 9 Sep 2015 17:19:40 +0200 Subject: [PATCH] major visual upgrade of buy tab, cleaned up xml files a bit, better reporting functionality for the buy tab, handled more corner cases in buy tab --- Buy.lua | 64 +++++++++++++++++++---------- Buy.xml | 113 +++++++++++++++++++++++++++++++++++++++++++++------- Core.lua | 5 ++- Options.lua | 47 +++++++++++----------- Options.xml | 4 +- Scan.lua | 21 +++++----- Sell.lua | 48 +++++++++++++--------- Sell.xml | 27 ++++++++----- 8 files changed, 227 insertions(+), 102 deletions(-) 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("" + .."

Auctionator Buy Report


" + .."

Status:"..(completed and "Completed" or "Aborted").."


" + .."

" + ..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 @@ - + - + - - - - - + @@ -91,20 +87,29 @@ - + - - + + + + + + + + + + + - + @@ -135,7 +140,7 @@ - this:ClearFocus(); + this:ClearFocus() @@ -151,8 +156,14 @@ + + + + + + + + + + + SmallMoneyFrame_OnLoad() + MoneyFrame_SetType("STATIC") + + + + + + - + @@ -197,4 +234,50 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Core.lua b/Core.lua index 6b2ee45..eadfb31 100644 --- a/Core.lua +++ b/Core.lua @@ -1,3 +1,6 @@ +AuctionatorVersion = "1.2.0-Vanilla" +AuctionatorAuthor = "Zirco; Backport by Nimeral; Reworked by Simon Hirsig" + AuctionatorLoaded = false local val2gsc @@ -52,7 +55,7 @@ end ----------------------------------------- function Auctionator_OnLoad() - Auctionator_Log("[Auctionator] Loaded") + Auctionator_Log("Auctionator v"..AuctionatorVersion.." loaded") AuctionatorLoaded = true end diff --git a/Options.lua b/Options.lua index 8d1624f..4906f4d 100644 --- a/Options.lua +++ b/Options.lua @@ -1,10 +1,29 @@ -local AuctionatorVersion = "1.1.0-Vanilla" -local AuctionatorAuthor = "Zirco; Backport by Nimeral; Reworked by Simon Hirsig" - local BoolToString, BoolToNum, NumToBool function Auctionator_ShowDescriptionFrame() AuctionatorDescriptionFrame:Show() + + AuctionatorDescriptionHTML:SetText("" + .."

What is Auctionator?


" + .."

" + .."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." + .."


How it works


" + .."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 = "" - .."

What is Auctionator?


" - .."

" - .."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." - .."


How it works


" - .."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 @@ - + @@ -16,7 +16,7 @@ - + - + @@ -108,11 +108,11 @@
- + - + @@ -133,7 +133,7 @@ - + @@ -160,10 +160,9 @@