diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 8c3831b..404e37c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -1,9 +1,21 @@ - + + + + + + + + + + + + + @@ -66,11 +78,11 @@ - - + + - - + + @@ -79,78 +91,38 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + @@ -159,8 +131,48 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -179,17 +191,19 @@ @@ -226,7 +240,6 @@ - @@ -247,6 +260,7 @@ + @@ -256,12 +270,6 @@ - - - - - - @@ -270,6 +278,27 @@ + + + + + + + + localhost @@ -359,14 +420,11 @@ - - - - - 1445044678361 - 1445044678361 + + 1445635607102 + 1445635607102 @@ -382,21 +440,21 @@ - + - + - + - - + + @@ -419,194 +477,209 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/buy.lua b/buy.lua index 6403831..232d83b 100644 --- a/buy.lua +++ b/buy.lua @@ -2,7 +2,6 @@ Aux.buy = {} local create_auction_record, show_dialog, find_auction, hide_sheet, update_sheet, auction_alpha_setter, group_alpha_setter local auctions -local selectedAuctions = {} local search_query local tooltip_patterns = {} local current_page @@ -426,23 +425,21 @@ Aux.buy.modes = { }, } -function Aux.buy.exit() - Aux.buy.dialog_cancel() +function Aux.buy.on_close() + if AuxBuyConfirmation:IsVisible() then + Aux.buy.dialog_cancel() + end current_page = nil end function Aux.buy.on_open() + AuxBuySearchButton:Show() + AuxBuyStopButton:Hide() update_sheet() end -function Aux_AuctionFrameBid_Update() - Aux.orig.AuctionFrameBid_Update() - if PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.buy.index and AuctionFrame:IsShown() then - Aux_HideElems(Aux.tabs.buy.hiddenElements) - end -end - function Aux.buy.dialog_cancel() + Aux.log('Canceled.') Aux.scan.abort() AuxBuyConfirmation:Hide() update_sheet() @@ -495,7 +492,6 @@ function Aux.buy.SearchButton_onclick() AuxBuyStopButton:Show() auctions = nil - selectedAuctions = {} refresh = true @@ -513,18 +509,16 @@ function Aux.buy.SearchButton_onclick() usable = AuxBuyUsableCheckButton:GetChecked() } - Aux.log('Starting scan') + Aux.log('Scanning auctions ...') Aux.scan.start{ query = search_query, page = AuxBuyAllPagesCheckButton:GetChecked() and 0 or AuxBuyPageEditBox:GetNumber(), on_submit_query = function() current_page = nil end, - on_page_loaded = function(page) - current_page = page - end, - on_start_page = function(page, total_pages) - Aux.log('Scanning page ' .. page + 1 .. (total_pages > 0 and ' out of ' .. total_pages or '')) + on_page_loaded = function(page, total_pages) + Aux.log('Scanning page '..(page+1)..' out of '..total_pages..' ...') + current_page = page end, on_read_auction = function(i) local auction_item = Aux.info.auction_item(i) @@ -537,14 +531,15 @@ function Aux.buy.SearchButton_onclick() end, on_complete = function() auctions = auctions or {} - Aux.log('Scan completed: '..getn(auctions)..' auctions found') - AuxBuyStopButton:Hide() + Aux.log('Scan complete: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.') + + AuxBuyStopButton:Hide() AuxBuySearchButton:Show() refresh = true end, on_abort = function() auctions = auctions or {} - Aux.log('Scan aborted: '..getn(auctions)..' auctions found') + Aux.log('Scan aborted: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.') AuxBuyStopButton:Hide() AuxBuySearchButton:Show() refresh = true @@ -565,8 +560,8 @@ function show_dialog(buyout_mode, entry, amount) AuxBuyConfirmation.EnhTooltip_info = entry.EnhTooltip_info AuxBuyConfirmationActionButton:Disable() - AuxBuyConfirmationItem:SetNormalTexture(entry.texture) - AuxBuyConfirmationItemName:SetText(entry.name) + AuxBuyConfirmationItemIconTexture:SetTexture(entry.texture) + AuxBuyConfirmationItemName:SetText(entry.tooltip[1][1].text) local color = ITEM_QUALITY_COLORS[entry.quality] AuxBuyConfirmationItemName:SetTextColor(color.r, color.g, color.b) @@ -587,7 +582,6 @@ function show_dialog(buyout_mode, entry, amount) AuxBuyConfirmationBuyoutPrice:Hide() AuxBuyConfirmationBid:Show() end - hide_sheet() AuxBuyConfirmation:Show() end @@ -603,16 +597,16 @@ function find_auction(entry, buyout_mode, express_mode) return end - Aux.log('Processing '..(buyout_mode and 'buyout' or 'bid')..' request') + local amount + if buyout_mode then + amount = entry.buyout_price + else + amount = entry.bid + end + + Aux.log('Processing '..(buyout_mode and 'buyout' or 'bid')..' request for '..entry.hyperlink..' x '..entry.stack_size..' at '..Aux.util.money_string(amount)..' ...') AuxBuySearchButton:Disable() - local amount - if buyout_mode then - amount = entry.buyout_price - else - amount = entry.bid - end - if not express_mode then show_dialog(buyout_mode, entry, amount) end @@ -645,23 +639,23 @@ function find_auction(entry, buyout_mode, express_mode) if entry.signature == signature then ctrl.suspend() found = true - Aux.log('Matching auction found') + Aux.log('Matching auction found.'..(express_mode and '' or ' Awaiting confirmation ...')) if express_mode then if GetMoney() >= amount then PlaceAuctionBid("list", i, amount) - Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..entry.hyperlink..' x '..entry.stack_size) + Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..entry.hyperlink..' x '..entry.stack_size..' at '..Aux.util.money_string(amount)..'.') entry.gone = true refresh = true else - Aux.log('Not enough money.') + Aux.log((buyout_mode and 'Purchase' or 'Bid')..' failed: Not enough money.') end Aux.scan.abort() else Aux.buy.dialog_action = function() if GetMoney() >= amount then PlaceAuctionBid("list", i, amount) - Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..entry.hyperlink..' x '..entry.stack_size) + Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..entry.hyperlink..' x '..entry.stack_size..' at '..Aux.util.money_string(amount)..'.') entry.gone = true refresh = true else @@ -678,6 +672,7 @@ function find_auction(entry, buyout_mode, express_mode) end, on_complete = function() if not found then + Aux.log('No matching auction found. Removing entry from the cache.') entry.gone = true refresh = true Aux.buy.dialog_cancel() @@ -723,7 +718,7 @@ function create_auction_record(auction_item, current_page) elseif auction_item.high_bidder then status = GREEN_FONT_COLOR_CODE..'Your Bid'..FONT_COLOR_CODE_CLOSE else - status = RED_FONT_COLOR_CODE .. 'Other Bidder'..FONT_COLOR_CODE_CLOSE + status = RED_FONT_COLOR_CODE..'Other Bidder'..FONT_COLOR_CODE_CLOSE end return { @@ -831,7 +826,7 @@ function AuxBuyQualityDropDown_Initialize() end UIDropDownMenu_AddButton{ - text = ALL, + text = 'All', value = -1, func = on_click, } diff --git a/buy.xml b/buy.xml index 1cf44b4..aef604e 100644 --- a/buy.xml +++ b/buy.xml @@ -39,66 +39,22 @@ - - - - - - - - - - - - - - - - - - - - - - + + - - - + + + - local sort_order = Aux.util.map(Aux.buy.modes[1].sort_order, function(column_order) return { column = Aux.buy.modes[1].columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end) - this.sheet = Aux.sheet.create(this, Aux.buy.modes[1].columns, sort_order, Aux.buy.modes[1].on_cell_click, Aux.buy.modes[1].on_cell_enter, Aux.buy.modes[1].on_cell_leave) + this:SetBackdropBorderColor(0.4, 0.4, 0.4) + this:SetBackdropColor(0.15, 0.15, 0.15) + getglobal(this:GetName().."Title"):SetText('Filters') - - - - - - - local sort_order = Aux.util.map(Aux.buy.modes[2].sort_order, function(column_order) return { column = Aux.buy.modes[2].columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end) - this.sheet = Aux.sheet.create(this, Aux.buy.modes[2].columns, sort_order, Aux.buy.modes[2].on_cell_click, Aux.buy.modes[2].on_cell_enter, Aux.buy.modes[2].on_cell_leave) - - - - - - - - - local sort_order = Aux.util.map(Aux.buy.modes[3].sort_order, function(column_order) return { column = Aux.buy.modes[3].columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end) - this.sheet = Aux.sheet.create(this, Aux.buy.modes[3].columns, sort_order, Aux.buy.modes[3].on_cell_click, Aux.buy.modes[3].on_cell_enter, Aux.buy.modes[3].on_cell_leave) - - - - - - - - + - + UIDropDownMenu_SetWidth(140) @@ -110,225 +66,224 @@ - - - + + + + + + + + + - - - - - - - - - - - - - this.completor = Aux.completion.completor(this) - - - this.completor.suggest() - - - if IsShiftKeyDown() then - this.completor.previous() - else - this.completor.next() - end - - - this.completor.close() - this:ClearFocus() - Aux.buy.SearchButton_onclick() - - - if this.completor.open() then - this.completor.close() - else - this:ClearFocus() - end - - - - - - - - - - - - - - - - - - - - - - - - - - - - UIDropDownMenu_SetWidth(140) - UIDropDownMenu_Initialize(this, AuxBuyCategoryDropDown_Initialize) - - - UIDropDownMenu_Initialize(this, AuxBuyCategoryDropDown_Initialize) - - - + + + + + getglobal(this:GetName()..'Label'):SetText('Name') + this.completor = Aux.completion.completor(this) + + + this.completor.suggest() + + + if IsShiftKeyDown() then + this.completor.previous() + else + this.completor.next() + end + + + this.completor.close() + this:ClearFocus() + Aux.buy.SearchButton_onclick() + + + if this.completor.open() then + this.completor.close() + else + this:ClearFocus() + end + + + - - - - - UIDropDownMenu_SetWidth(140) - UIDropDownMenu_Initialize(this, AuxBuyQualityDropDown_Initialize) - - - UIDropDownMenu_Initialize(this, AuxBuyQualityDropDown_Initialize) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - this:ClearFocus() - - - - - - - - - - - this:ClearFocus() - - - - - - - - - - - - - - - - - - - - - - - - - - - - AuxBuyTooltipButton_OnClick(this) - - - - - - - - UIDropDownMenu_Initialize(this, AuxBuyTooltipDropDown_Initialize) - - - - - - - - - - - + + + - - + + + + + + + + + + + + + + + + + + + + UIDropDownMenu_SetWidth(140) + UIDropDownMenu_Initialize(this, AuxBuyCategoryDropDown_Initialize) + + + UIDropDownMenu_Initialize(this, AuxBuyCategoryDropDown_Initialize) + + + + + + + + + UIDropDownMenu_SetWidth(140) + UIDropDownMenu_Initialize(this, AuxBuyQualityDropDown_Initialize) + + + UIDropDownMenu_Initialize(this, AuxBuyQualityDropDown_Initialize) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + getglobal(this:GetName()..'Label'):SetText('Level Range') + this:SetWidth(30) + + + this:ClearFocus() + + + + + + + + + + this:SetWidth(30) + + + this:ClearFocus() + + + + + + + + + + + + + + + + + + + + getglobal(this:GetName()..'Label'):SetText('Tooltip') + this:SetWidth(110) + + + AuxBuyTooltipButton_OnClick(this) + + + + + + + + UIDropDownMenu_Initialize(this, AuxBuyTooltipDropDown_Initialize) + + + + + + + + + + + getglobal(this:GetName()..'Label'):SetText('Page') + this:SetWidth(30) this:EnableMouse(false) this:SetAlpha(0.5) @@ -339,10 +294,10 @@ - + - + @@ -355,151 +310,191 @@ + + + + + + + + + this:SetBackdropBorderColor(0.4, 0.4, 0.4) + this:SetBackdropColor(0.15, 0.15, 0.15) + getglobal(this:GetName().."Title"):SetText('Search Results') + + + + + + + + + + + local sort_order = Aux.util.map(Aux.buy.modes[1].sort_order, function(column_order) return { column = Aux.buy.modes[1].columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end) + this.sheet = Aux.sheet.create(this, Aux.buy.modes[1].columns, sort_order, Aux.buy.modes[1].row_setter, Aux.buy.modes[1].on_cell_click, Aux.buy.modes[1].on_cell_enter, Aux.buy.modes[1].on_cell_leave) + + + + + + + + + + + local sort_order = Aux.util.map(Aux.buy.modes[2].sort_order, function(column_order) return { column = Aux.buy.modes[2].columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end) + this.sheet = Aux.sheet.create(this, Aux.buy.modes[2].columns, sort_order, Aux.buy.modes[2].row_setter, Aux.buy.modes[2].on_cell_click, Aux.buy.modes[2].on_cell_enter, Aux.buy.modes[2].on_cell_leave) + + + + + + + + + + + local sort_order = Aux.util.map(Aux.buy.modes[3].sort_order, function(column_order) return { column = Aux.buy.modes[3].columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end) + this.sheet = Aux.sheet.create(this, Aux.buy.modes[3].columns, sort_order, Aux.buy.modes[3].row_setter, Aux.buy.modes[3].on_cell_click, Aux.buy.modes[3].on_cell_enter, Aux.buy.modes[3].on_cell_leave) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Aux.info.set_game_tooltip(this, this:GetParent().tooltip, 'ANCHOR_LEFT', this:GetParent().EnhTooltip_info) + + + GameTooltip:Hide() + + + + + + + + + + + + + + + + + + + SmallMoneyFrame_OnLoad() + MoneyFrame_SetType("STATIC") + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - MoneyFrame_OnLoad() - MoneyFrame_SetType("STATIC") - - - - - - - - - - - - - - + + + + diff --git a/core.lua b/core.lua index 8724c62..36767b2 100644 --- a/core.lua +++ b/core.lua @@ -1,4 +1,4 @@ -AuxVersion = "1.6.0" +AuxVersion = "2.0.0" AuxAuthors = "shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)" local lastRightClickAction = GetTime() @@ -8,29 +8,21 @@ Aux = { orig = {}, elements = {}, tabs = { - sell = { - index = 4 - }, - buy = { + browse = { index = 1 - } + }, + post = { + index = 2 + }, }, last_picked_up = {}, } ------------------------------------------ - -local relevel - ------------------------------------------ - function Aux_OnLoad() - Aux.log("Aux v"..AuxVersion.." loaded") + Aux.log('Aux v'..AuxVersion..' loaded.') Aux.loaded = true end ------------------------------------------ - function Aux_OnEvent() if event == "VARIABLES_LOADED" then Aux_OnLoad() @@ -43,62 +35,17 @@ function Aux_OnEvent() end end ------------------------------------------ - function Aux_OnAddonLoaded() - if string.lower(arg1) == "blizzard_auctionui" then - Aux_AddTabs() - Aux_AddPanels() - - Aux_SetupHookFunctions() - - Aux.tabs.sell.hiddenElements = { - AuctionsPriceText, - StartPrice, - AuctionsBuyoutText, - BuyoutPrice, - AuctionsDurationText, - AuctionsShortAuctionButton, - AuctionsMediumAuctionButton, - AuctionsLongAuctionButton, - AuctionsCreateAuctionButton, - AuctionsItemButton, - AuctionsTitle, - AuctionsScrollFrame, - AuctionsButton1, - AuctionsButton2, - AuctionsButton3, - AuctionsButton4, - AuctionsButton5, - AuctionsButton6, - AuctionsButton7, - AuctionsButton8, - AuctionsButton9, - AuctionsQualitySort, - AuctionsDurationSort, - AuctionsHighBidderSort, - AuctionsBidSort, - AuctionsCancelAuctionButton - } - - Aux.tabs.buy.hiddenElements = { - AuctionFrameBrowse, - } + AuxButton:SetParent("AuctionFrame") + AuxButton:SetPoint("TOPRIGHT", "AuctionFrame", "TOPRIGHT", -26, -12) - Aux.tabs.sell.recommendationElements = { - AuxRecommendText, - AuxRecommendPerItemText, - AuxRecommendPerItemPrice, - AuxRecommendPerStackText, - AuxRecommendPerStackPrice, - AuxRecommendBasisText, - AuxRecommendItemTex, - } + Aux_SetupHookFunctions() end end function Aux.log_frame_load() + this:SetFading(false) this:EnableMouseWheel() -- this.flashTimer = 0 TODO remove end @@ -108,7 +55,7 @@ function Aux.log_frame_update(elapsedSec) return end - local flash = getglobal(this:GetName().."BottomButtonFlash") + local flash = getglobal(this:GetName()..'BottomButtonFlash') if not flash then return @@ -140,21 +87,15 @@ function Aux.log_frame_update(elapsedSec) end function Aux.log(msg) - local info = ChatTypeInfo["SYSTEM"] - AuxLogFrame:AddMessage(msg, 1, 1, 0) - if not AuxLogFrame:IsVisible() and DEFAULT_CHAT_FRAME then + local info = ChatTypeInfo['SYSTEM'] + AuxLogFrameMessageFrame:AddMessage(msg, 1, 1, 0) + if not AuxLogFrameMessageFrame:IsVisible() and DEFAULT_CHAT_FRAME then DEFAULT_CHAT_FRAME:AddMessage(msg, 1, 1, 0) end end function Aux_SetupHookFunctions() - Aux.orig.AuctionFrameAuctions_OnShow = AuctionFrameAuctions_OnShow - AuctionFrameAuctions_OnShow = Aux_Sell_AuctionFrameAuctions_OnShow - - Aux.orig.BrowseButton_OnClick = BrowseButton_OnClick - BrowseButton_OnClick = Aux_BrowseButton_OnClick - AuctionsButton1:RegisterForClicks("LeftButtonUp", "RightButtonDown") AuctionsButton1:SetScript("OnMouseDown", Aux_AuctionsButton_OnMouseDown) AuctionsButton2:RegisterForClicks("LeftButtonUp", "RightButtonDown") @@ -173,255 +114,84 @@ function Aux_SetupHookFunctions() AuctionsButton8:SetScript("OnMouseDown", Aux_AuctionsButton_OnMouseDown) AuctionsButton9:RegisterForClicks("LeftButtonUp", "RightButtonDown") AuctionsButton9:SetScript("OnMouseDown", Aux_AuctionsButton_OnMouseDown) - - BrowseButton1:RegisterForClicks("LeftButtonUp", "RightButtonDown") - BrowseButton1:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown) - BrowseButton2:RegisterForClicks("LeftButtonUp", "RightButtonDown") - BrowseButton2:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown) - BrowseButton3:RegisterForClicks("LeftButtonUp", "RightButtonDown") - BrowseButton3:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown) - BrowseButton4:RegisterForClicks("LeftButtonUp", "RightButtonDown") - BrowseButton4:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown) - BrowseButton5:RegisterForClicks("LeftButtonUp", "RightButtonDown") - BrowseButton5:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown) - BrowseButton6:RegisterForClicks("LeftButtonUp", "RightButtonDown") - BrowseButton6:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown) - BrowseButton7:RegisterForClicks("LeftButtonUp", "RightButtonDown") - BrowseButton7:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown) - BrowseButton8:RegisterForClicks("LeftButtonUp", "RightButtonDown") - BrowseButton8:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown) Aux.orig.PickupContainerItem = PickupContainerItem PickupContainerItem = Aux.PickupContainerItem - Aux.orig.AuctionSellItemButton_OnEvent = AuctionSellItemButton_OnEvent - AuctionSellItemButton_OnEvent = Aux.sell.AuctionSellItemButton_OnEvent - - Aux.orig.AuctionFrameTab_OnClick = AuctionFrameTab_OnClick - AuctionFrameTab_OnClick = Aux_AuctionFrameTab_OnClick - Aux.orig.ContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick ContainerFrameItemButton_OnClick = Aux_ContainerFrameItemButton_OnClick - - Aux.orig.AuctionFrameBid_Update = AuctionFrameBid_Update - AuctionFrameBid_Update = Aux_AuctionFrameBid_Update - - Aux.orig.AuctionFrameAuctions_Update = AuctionFrameAuctions_Update - AuctionFrameAuctions_Update = Aux_AuctionFrameAuctions_Update + + Aux.orig.AuctionFrameAuctions_OnEvent = AuctionFrameAuctions_OnEvent + AuctionFrameAuctions_OnEvent = Aux.AuctionFrameAuctions_OnEvent + end ------------------------------------------ +function Aux.AuctionFrameAuctions_OnEvent() + if AuctionFrameAuctions:IsVisible() then + Aux.orig.AuctionFrameAuctions_OnEvent() + end +end function Aux_OnAuctionHouseShow() - AuxOptionsButtonPanel:Show() + AuxButton:Show() + AuxFrame:Show() + Aux.on_tab_click(1) if AUX_OPEN_SELL then - AuctionFrameTab_OnClick(Aux.tabs.sell.index) + Aux.on_tab_click(2) elseif AUX_OPEN_BUY then - -- AuctionFrameTab_OnClick(Aux.tabs.buy.index) + end end ------------------------------------------ - function Aux_OnAuctionHouseClosed() - Aux.post.stop() Aux.stack.stop() - Aux.buy.exit() - Aux.scan.abort() - - AuxOptionsButtonPanel:Hide() - AuxOptionsFrame:Hide() - AuxAboutFrame:Hide() - AuxSellPanel:Hide() - AuxBuyPanel:Hide() - -end - -function Aux_AuctionFrameTab_OnClick(index) - - if not index then - index = this:GetID() - end - - Aux.post.stop() - Aux.stack.stop() - Aux.buy.exit() Aux.scan.abort() - AuxSellPanel:Hide() - AuxBuyPanel:Hide() - - if index == 2 then - Aux_ShowElems(Aux.tabs.buy.hiddenElements) - end + Aux.buy.on_close() + Aux.sell.on_close() - if index == 3 then - Aux_ShowElems(Aux.tabs.sell.hiddenElements) - end - - if index == Aux.tabs.sell.index then - AuctionFrameTab_OnClick(3) - Aux.sell.on_open() - - PanelTemplates_SetTab(AuctionFrame, Aux.tabs.sell.index) - - Aux_HideElems(Aux.tabs.sell.hiddenElements) - - AuxSellPanel:Show() - AuctionFrame:EnableMouse(false) - - elseif index == Aux.tabs.buy.index then - Aux.orig.AuctionFrameTab_OnClick(1) - - PanelTemplates_SetTab(AuctionFrame, Aux.tabs.buy.index) - - Aux_HideElems(Aux.tabs.buy.hiddenElements) - - AuxBuyPanel:Show() - AuctionFrame:EnableMouse(false) - - Aux.buy.on_open() - else - Aux.orig.AuctionFrameTab_OnClick(index) - lastItemPosted = nil - end + AuxFrame:Hide() end -function Aux_AddPanels() - - local sellFrame = CreateFrame("Frame", "AuxSellPanel", AuctionFrame, "AuxSellTemplate") - sellFrame:SetParent("AuctionFrame") - sellFrame:SetPoint("TOPLEFT", "AuctionFrame", "TOPLEFT") - relevel(sellFrame) - sellFrame:Hide() - - local buyFrame = CreateFrame("Frame", "AuxBuyPanel", AuctionFrame, "AuxBuyTemplate") - buyFrame:SetParent("AuctionFrame") - buyFrame:SetPoint("TOPLEFT", "AuctionFrame", "TOPLEFT") - AuxLogFrame:SetParent(buyFrame) - AuxLogFrame:SetPoint('TOP', buyFrame, 100, -43) - relevel(buyFrame) - buyFrame:Hide() - - local optionsFrame = CreateFrame("Frame", "AuxOptionsButtonPanel", AuctionFrame, "AuxOptionsButtonTemplate") - optionsFrame:SetParent("AuctionFrame") - optionsFrame:SetPoint("TOPLEFT", "AuctionFrame", "TOPLEFT") - relevel(optionsFrame) - optionsFrame:Hide() +function Aux.on_tab_click(index) + Aux.post.stop() + Aux.stack.stop() + Aux.scan.abort() + + Aux.buy.on_close() + Aux.sell.on_close() + + for i=1,5 do + getglobal('AuxTab'..i):SetAlpha(i == index and 1 or 0.5) + end + + AuxSellFrame:Hide() + AuxBuyFrame:Hide() + + if index == 1 then + AuxBuyFrame:Show() + Aux.buy.on_open() + elseif index == 2 then + AuxSellFrame:Show() + Aux.sell.on_open() + end + end ------------------------------------------ - -function Aux_AddTabs() - - AuctionFrameTab1:SetText('Buy') - - Aux.tabs.sell.index = AuctionFrame.numTabs + 1 - - local sellTabName = "AuctionFrameTab"..Aux.tabs.sell.index - - local sellTab = CreateFrame("Button", sellTabName, AuctionFrame, "AuctionTabTemplate") - - setglobal(sellTabName, sellTab) - - sellTab:SetID(Aux.tabs.sell.index) - sellTab:SetText("Sell") - sellTab:SetPoint("LEFT", getglobal("AuctionFrameTab"..AuctionFrame.numTabs), "RIGHT", -8, 0) - - PanelTemplates_SetNumTabs(AuctionFrame, Aux.tabs.sell.index) - PanelTemplates_EnableTab(AuctionFrame, Aux.tabs.sell.index) -end - ------------------------------------------ - -function Aux_HideElems(tt) - - if not tt then - return; - end - - for i,x in ipairs(tt) do - x:Hide() - end -end - ------------------------------------------ - -function Aux_ShowElems(tt) - - for i,x in ipairs(tt) do - x:Show() - end -end - ------------------------------------------ - -function Aux_PluralizeIf(word, count) - - if count and count == 1 then - return word - else - return word.."s" - end -end - ------------------------------------------ - function Aux_Round(v) return math.floor(v + 0.5) end ------------------------------------------ - -function relevel(frame) - local myLevel = frame:GetFrameLevel() + 1 - local children = { frame:GetChildren() } - for _,child in pairs(children) do - child:SetFrameLevel(myLevel) - relevel(child) - end -end - ------------------------------------------ - -function Aux_BrowseButton_OnClick(button) - if arg1 == "LeftButton" then -- because we additionally registered right clicks we only let left ones pass here - Aux.orig.BrowseButton_OnClick(button) - end -end - ------------------------------------------ - function Aux_AuctionsButton_OnClick(button) if arg1 == "LeftButton" then -- because we additionally registered right clicks we only let left ones pass here Aux.orig.BrowseButton_OnClick(button) end end ------------------------------------------ - -function Aux_BrowseButton_OnMouseDown() - if arg1 == "RightButton" and AUX_INSTANT_BUYOUT and GetTime() - lastRightClickAction > 0.5 then - local index = this:GetID() + FauxScrollFrame_GetOffset(BrowseScrollFrame) - - SetSelectedAuctionItem("list", index) - - local auction_item = Aux.info.auction_item(index) - if auction_item.buyout_price > 0 then - PlaceAuctionBid("list", index, auction_item.buyout_price) - end - - AuctionFrameBrowse_Update() - lastRightClickAction = GetTime() - end -end - ------------------------------------------ - function Aux_AuctionsButton_OnMouseDown() if arg1 == "RightButton" and GetTime() - lastRightClickAction > 0.5 then local index = this:GetID() + FauxScrollFrame_GetOffset(AuctionsScrollFrame) @@ -435,15 +205,11 @@ function Aux_AuctionsButton_OnMouseDown() end end ------------------------------------------ - function Aux.PickupContainerItem(bag, item) Aux.last_picked_up = { bag=bag, slot=item } return Aux.orig.PickupContainerItem(bag, item) end ------------------------------------------ - function Aux_ContainerFrameItemButton_OnClick(button) local bag, slot = this:GetParent():GetID(), this:GetID() local container_item = Aux.info.container_item(bag, slot) @@ -452,21 +218,13 @@ function Aux_ContainerFrameItemButton_OnClick(button) if IsShiftKeyDown() and not ChatFrameEditBox:IsVisible() - and (PanelTemplates_GetSelectedTab(AuctionFrame) == 1 or PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.buy.index) + and AuxBuyFrame:IsVisible() then - if PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.buy.index then - AuxBuyNameInputBox.completor.set_quietly(container_item.name) - end + AuxBuyNameInputBox.completor.set_quietly(container_item.name) return - elseif AUX_SELL_SHORTCUT and IsAltKeyDown()then - Aux.sell.set_auction(bag, slot) - if PanelTemplates_GetSelectedTab(AuctionFrame) ~= Aux.tabs.sell.index then - AuctionFrameTab_OnClick(Aux.tabs.sell.index) - end - return - elseif AUX_BUY_SHORTCUT and IsControlKeyDown() then - if PanelTemplates_GetSelectedTab(AuctionFrame) ~= Aux.tabs.buy.index then - AuctionFrameTab_OnClick(Aux.tabs.buy.index) + elseif AUX_BUY_SHORTCUT and IsAltKeyDown() then + if not AuxBuyFrame:IsVisible() then + Aux.on_tab_click(1) end AuxBuyNameInputBox.completor.set_quietly(container_item.name) Aux.buy.SearchButton_onclick() @@ -476,8 +234,6 @@ function Aux_ContainerFrameItemButton_OnClick(button) return Aux.orig.ContainerFrameItemButton_OnClick(button) end ------------------------------------------ - function Aux_QualityColor(code) if code == 0 then return "ff9d9d9d" -- poor, gray @@ -494,8 +250,6 @@ function Aux_QualityColor(code) end end ------------------------------------------ - function Aux.auction_signature(hyperlink, stack_size, amount) return hyperlink .. (stack_size or '0') .. '_' .. (amount or '0') end \ No newline at end of file diff --git a/core.xml b/core.xml index e498066..5166e66 100644 --- a/core.xml +++ b/core.xml @@ -16,64 +16,161 @@ -