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{
|
Aux.scan.start{
|
||||||
query = search_query,
|
query = search_query,
|
||||||
page = 0,
|
page = 0,
|
||||||
on_start_page = function(k, page)
|
on_start_page = function(ok, page, total_pages)
|
||||||
current_page = page
|
current_page = page
|
||||||
set_message('Scanning auctions: page ' .. page + 1 .. ' ...')
|
set_message('Scanning auctions: page ' .. page + 1 .. (total_pages and ' out of ' .. total_pages or '') .. ' ...')
|
||||||
return k()
|
return ok()
|
||||||
end,
|
end,
|
||||||
on_read_auction = function(k, i)
|
on_read_auction = function(ok, i)
|
||||||
local auction_item = Aux.info.auction_item(i)
|
local auction_item = Aux.info.auction_item(i)
|
||||||
if auction_item then
|
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
|
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)
|
process_auction(auction_item, current_page)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return k()
|
return ok()
|
||||||
end,
|
end,
|
||||||
on_complete = function()
|
on_complete = function()
|
||||||
entries = entries or {}
|
entries = entries or {}
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ function Aux_ContainerFrameItemButton_OnClick(button)
|
|||||||
end
|
end
|
||||||
return
|
return
|
||||||
elseif AUX_SELL_SHORTCUT and IsAltKeyDown()then
|
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
|
if PanelTemplates_GetSelectedTab(AuctionFrame) ~= Aux.tabs.sell.index then
|
||||||
AuctionFrameTab_OnClick(Aux.tabs.sell.index)
|
AuctionFrameTab_OnClick(Aux.tabs.sell.index)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -26,15 +26,15 @@ function Aux.info.container_item(bag, slot)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function Aux.info.auction_sell_item()
|
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 = {
|
auction_sell_item = {
|
||||||
name = name,
|
name = name,
|
||||||
texture = texture,
|
texture = texture,
|
||||||
count = count,
|
count = count,
|
||||||
quality = quality,
|
quality = quality,
|
||||||
usable = usable,
|
usable = usable,
|
||||||
price = price,
|
vendor_price = vendor_price,
|
||||||
buyout_price_per_unit = buyout_price_per_unit,
|
vendor_price_per_unit = vendor_price_per_unit,
|
||||||
max_stack = max_stack,
|
max_stack = max_stack,
|
||||||
total_count = total_count,
|
total_count = total_count,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,6 +132,7 @@ function Aux.list.initialize(frame, physical_columns, logical_columns)
|
|||||||
if (i <= table.getn(physical_columns)) then
|
if (i <= table.getn(physical_columns)) then
|
||||||
local physical_column = physical_columns[i]
|
local physical_column = physical_columns[i]
|
||||||
local logical_column = physical_column.logical_column
|
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().."Arrow"):Hide()
|
||||||
getglobal(button:GetName().."Text"):SetText(logical_column.title)
|
getglobal(button:GetName().."Text"):SetText(logical_column.title)
|
||||||
button:Show()
|
button:Show()
|
||||||
@@ -325,7 +326,7 @@ end
|
|||||||
function Aux.list.dropdown_on_load()
|
function Aux.list.dropdown_on_load()
|
||||||
getglobal(this:GetName().."Text"):Hide()
|
getglobal(this:GetName().."Text"):Hide()
|
||||||
this.initialize = Aux.list.dropdown_initialize
|
this.initialize = Aux.list.dropdown_initialize
|
||||||
-- UIDropDownMenu_SetSelectedID(this, 1) TODO
|
UIDropDownMenu_SetSelectedID(this, 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
|
|||||||
@@ -80,9 +80,9 @@ function scan()
|
|||||||
|
|
||||||
scan_auctions(count, function() --;
|
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
|
if state.page then
|
||||||
return scan()
|
return scan()
|
||||||
@@ -114,7 +114,7 @@ end
|
|||||||
|
|
||||||
function submit_query(k)
|
function submit_query(k)
|
||||||
if state.page then
|
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() --;
|
controller().wait(CanSendAuctionQuery, function() --;
|
||||||
wait_for_results(k)
|
wait_for_results(k)
|
||||||
QueryAuctionItems(
|
QueryAuctionItems(
|
||||||
|
|||||||
@@ -59,30 +59,11 @@ function Aux_AuctionFrameAuctions_Update()
|
|||||||
end
|
end
|
||||||
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()
|
function Aux.sell.post_auctions()
|
||||||
if PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.sell.index then
|
if current_auction and PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.sell.index then
|
||||||
local name, stack_size, buyout_price = current_auction.name, current_auction.stackSize, MoneyInputFrame_GetCopper(BuyoutPrice)
|
local name, stack_size, buyout_price, stack_count = current_auction.name, current_auction.stackSize, MoneyInputFrame_GetCopper(BuyoutPrice), current_auction.stackCount
|
||||||
local duration
|
local duration
|
||||||
if AuctionFrameAuctions.duration == 120 then
|
if AuctionFrameAuctions.duration == 120 then
|
||||||
duration = 2
|
duration = 2
|
||||||
@@ -98,7 +79,7 @@ function Aux.sell.post_auctions()
|
|||||||
AuctionFrameAuctions.duration,
|
AuctionFrameAuctions.duration,
|
||||||
MoneyInputFrame_GetCopper(StartPrice),
|
MoneyInputFrame_GetCopper(StartPrice),
|
||||||
buyout_price,
|
buyout_price,
|
||||||
current_auction.stackCount,
|
stack_count,
|
||||||
function(posted)
|
function(posted)
|
||||||
for i = 1, posted do
|
for i = 1, posted do
|
||||||
record_auction(name, stack_size, buyout_price, duration, UnitName("player"))
|
record_auction(name, stack_size, buyout_price, duration, UnitName("player"))
|
||||||
@@ -170,10 +151,27 @@ function update_recommendation()
|
|||||||
if not current_auction then
|
if not current_auction then
|
||||||
AuxSellRefreshButton:Disable()
|
AuxSellRefreshButton:Disable()
|
||||||
|
|
||||||
|
AuxSellItem:SetNormalTexture(nil)
|
||||||
|
AuxSellItemName:SetText()
|
||||||
|
AuxSellItemCount:SetText()
|
||||||
|
|
||||||
|
MoneyInputFrame_SetCopper(BuyoutPrice, 0)
|
||||||
|
MoneyInputFrame_SetCopper(StartPrice, 0)
|
||||||
|
|
||||||
Aux_Sell_SetStackSize(0)
|
Aux_Sell_SetStackSize(0)
|
||||||
Aux_Sell_SetStackCount(0)
|
Aux_Sell_SetStackCount(0)
|
||||||
|
|
||||||
set_message("Drag an item to the Auction Item area\n\nto see recommended pricing information")
|
set_message("Drag an item to the Auction Item area\n\nto see recommended pricing information")
|
||||||
else
|
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()
|
AuxSellRefreshButton:Enable()
|
||||||
|
|
||||||
Aux_Sell_SetStackSize(current_auction.stackSize)
|
Aux_Sell_SetStackSize(current_auction.stackSize)
|
||||||
@@ -197,21 +195,18 @@ function update_recommendation()
|
|||||||
Aux_ShowElems(Aux.tabs.sell.recommendationElements)
|
Aux_ShowElems(Aux.tabs.sell.recommendationElements)
|
||||||
|
|
||||||
AuxRecommendText:SetText("Recommended Buyout Price")
|
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)
|
AuxRecommendItemTex:SetNormalTexture(current_auction.texture)
|
||||||
if current_auction.stackSize > 1 then
|
if current_auction.stackSize > 1 then
|
||||||
AuxRecommendItemTexCount:SetText(current_auction.stackSize)
|
AuxRecommendItemTexCount:SetText(current_auction.stackSize)
|
||||||
AuxRecommendItemTexCount:Show()
|
AuxRecommendItemTexCount:Show()
|
||||||
else
|
|
||||||
AuxRecommendItemTexCount:Hide()
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
AuxRecommendItemTex:Hide()
|
AuxRecommendItemTexCount:Hide()
|
||||||
end
|
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))
|
MoneyFrame_Update("AuxRecommendPerStackPrice", Aux_Round(newBuyoutPrice))
|
||||||
|
|
||||||
MoneyInputFrame_SetCopper(BuyoutPrice, 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)
|
local container_item = Aux.info.container_item(bag, slot)
|
||||||
|
|
||||||
@@ -289,13 +284,20 @@ function Aux.sell.update_auction(bag, slot)
|
|||||||
|
|
||||||
Aux.scan.abort()
|
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 {
|
current_auction = container_item and {
|
||||||
name = container_item.name,
|
name = container_item.name,
|
||||||
texture = container_item.texture,
|
texture = container_item.texture,
|
||||||
stackSize = container_item.charges or container_item.count,
|
stackSize = container_item.charges or container_item.count,
|
||||||
stackCount = 1,
|
stackCount = 1,
|
||||||
|
class = container_item.type,
|
||||||
|
subclass = container_item.subtype,
|
||||||
}
|
}
|
||||||
|
|
||||||
if current_auction and not auxSellEntries[current_auction.name] then
|
if current_auction and not auxSellEntries[current_auction.name] then
|
||||||
@@ -304,7 +306,6 @@ function Aux.sell.update_auction(bag, slot)
|
|||||||
|
|
||||||
select_entry()
|
select_entry()
|
||||||
update_recommendation()
|
update_recommendation()
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -312,14 +313,14 @@ end
|
|||||||
|
|
||||||
function refresh_entries()
|
function refresh_entries()
|
||||||
if current_auction then
|
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
|
auxSellEntries[name] = nil
|
||||||
|
|
||||||
local _, _, _, _, _, sType, sSubType = GetItemInfo(name)
|
class, subclass = GetItemInfo(name)
|
||||||
|
|
||||||
local class_index -- = item_class_index(sType)
|
local class_index = item_class_index(current_auction.class)
|
||||||
local subclass_index -- = item_subclass_index(class_index, sSubType)
|
local subclass_index = item_subclass_index(class_index, current_auction.subclass)
|
||||||
|
|
||||||
set_message('Scanning auctions ...')
|
set_message('Scanning auctions ...')
|
||||||
Aux.scan.start{
|
Aux.scan.start{
|
||||||
@@ -330,8 +331,8 @@ function refresh_entries()
|
|||||||
},
|
},
|
||||||
page = 0,
|
page = 0,
|
||||||
on_start_page = function(k, i)
|
on_start_page = function(k, i)
|
||||||
set_message('Scanning auctions: page ' .. i + 1 .. ' ...')
|
set_message('Scanning auctions: page ' .. i + 1 .. (total_pages and ' out of ' .. total_pages or '') .. ' ...')
|
||||||
k()
|
return k()
|
||||||
end,
|
end,
|
||||||
on_read_auction = function(k, i)
|
on_read_auction = function(k, i)
|
||||||
local auction_item = Aux.info.auction_item(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
|
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)
|
record_auction(auction_item.name, stack_size, auction_item.buyout_price, auction_item.duration, auction_item.owner)
|
||||||
end
|
end
|
||||||
k()
|
return k()
|
||||||
end,
|
end,
|
||||||
on_abort = function()
|
on_abort = function()
|
||||||
auxSellEntries[name] = nil
|
auxSellEntries[name] = nil
|
||||||
@@ -505,7 +506,7 @@ end
|
|||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function item_class_index(item_class)
|
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
|
if class == item_class then
|
||||||
return i
|
return i
|
||||||
end
|
end
|
||||||
@@ -515,7 +516,7 @@ end
|
|||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function item_subclass_index(class_index, item_subclass)
|
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
|
if subclass == item_subclass then
|
||||||
return i
|
return i
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -190,20 +190,6 @@
|
|||||||
</FontString>
|
</FontString>
|
||||||
</Layer>
|
</Layer>
|
||||||
</Layers>
|
</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>
|
||||||
<Button name="AuxSellPostButton" inherits="UIPanelButtonTemplate" text="Post Auctions">
|
<Button name="AuxSellPostButton" inherits="UIPanelButtonTemplate" text="Post Auctions">
|
||||||
<Size>
|
<Size>
|
||||||
@@ -241,11 +227,14 @@
|
|||||||
end
|
end
|
||||||
</OnEvent>
|
</OnEvent>
|
||||||
<OnClick>
|
<OnClick>
|
||||||
Aux.sell.clear_auction()
|
if CursorHasItem() then
|
||||||
-- AuctionsFrameAuctions_ValidateAuction() TODO
|
Aux.sell.set_auction(Aux.last_picked_up.bag, Aux.last_picked_up.slot)
|
||||||
|
else
|
||||||
|
Aux.sell.clear_auction()
|
||||||
|
end
|
||||||
</OnClick>
|
</OnClick>
|
||||||
<OnReceiveDrag>
|
<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()
|
ClearCursor()
|
||||||
</OnReceiveDrag>
|
</OnReceiveDrag>
|
||||||
<OnEnter>
|
<OnEnter>
|
||||||
|
|||||||
Reference in New Issue
Block a user