From 65ec99455487e873969186cfd46aa0a2e9b1866c Mon Sep 17 00:00:00 2001
From: Manuel Simon Hirsig
Date: Sun, 27 Sep 2015 13:11:47 +0200
Subject: [PATCH] options refactoring and added control-click search shortcut
---
Aux-Addon.toc | 2 +-
about.xml | 2 +-
core.lua | 44 ++++++++-----
options.lua | 92 ++++++++++++++++----------
options.xml | 176 ++++++++++++++++++++++++++++++++++++++------------
5 files changed, 224 insertions(+), 92 deletions(-)
diff --git a/Aux-Addon.toc b/Aux-Addon.toc
index 5b45862..5ed936e 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: AUX_ENABLE_ALT, AUX_OPEN_FIRST, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION
+## SavedVariablesPerCharacter: AUX_SELL_SHORTCUT, AUX_BUY_SHORTCUT, AUX_OPEN_SELL, AUX_OPEN_BUY, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION
## SavedVariables: auxSellEntries
core.xml
diff --git a/about.xml b/about.xml
index b884e1a..ba1f486 100644
--- a/about.xml
+++ b/about.xml
@@ -12,7 +12,7 @@
-
+
diff --git a/core.lua b/core.lua
index 49b3fb9..4dde0e1 100644
--- a/core.lua
+++ b/core.lua
@@ -181,8 +181,10 @@ function Aux_OnAuctionHouseShow()
AuxOptionsButtonPanel:Show()
- if AUX_OPEN_FIRST then
+ if AUX_OPEN_SELL then
AuctionFrameTab_OnClick(Aux.tabs.sell.index)
+ elseif AUX_OPEN_BUY then
+ AuctionFrameTab_OnClick(Aux.tabs.buy.index)
end
end
@@ -442,34 +444,42 @@ end
-----------------------------------------
function Aux_ContainerFrameItemButton_OnClick(button)
+ local bag, slot = this:GetParent():GetID(), this:GetID()
+ local container_item = Aux.info.container_item(bag, slot)
- if button == "LeftButton"
- and IsShiftKeyDown()
- and not ChatFrameEditBox:IsVisible()
- and AuctionFrame:IsVisible()
- and (PanelTemplates_GetSelectedTab(AuctionFrame) == 1 or PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.buy.index)
- then
- local container_item = Aux.info.container_item(this:GetParent():GetID(), this:GetID())
- if container_item then
+ if AuctionFrame:IsVisible() and button == "LeftButton" and container_item then
+
+ if IsShiftKeyDown()
+ and not ChatFrameEditBox:IsVisible()
+ and (PanelTemplates_GetSelectedTab(AuctionFrame) == 1 or PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.buy.index)
+ then
if PanelTemplates_GetSelectedTab(AuctionFrame) == 1 then
BrowseName:SetText(container_item.name)
elseif PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.buy.index then
AuxBuySearchBox:SetText(container_item.name)
end
- end
- else
- Aux.orig.ContainerFrameItemButton_OnClick(button)
-
- if AUX_ENABLE_ALT and AuctionFrame:IsShown() and IsAltKeyDown() and button == "LeftButton" then
-
- ClickAuctionSellItemButton()
+ return
+ elseif AUX_SELL_SHORTCUT and IsAltKeyDown()then
ClearCursor()
-
+ PickupContainerItem(bag, slot)
+ ClickAuctionSellItemButton()
+ ClearCursor()
if PanelTemplates_GetSelectedTab(AuctionFrame) ~= Aux.tabs.sell.index then
AuctionFrameTab_OnClick(Aux.tabs.sell.index)
+ end
+ return
+ elseif AUX_BUY_SHORTCUT and IsControlKeyDown() and not ChatFrameEditBox:IsVisible() then
+ local container_item = Aux.info.container_item(this:GetParent():GetID(), this:GetID())
+ if PanelTemplates_GetSelectedTab(AuctionFrame) ~= Aux.tabs.buy.index then
+ local container_item = Aux.info.container_item(this:GetParent():GetID(), this:GetID())
+ AuctionFrameTab_OnClick(Aux.tabs.buy.index)
end
+ AuxBuySearchBox:SetText(container_item.name)
+ AuxBuySearchButton_OnClick()
+ return
end
end
+ return Aux.orig.ContainerFrameItemButton_OnClick(button)
end
-----------------------------------------
diff --git a/options.lua b/options.lua
index a8f9788..fd206a8 100644
--- a/options.lua
+++ b/options.lua
@@ -1,12 +1,15 @@
-AUX_ENABLE_ALT = true
-AUX_OPEN_FIRST = false
+Aux.options = {}
+
+AUX_SELL_SHORTCUT = true
+AUX_BUY_SHORTCUT = true
+AUX_OPEN_SELL = false
+AUX_OPEN_BUY = false
AUX_INSTANT_BUYOUT = false
AUX_AUCTION_DURATION = 'long'
-local BoolToString, BoolToNum, NumToBool
+function Aux.options.show_description()
-function Aux_ShowDescriptionFrame()
AuxDescriptionFrame:Show()
AuxDescriptionHTML:SetText(""
@@ -18,59 +21,71 @@ function Aux_ShowDescriptionFrame()
.."
Aux Buy
"
.."The Aux Buy panel makes a multi-page search for you and lists all items with the most relevant information sorted by unit price. From that list you can select all the auctions you want to buy and after your confirmation Aux then makes another multi-page search, picking up all the selected auctions in the process. At the end you're presented with a report about what has been purchased."
.."
"
- .."")
-
+ .."