From fadaba56f1191775a9401d04c203977dcb4daf4d Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Thu, 17 Sep 2015 20:51:46 +0200 Subject: [PATCH] aux now remembers the auction duration setting. bugfix where possible with active bids the buy window would display them --- Aux-Addon.toc | 2 +- buy.lua | 11 +++++++++++ core.lua | 22 ++++++++++++++-------- options.lua | 18 ++++++++++++------ sell.lua | 40 +++++++++++++++++++++++++++++++++++++++- 5 files changed, 77 insertions(+), 16 deletions(-) diff --git a/Aux-Addon.toc b/Aux-Addon.toc index 443d4d2..99e225e 100644 --- a/Aux-Addon.toc +++ b/Aux-Addon.toc @@ -1,7 +1,7 @@ ## Interface: 11200 ## Title: Aux ## Notes: A lightweight addon designed to help manage auctions -## SavedVariablesPerCharacter: AUCTIONATOR_ENABLE_ALT, AUCTIONATOR_OPEN_FIRST, AUCTIONATOR_INSTANT_BUYOUT +## SavedVariablesPerCharacter: AUX_ENABLE_ALT, AUX_OPEN_FIRST, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION ## SavedVariables: auxSellEntries core.xml scan.xml diff --git a/buy.lua b/buy.lua index 060ee6c..a7814db 100644 --- a/buy.lua +++ b/buy.lua @@ -3,6 +3,17 @@ local entries local selectedEntries = {} local searchQuery +----------------------------------------- + +function Aux_AuctionFrameBids_Update() + Aux.orig.AuctionFrameBids_Update() + if PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.buy.index and AuctionFrame:IsShown() then + Aux_HideElems(Aux.tabs.buy.hiddenElements) + end +end + +----------------------------------------- + function AuxBuySearchButton_OnClick() entries = nil selectedEntries = {} diff --git a/core.lua b/core.lua index ab94f7c..b63acba 100644 --- a/core.lua +++ b/core.lua @@ -1,9 +1,5 @@ AuxVersion = "1.1.1" -AuxAuthors = "shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport);" - -AUCTIONATOR_ENABLE_ALT = true -AUCTIONATOR_OPEN_FIRST = false -AUCTIONATOR_INSTANT_BUYOUT = false +AuxAuthors = "shirsig; Zerf; Zirco (AUX); Nimeral (AUX backport)" Aux = { loaded = false, @@ -104,6 +100,12 @@ end function Aux_SetupHookFunctions() + Aux.orig.AuctionFrameAuctions_OnShow = AuctionFrameAuctions_OnShow + AuctionFrameAuctions_OnShow = Aux_Sell_AuctionFrameAuctions_OnShow + + Aux.orig.AuctionsRadioButton_OnClick = AuctionsRadioButton_OnClick + AuctionsRadioButton_OnClick = Aux_Sell_AuctionsRadioButton_OnClick + Aux.orig.BrowseButton_OnClick = BrowseButton_OnClick BrowseButton_OnClick = Aux_BrowseButton_OnClick @@ -133,6 +135,9 @@ function Aux_SetupHookFunctions() Aux.orig.ContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick ContainerFrameItemButton_OnClick = Aux_ContainerFrameItemButton_OnClick + Aux.orig.AuctionFrameBids_Update = AuctionFrameBids_Update + AuctionFrameBids_Update = Aux_AuctionFrameBids_Update + Aux.orig.AuctionFrameAuctions_Update = AuctionFrameAuctions_Update AuctionFrameAuctions_Update = Aux_AuctionFrameAuctions_Update @@ -146,7 +151,7 @@ function Aux_OnAuctionHouseShow() AuxOptionsButtonPanel:Show() - if AUCTIONATOR_OPEN_FIRST then + if AUX_OPEN_FIRST then AuctionFrameTab_OnClick(Aux.tabs.sell.index) end @@ -192,6 +197,7 @@ function Aux_AuctionFrameTab_OnClick(index) if index == Aux.tabs.sell.index then AuctionFrameTab_OnClick(3) + Aux_Sell_OnOpen() PanelTemplates_SetTab(AuctionFrame, Aux.tabs.sell.index) @@ -361,7 +367,7 @@ end ----------------------------------------- function Aux_BrowseButton_OnMouseDown() - if arg1 == "RightButton" and AUCTIONATOR_INSTANT_BUYOUT then + if arg1 == "RightButton" and AUX_INSTANT_BUYOUT then local index = this:GetID() + FauxScrollFrame_GetOffset(BrowseScrollFrame) SetSelectedAuctionItem("list", index) @@ -397,7 +403,7 @@ function Aux_ContainerFrameItemButton_OnClick(button) else Aux.orig.ContainerFrameItemButton_OnClick(button) - if AUCTIONATOR_ENABLE_ALT and AuctionFrame:IsShown() and IsAltKeyDown() and button == "LeftButton" then + if AUX_ENABLE_ALT and AuctionFrame:IsShown() and IsAltKeyDown() and button == "LeftButton" then ClickAuctionSellItemButton() ClearCursor() diff --git a/options.lua b/options.lua index 98c17cd..a8f9788 100644 --- a/options.lua +++ b/options.lua @@ -1,3 +1,9 @@ +AUX_ENABLE_ALT = true +AUX_OPEN_FIRST = false +AUX_INSTANT_BUYOUT = false + +AUX_AUCTION_DURATION = 'long' + local BoolToString, BoolToNum, NumToBool function Aux_ShowDescriptionFrame() @@ -33,18 +39,18 @@ function Aux_ShowOptionsFrame() AuxVersionText:SetText("Version: "..AuxVersion) - AuxOption_Enable_Alt:SetChecked(AUCTIONATOR_ENABLE_ALT) - AuxOption_Open_First:SetChecked(AUCTIONATOR_OPEN_FIRST) - AuxOption_Instant_Buyout:SetChecked(AUCTIONATOR_INSTANT_BUYOUT) + AuxOption_Enable_Alt:SetChecked(AUX_ENABLE_ALT) + AuxOption_Open_First:SetChecked(AUX_OPEN_FIRST) + AuxOption_Instant_Buyout:SetChecked(AUX_INSTANT_BUYOUT) end ----------------------------------------- function AuxOptionsSave() - AUCTIONATOR_ENABLE_ALT = AuxOption_Enable_Alt:GetChecked() - AUCTIONATOR_OPEN_FIRST = AuxOption_Open_First:GetChecked() - AUCTIONATOR_INSTANT_BUYOUT = AuxOption_Instant_Buyout:GetChecked() + AUX_ENABLE_ALT = AuxOption_Enable_Alt:GetChecked() + AUX_OPEN_FIRST = AuxOption_Open_First:GetChecked() + AUX_INSTANT_BUYOUT = AuxOption_Instant_Buyout:GetChecked() end diff --git a/sell.lua b/sell.lua index 8e45cf9..9c95f36 100644 --- a/sell.lua +++ b/sell.lua @@ -13,11 +13,49 @@ local processScanResults, undercut, ItemType2AuctionClass, SubType2AuctionSubcla ----------------------------------------- +function Aux_Sell_OnOpen() +end + +----------------------------------------- + +function Aux_Sell_AuctionFrameAuctions_OnShow() + Aux.orig.AuctionFrameAuctions_OnShow() + Aux_Sell_SetAuctionDuration(AUX_AUCTION_DURATION) +end + +----------------------------------------- + +function Aux_Sell_SetAuctionDuration(duration) + if duration == 'short' then + Aux_Sell_AuctionsRadioButton_OnClick(1) + elseif duration == 'medium' then + Aux_Sell_AuctionsRadioButton_OnClick(2) + elseif duration == 'long' then + Aux_Sell_AuctionsRadioButton_OnClick(3) + end +end + +----------------------------------------- + +function Aux_Sell_AuctionsRadioButton_OnClick(index) + if index == 1 then + AUX_AUCTION_DURATION = 'short' + elseif index == 2 then + AUX_AUCTION_DURATION = 'medium' + elseif index == 3 then + AUX_AUCTION_DURATION = 'long' + end + + return Aux.orig.AuctionsRadioButton_OnClick(index) +end + +----------------------------------------- + function Aux_AuctionFrameAuctions_Update() Aux.orig.AuctionFrameAuctions_Update() if PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.sell.index and AuctionFrame:IsShown() then Aux_HideElems(Aux.tabs.sell.hiddenElements) - end + end end -----------------------------------------