From 2de27258f904dcd32c3333662d4ce619e65077bb Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Wed, 21 Oct 2015 19:43:16 +0200 Subject: [PATCH] buy modes and sell sliders done --- .idea/workspace.xml | 101 ++++++++++++++++++++++---------------------- buy.lua | 37 ++++++++++------ core.lua | 2 +- info.lua | 2 +- list.lua | 4 +- scan.lua | 4 +- 6 files changed, 79 insertions(+), 71 deletions(-) diff --git a/.idea/workspace.xml b/.idea/workspace.xml index 4444345..1b6c11c 100644 --- a/.idea/workspace.xml +++ b/.idea/workspace.xml @@ -3,12 +3,11 @@ - - + @@ -74,8 +73,8 @@ - - + + @@ -84,8 +83,8 @@ - - + + @@ -94,8 +93,8 @@ - - + + @@ -104,8 +103,18 @@ - - + + + + + + + + + + + + @@ -151,16 +160,6 @@ - - - - - - - - - - @@ -190,11 +189,11 @@ @@ -440,14 +439,6 @@ - - - - - - - - @@ -456,14 +447,6 @@ - - - - - - - - @@ -488,26 +471,34 @@ - + - - + + - + - - + + - - + + + + + + + + + + @@ -520,18 +511,26 @@ - + - - + + + + + + + + + + - - + + diff --git a/buy.lua b/buy.lua index 6505e1e..2c61194 100644 --- a/buy.lua +++ b/buy.lua @@ -35,8 +35,8 @@ Aux.buy.modes = { end, columns = { { - title = 'Auctions', - width = 70, + title = 'Avail', + width = 40, comparator = function(group1, group2) return Aux.util.compare(getn(Aux.util.filter(group1, function(auction) return not auction.gone end)), getn(Aux.util.filter(group2, function(auction) return not auction.gone end)), Aux.util.LT) end, cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'), cell_setter = function(cell, group) @@ -46,7 +46,7 @@ Aux.buy.modes = { }, { title = 'Auction Item', - width = 282, + width = 312, comparator = function(group1, group2) return Aux.util.compare(group1[1].name, group2[1].name, Aux.util.GT) end, cell_initializer = function(cell) local icon = CreateFrame('Button', nil, cell) @@ -93,7 +93,7 @@ Aux.buy.modes = { end, }, { - title = '#', + title = 'Qty', width = 23, comparator = function(group1, group2) return Aux.util.compare(group1[1].stack_size, group2[1].stack_size, Aux.util.LT) end, cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'), @@ -152,7 +152,7 @@ Aux.buy.modes = { }, { title = 'Auction Item', - width = 181, + width = 206, comparator = function(row1, row2) return Aux.util.compare(row1.tooltip[1][1].text, row2.tooltip[1][1].text, Aux.util.GT) end, cell_initializer = function(cell) local icon = CreateFrame('Button', nil, cell) @@ -219,17 +219,17 @@ Aux.buy.modes = { end, }, { - title = 'High Bidder', - width = 95, - comparator = function(auction1, auction2) return Aux.util.compare(auction1.high_bidder, auction2.high_bidder, Aux.util.GT) end, - cell_initializer = Aux.sheet.default_cell_initializer('LEFT'), + title = 'Status', + width = 70, + comparator = function(auction1, auction2) return Aux.util.compare(auction1.status, auction2.status, Aux.util.GT) end, + cell_initializer = Aux.sheet.default_cell_initializer('CENTER'), cell_setter = function(cell, auction) - cell.text:SetText(auction.high_bidder) + cell.text:SetText(auction.status) auction_alpha_setter(cell, auction) end, }, { - title = '#', + title = 'Qty', width = 23, comparator = function(row1, row2) return Aux.util.compare(row1.stack_size, row2.stack_size, Aux.util.LT) end, cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'), @@ -277,7 +277,7 @@ Aux.buy.modes = { end, columns = { { - title = '#', + title = 'Qty', width = 23, comparator = function(row1, row2) return Aux.util.compare(row1.stack_size, row2.stack_size, Aux.util.LT) end, cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'), @@ -469,10 +469,10 @@ function update_sheet() local mode = UIDropDownMenu_GetSelectedValue(AuxBuyModeDropDown) if mode == BUYOUT then - local buyout_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.name ~= UnitName('player') and auction.buyout_price end) or {} + local buyout_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {} Aux.list.populate(AuxBuyBuyList.sheet, auctions and Aux.util.group_by(buyout_auctions, function(a1, a2) return a1.hyperlink == a2.hyperlink and a1.stack_size == a2.stack_size and a1.buyout_price == a2.buyout_price end) or {}) elseif mode == BID then - local bid_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.name ~= UnitName('player') end) or {} + local bid_auctions = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') end) or {} Aux.list.populate(AuxBuyBidList.sheet, bid_auctions) elseif mode == FULL then Aux.list.populate(AuxBuyFullList.sheet, auctions or {}) @@ -717,6 +717,14 @@ function create_auction_record(auction_item, current_page) local bid = (auction_item.current_bid > 0 and auction_item.current_bid or auction_item.min_bid) + auction_item.min_increment local buyout_price = auction_item.buyout_price > 0 and auction_item.buyout_price or nil local buyout_price_per_unit = buyout_price and Aux_Round(auction_item.buyout_price/stack_size) + local status + if auction_item.current_bid == 0 then + status = 'No Bid' + 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 + end return { signature = Aux.auction_signature(auction_item.hyperlink, stack_size, bid, auction_item.buyout_price), @@ -738,6 +746,7 @@ function create_auction_record(auction_item, current_page) duration = auction_item.duration, usable = auction_item.usable, high_bidder = auction_item.high_bidder, + status = status, EnhTooltip_info = auction_item.EnhTooltip_info, } diff --git a/core.lua b/core.lua index 767c514..8724c62 100644 --- a/core.lua +++ b/core.lua @@ -148,7 +148,7 @@ function Aux.log(msg) end function Aux_SetupHookFunctions() - + Aux.orig.AuctionFrameAuctions_OnShow = AuctionFrameAuctions_OnShow AuctionFrameAuctions_OnShow = Aux_Sell_AuctionFrameAuctions_OnShow diff --git a/info.lua b/info.lua index 6541092..93505e1 100644 --- a/info.lua +++ b/info.lua @@ -132,7 +132,7 @@ function Aux.info.tooltip(setter) right.text = getglobal('AuxInfoTooltipTextRight'..i):GetText() right.r, right.b, right.g = getglobal('AuxInfoTooltipTextRight'..i):GetTextColor() - tinsert(tooltip, {left, right}) + tinsert(tooltip, {left or '', right or ''}) end for i = 1, TOOLTIP_LENGTH do diff --git a/list.lua b/list.lua index 6dfd0d8..b20c76c 100644 --- a/list.lua +++ b/list.lua @@ -257,8 +257,8 @@ function Aux.list.sort(sheet, column_index) if sheet.sort_order[1].column == column then sheet.sort_order[1].sort_ascending = not sheet.sort_order[1].sort_ascending else - sort_order = Aux.util.filter(sort_order, function(sort_info) return not sort_info.column == column end) - tinsert(sort_order, 1, {column=column, sort_ascending=true}) + sheet.sort_order = Aux.util.filter(sheet.sort_order, function(sort_info) return not sort_info.column == column end) + tinsert(sheet.sort_order, 1, {column=column, sort_ascending=true}) end Aux.util.merge_sort(sheet.data, Aux.list.row_comparator(sheet)) diff --git a/scan.lua b/scan.lua index 3bb7c5b..ce099f7 100644 --- a/scan.lua +++ b/scan.lua @@ -131,12 +131,12 @@ function submit_query(k) state.job.on_submit_query() end wait_for_results(function() - wait_for_complete_results(function() + --wait_for_complete_results(function() if state.job.on_page_loaded then state.job.on_page_loaded(state.page) end k() - end)end) + end)--end) QueryAuctionItems( state.job.query.name, state.job.query.min_level,