From 30448813df4387f7bbb75e292ac7d3abc2ba8aad Mon Sep 17 00:00:00 2001 From: Manuel Simon Hirsig Date: Mon, 5 Oct 2015 23:56:53 +0200 Subject: [PATCH] deposit calculation as total for all stacks implemented --- info.lua | 8 +++++--- sell.lua | 40 ++++++++++++++++++++++++---------------- 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/info.lua b/info.lua index 6bebc27..7ed070c 100644 --- a/info.lua +++ b/info.lua @@ -26,17 +26,19 @@ function Aux.info.container_item(bag, slot) end function Aux.info.auction_sell_item() - local name, texture, count, quality, usable, vendor_price, vendor_price_per_unit, max_stack, total_count = GetAuctionSellItemInfo() - auction_sell_item = { + local name, texture, stack_size, quality, usable, vendor_price, vendor_price_per_unit, max_stack, total_count = GetAuctionSellItemInfo() + local base_deposit = CalculateAuctionDeposit(120) / stack_size + auction_sell_item = name and { name = name, texture = texture, - count = count, + stack_size = stack_size, quality = quality, usable = usable, vendor_price = vendor_price, vendor_price_per_unit = vendor_price_per_unit, max_stack = max_stack, total_count = total_count, + base_deposit = base_deposit, } auction_sell_item.tooltip = Aux.info.tooltip(function(tt) tt:SetAuctionSellItem() end) diff --git a/sell.lua b/sell.lua index 850628e..6ba0f54 100644 --- a/sell.lua +++ b/sell.lua @@ -47,7 +47,8 @@ function Aux_Sell_AuctionsRadioButton_OnClick(index) AUX_AUCTION_DURATION = 'long' end - return Aux.orig.AuctionsRadioButton_OnClick(index) + Aux.orig.AuctionsRadioButton_OnClick(index) + update_recommendation() end ----------------------------------------- @@ -177,6 +178,8 @@ function update_recommendation() Aux_Sell_SetStackSize(current_auction.stackSize) Aux_Sell_SetStackCount(current_auction.stackCount) + MoneyFrame_Update("AuctionsDepositMoneyFrame", current_auction.base_deposit * current_auction.stackCount * (current_auction.has_charges and 1 or current_auction.stackSize) * AuctionFrameAuctions.duration / 120) + if auxSellEntries[current_auction.name] and auxSellEntries[current_auction.name].selected then if not auxSellEntries[current_auction.name].created or GetTime() - auxSellEntries[current_auction.name].created > 1800 then AuxRecommendStaleText:SetText("STALE DATA") -- data older than half an hour marked as stale @@ -281,8 +284,6 @@ function Aux.sell.set_auction(bag, slot) local container_item = Aux.info.container_item(bag, slot) if container_item then - - Aux.scan.abort() ClearCursor() PickupContainerItem(bag,slot) @@ -291,21 +292,28 @@ function Aux.sell.set_auction(bag, slot) ClickAuctionSellItemButton() ClearCursor() - current_auction = container_item and { - name = container_item.name, - texture = container_item.texture, - stackSize = container_item.charges or container_item.count, - stackCount = 1, - class = container_item.type, - subclass = container_item.subtype, - } + if auction_sell_item then - if current_auction and not auxSellEntries[current_auction.name] then - refresh_entries() - end + Aux.scan.abort() + + current_auction = { + name = container_item.name, + texture = container_item.texture, + stackSize = container_item.charges or container_item.count, + stackCount = 1, + class = container_item.type, + subclass = container_item.subtype, + base_deposit = auction_sell_item.base_deposit, + has_charges = container_item.charges ~= nil, + } - select_entry() - update_recommendation() + if current_auction and not auxSellEntries[current_auction.name] then + refresh_entries() + end + + select_entry() + update_recommendation() + end end end