finished sell rework and some other minor fixes
This commit is contained in:
@@ -68,19 +68,19 @@ function Aux.buy.SearchButton_onclick()
|
||||
Aux.scan.start{
|
||||
query = search_query,
|
||||
page = 0,
|
||||
on_start_page = function(k, page)
|
||||
on_start_page = function(ok, page, total_pages)
|
||||
current_page = page
|
||||
set_message('Scanning auctions: page ' .. page + 1 .. ' ...')
|
||||
return k()
|
||||
set_message('Scanning auctions: page ' .. page + 1 .. (total_pages and ' out of ' .. total_pages or '') .. ' ...')
|
||||
return ok()
|
||||
end,
|
||||
on_read_auction = function(k, i)
|
||||
on_read_auction = function(ok, i)
|
||||
local auction_item = Aux.info.auction_item(i)
|
||||
if auction_item then
|
||||
if (auction_item.name == search_query.name or search_query.name == '' or not AuxBuyExactCheckButton:GetChecked()) and tooltip_match(tooltip_patterns, auction_item.tooltip) then
|
||||
process_auction(auction_item, current_page)
|
||||
end
|
||||
end
|
||||
return k()
|
||||
return ok()
|
||||
end,
|
||||
on_complete = function()
|
||||
entries = entries or {}
|
||||
|
||||
@@ -447,7 +447,7 @@ function Aux_ContainerFrameItemButton_OnClick(button)
|
||||
end
|
||||
return
|
||||
elseif AUX_SELL_SHORTCUT and IsAltKeyDown()then
|
||||
Aux.sell.update_auction(bag, slot)
|
||||
Aux.sell.set_auction(bag, slot)
|
||||
if PanelTemplates_GetSelectedTab(AuctionFrame) ~= Aux.tabs.sell.index then
|
||||
AuctionFrameTab_OnClick(Aux.tabs.sell.index)
|
||||
end
|
||||
|
||||
@@ -26,15 +26,15 @@ function Aux.info.container_item(bag, slot)
|
||||
end
|
||||
|
||||
function Aux.info.auction_sell_item()
|
||||
local name, texture, count, quality, usable, price, buyout_price_per_unit, max_stack, total_count = GetAuctionSellItemInfo()
|
||||
local name, texture, count, quality, usable, vendor_price, vendor_price_per_unit, max_stack, total_count = GetAuctionSellItemInfo()
|
||||
auction_sell_item = {
|
||||
name = name,
|
||||
texture = texture,
|
||||
count = count,
|
||||
quality = quality,
|
||||
usable = usable,
|
||||
price = price,
|
||||
buyout_price_per_unit = buyout_price_per_unit,
|
||||
vendor_price = vendor_price,
|
||||
vendor_price_per_unit = vendor_price_per_unit,
|
||||
max_stack = max_stack,
|
||||
total_count = total_count,
|
||||
}
|
||||
|
||||
@@ -132,6 +132,7 @@ function Aux.list.initialize(frame, physical_columns, logical_columns)
|
||||
if (i <= table.getn(physical_columns)) then
|
||||
local physical_column = physical_columns[i]
|
||||
local logical_column = physical_column.logical_column
|
||||
UIDropDownMenu_SetSelectedID(dropdown, Aux.util.index_of(logical_column, logical_columns))
|
||||
getglobal(button:GetName().."Arrow"):Hide()
|
||||
getglobal(button:GetName().."Text"):SetText(logical_column.title)
|
||||
button:Show()
|
||||
@@ -325,7 +326,7 @@ end
|
||||
function Aux.list.dropdown_on_load()
|
||||
getglobal(this:GetName().."Text"):Hide()
|
||||
this.initialize = Aux.list.dropdown_initialize
|
||||
-- UIDropDownMenu_SetSelectedID(this, 1) TODO
|
||||
UIDropDownMenu_SetSelectedID(this, 1)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
@@ -80,9 +80,9 @@ function scan()
|
||||
|
||||
scan_auctions(count, function() --;
|
||||
|
||||
local total_pages = math.ceil(total_count / AUCTIONS_PER_PAGE)
|
||||
state.total_pages = math.ceil(total_count / AUCTIONS_PER_PAGE)
|
||||
|
||||
state.page = state.job.next_page and state.job.next_page(state.page, total_pages)
|
||||
state.page = state.job.next_page and state.job.next_page(state.page, state.total_pages)
|
||||
|
||||
if state.page then
|
||||
return scan()
|
||||
@@ -114,7 +114,7 @@ end
|
||||
|
||||
function submit_query(k)
|
||||
if state.page then
|
||||
wait_for_callback(state.job.on_start_page, {state.page}, function() --;
|
||||
wait_for_callback(state.job.on_start_page, {state.page, state.total_pages}, function() --;
|
||||
controller().wait(CanSendAuctionQuery, function() --;
|
||||
wait_for_results(k)
|
||||
QueryAuctionItems(
|
||||
|
||||
@@ -59,30 +59,11 @@ function Aux_AuctionFrameAuctions_Update()
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
--TODO
|
||||
function AuctionSellItemButton_OnEvent()
|
||||
if ( event == "NEW_AUCTION_UPDATE") then
|
||||
local name, texture, count, quality, canUse, price = GetAuctionSellItemInfo();
|
||||
AuctionsItemButton:SetNormalTexture(texture);
|
||||
AuctionsItemButtonName:SetText(name);
|
||||
if ( count > 1 ) then
|
||||
AuctionsItemButtonCount:SetText(count);
|
||||
AuctionsItemButtonCount:Show();
|
||||
else
|
||||
AuctionsItemButtonCount:Hide();
|
||||
end
|
||||
MoneyInputFrame_SetCopper(StartPrice, max(100, floor(price * 1.5)));
|
||||
UpdateDeposit();
|
||||
MoneyInputFrame_SetCopper(BuyoutPrice, 0);
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function Aux.sell.post_auctions()
|
||||
if PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.sell.index then
|
||||
local name, stack_size, buyout_price = current_auction.name, current_auction.stackSize, MoneyInputFrame_GetCopper(BuyoutPrice)
|
||||
if current_auction and PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.sell.index then
|
||||
local name, stack_size, buyout_price, stack_count = current_auction.name, current_auction.stackSize, MoneyInputFrame_GetCopper(BuyoutPrice), current_auction.stackCount
|
||||
local duration
|
||||
if AuctionFrameAuctions.duration == 120 then
|
||||
duration = 2
|
||||
@@ -98,7 +79,7 @@ function Aux.sell.post_auctions()
|
||||
AuctionFrameAuctions.duration,
|
||||
MoneyInputFrame_GetCopper(StartPrice),
|
||||
buyout_price,
|
||||
current_auction.stackCount,
|
||||
stack_count,
|
||||
function(posted)
|
||||
for i = 1, posted do
|
||||
record_auction(name, stack_size, buyout_price, duration, UnitName("player"))
|
||||
@@ -170,10 +151,27 @@ function update_recommendation()
|
||||
if not current_auction then
|
||||
AuxSellRefreshButton:Disable()
|
||||
|
||||
AuxSellItem:SetNormalTexture(nil)
|
||||
AuxSellItemName:SetText()
|
||||
AuxSellItemCount:SetText()
|
||||
|
||||
MoneyInputFrame_SetCopper(BuyoutPrice, 0)
|
||||
MoneyInputFrame_SetCopper(StartPrice, 0)
|
||||
|
||||
Aux_Sell_SetStackSize(0)
|
||||
Aux_Sell_SetStackCount(0)
|
||||
|
||||
set_message("Drag an item to the Auction Item area\n\nto see recommended pricing information")
|
||||
else
|
||||
AuxSellItem:SetNormalTexture(current_auction.texture)
|
||||
AuxSellItemName:SetText(current_auction.name)
|
||||
if current_auction.stackSize > 1 then
|
||||
AuxSellItemCount:SetText(current_auction.stackSize)
|
||||
AuxSellItemCount:Show()
|
||||
else
|
||||
AuxSellItemCount:Hide()
|
||||
end
|
||||
|
||||
AuxSellRefreshButton:Enable()
|
||||
|
||||
Aux_Sell_SetStackSize(current_auction.stackSize)
|
||||
@@ -197,21 +195,18 @@ function update_recommendation()
|
||||
Aux_ShowElems(Aux.tabs.sell.recommendationElements)
|
||||
|
||||
AuxRecommendText:SetText("Recommended Buyout Price")
|
||||
AuxRecommendPerStackText:SetText("for your stack of "..current_auction.stackSize)
|
||||
AuxRecommendPerStackText:SetText("for a stack of "..current_auction.stackSize)
|
||||
|
||||
if current_auction.texture then
|
||||
AuxRecommendItemTex:SetNormalTexture(current_auction.texture)
|
||||
if current_auction.stackSize > 1 then
|
||||
AuxRecommendItemTexCount:SetText(current_auction.stackSize)
|
||||
AuxRecommendItemTexCount:Show()
|
||||
else
|
||||
AuxRecommendItemTexCount:Hide()
|
||||
end
|
||||
|
||||
AuxRecommendItemTex:SetNormalTexture(current_auction.texture)
|
||||
if current_auction.stackSize > 1 then
|
||||
AuxRecommendItemTexCount:SetText(current_auction.stackSize)
|
||||
AuxRecommendItemTexCount:Show()
|
||||
else
|
||||
AuxRecommendItemTex:Hide()
|
||||
AuxRecommendItemTexCount:Hide()
|
||||
end
|
||||
|
||||
MoneyFrame_Update("AuxRecommendPerItemPrice", Aux_Round(newBuyoutPrice / current_auction.stackSize))
|
||||
|
||||
MoneyFrame_Update("AuxRecommendPerItemPrice", Aux_Round(current_auction.stackSize > 0 and newBuyoutPrice / current_auction.stackSize or 0))
|
||||
MoneyFrame_Update("AuxRecommendPerStackPrice", Aux_Round(newBuyoutPrice))
|
||||
|
||||
MoneyInputFrame_SetCopper(BuyoutPrice, Aux_Round(newBuyoutPrice))
|
||||
@@ -281,7 +276,7 @@ end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function Aux.sell.update_auction(bag, slot)
|
||||
function Aux.sell.set_auction(bag, slot)
|
||||
|
||||
local container_item = Aux.info.container_item(bag, slot)
|
||||
|
||||
@@ -289,13 +284,20 @@ function Aux.sell.update_auction(bag, slot)
|
||||
|
||||
Aux.scan.abort()
|
||||
|
||||
-- local auction_sell_item = Aux.info.auction_sell_item()
|
||||
ClearCursor()
|
||||
PickupContainerItem(bag,slot)
|
||||
ClickAuctionSellItemButton()
|
||||
local auction_sell_item = Aux.info.auction_sell_item() -- TODO
|
||||
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 current_auction and not auxSellEntries[current_auction.name] then
|
||||
@@ -304,7 +306,6 @@ function Aux.sell.update_auction(bag, slot)
|
||||
|
||||
select_entry()
|
||||
update_recommendation()
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
@@ -312,14 +313,14 @@ end
|
||||
|
||||
function refresh_entries()
|
||||
if current_auction then
|
||||
local name = current_auction.name
|
||||
local name, class, subclass = current_auction.name, current_auction.class, current_auction.subclass
|
||||
|
||||
auxSellEntries[name] = nil
|
||||
|
||||
local _, _, _, _, _, sType, sSubType = GetItemInfo(name)
|
||||
class, subclass = GetItemInfo(name)
|
||||
|
||||
local class_index -- = item_class_index(sType)
|
||||
local subclass_index -- = item_subclass_index(class_index, sSubType)
|
||||
local class_index = item_class_index(current_auction.class)
|
||||
local subclass_index = item_subclass_index(class_index, current_auction.subclass)
|
||||
|
||||
set_message('Scanning auctions ...')
|
||||
Aux.scan.start{
|
||||
@@ -330,8 +331,8 @@ function refresh_entries()
|
||||
},
|
||||
page = 0,
|
||||
on_start_page = function(k, i)
|
||||
set_message('Scanning auctions: page ' .. i + 1 .. ' ...')
|
||||
k()
|
||||
set_message('Scanning auctions: page ' .. i + 1 .. (total_pages and ' out of ' .. total_pages or '') .. ' ...')
|
||||
return k()
|
||||
end,
|
||||
on_read_auction = function(k, i)
|
||||
local auction_item = Aux.info.auction_item(i)
|
||||
@@ -339,7 +340,7 @@ function refresh_entries()
|
||||
local stack_size = auction_item.charges or auction_item.count
|
||||
record_auction(auction_item.name, stack_size, auction_item.buyout_price, auction_item.duration, auction_item.owner)
|
||||
end
|
||||
k()
|
||||
return k()
|
||||
end,
|
||||
on_abort = function()
|
||||
auxSellEntries[name] = nil
|
||||
@@ -505,7 +506,7 @@ end
|
||||
-----------------------------------------
|
||||
|
||||
function item_class_index(item_class)
|
||||
for i, class in pairs(GetAuctionItemClasses()) do
|
||||
for i, class in ipairs({ GetAuctionItemClasses() }) do
|
||||
if class == item_class then
|
||||
return i
|
||||
end
|
||||
@@ -515,7 +516,7 @@ end
|
||||
-----------------------------------------
|
||||
|
||||
function item_subclass_index(class_index, item_subclass)
|
||||
for i, subclass in pairs(GetAuctionItemSubClasses(class_index)) do
|
||||
for i, subclass in ipairs({ GetAuctionItemSubClasses(class_index) }) do
|
||||
if subclass == item_subclass then
|
||||
return i
|
||||
end
|
||||
|
||||
@@ -190,20 +190,6 @@
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<OnEnter>
|
||||
GameTooltip:SetOwner(this, "ANCHOR_RIGHT")
|
||||
if GetAuctionSellItemInfo() then
|
||||
GameTooltip:SetAuctionSellItem()
|
||||
else
|
||||
GameTooltip:SetText(AUCTION_ITEM_TEXT, 1.0, 1.0, 1.0)
|
||||
end
|
||||
</OnEnter>
|
||||
<OnLeave>
|
||||
GameTooltip:Hide()
|
||||
</OnLeave>
|
||||
</Scripts>
|
||||
<HighlightTexture alphaMode="ADD" file="Interface\Buttons\ButtonHilight-Square"/>
|
||||
</Button>
|
||||
<Button name="AuxSellPostButton" inherits="UIPanelButtonTemplate" text="Post Auctions">
|
||||
<Size>
|
||||
@@ -241,11 +227,14 @@
|
||||
end
|
||||
</OnEvent>
|
||||
<OnClick>
|
||||
Aux.sell.clear_auction()
|
||||
-- AuctionsFrameAuctions_ValidateAuction() TODO
|
||||
if CursorHasItem() then
|
||||
Aux.sell.set_auction(Aux.last_picked_up.bag, Aux.last_picked_up.slot)
|
||||
else
|
||||
Aux.sell.clear_auction()
|
||||
end
|
||||
</OnClick>
|
||||
<OnReceiveDrag>
|
||||
Aux.sell.update_auction(Aux.last_picked_up.bag, Aux.last_picked_up.slot)
|
||||
Aux.sell.set_auction(Aux.last_picked_up.bag, Aux.last_picked_up.slot)
|
||||
ClearCursor()
|
||||
</OnReceiveDrag>
|
||||
<OnEnter>
|
||||
|
||||
Reference in New Issue
Block a user