some finishing touches for the full new ui release
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
## Title: Aux
|
||||
## Notes: A lightweight addon designed to help manage auctions
|
||||
## SavedVariablesPerCharacter: AUX_SELL_SHORTCUT, AUX_BUY_SHORTCUT, AUX_OPEN_SELL, AUX_OPEN_BUY, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION
|
||||
## SavedVariables: aux_database, aux_auctionable_items
|
||||
## SavedVariables: aux_database, aux_recently_searched, aux_auctionable_items
|
||||
|
||||
core.xml
|
||||
control.xml
|
||||
|
||||
@@ -239,7 +239,6 @@ function Aux.completion.selector(edit_box)
|
||||
if getn(suggestions) > 0 then
|
||||
index = math.mod(index, getn(suggestions)) + 1
|
||||
update_highlighting()
|
||||
Aux.item_search_frame.set_item(suggestions[index].value)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -248,7 +247,6 @@ function Aux.completion.selector(edit_box)
|
||||
if getn(suggestions) > 0 then
|
||||
index = index > 1 and index - 1 or getn(suggestions)
|
||||
update_highlighting()
|
||||
Aux.item_search_frame.set_item(suggestions[index].value)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
AuxVersion = "2.0.0"
|
||||
AuxVersion = "2.1.0"
|
||||
AuxAuthors = "shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)"
|
||||
|
||||
local lastRightClickAction = GetTime()
|
||||
@@ -226,25 +226,19 @@ end
|
||||
|
||||
function Aux_ContainerFrameItemButton_OnClick(button)
|
||||
local bag, slot = this:GetParent():GetID(), this:GetID()
|
||||
local container_item = Aux.info.container_item(bag, slot)
|
||||
local container_item_info = Aux.info.container_item(bag, slot)
|
||||
|
||||
-- if AuctionFrame:IsVisible() and button == "LeftButton" and container_item then
|
||||
--
|
||||
-- if IsShiftKeyDown()
|
||||
-- and not ChatFrameEditBox:IsVisible()
|
||||
-- and AuxBuyFrame:IsVisible()
|
||||
-- then
|
||||
-- AuxBuyNameInputBox.completor.set_quietly(container_item.name)
|
||||
-- return
|
||||
-- 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.filter_search_frame.start_search()
|
||||
-- return
|
||||
-- end
|
||||
-- end
|
||||
if AuxFrame:IsVisible() and button == "LeftButton" and container_item_info then
|
||||
if IsAltKeyDown() then
|
||||
if not AuxItemSearchFrame:IsVisible() then
|
||||
Aux.on_tab_click(1)
|
||||
end
|
||||
AuxItemSearchFrameItemItemInputBox:Hide()
|
||||
Aux.item_search_frame.set_item(container_item_info.item_id)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
return Aux.orig.ContainerFrameItemButton_OnClick(button)
|
||||
end
|
||||
|
||||
@@ -266,4 +260,20 @@ end
|
||||
|
||||
function Aux.auction_signature(hyperlink, stack_size, amount)
|
||||
return hyperlink .. (stack_size or '0') .. '_' .. (amount or '0')
|
||||
end
|
||||
|
||||
function Aux.item_class_index(item_class)
|
||||
for i, class in ipairs({ GetAuctionItemClasses() }) do
|
||||
if class == item_class then
|
||||
return i
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.item_subclass_index(class_index, item_subclass)
|
||||
for i, subclass in ipairs({ GetAuctionItemSubClasses(class_index) }) do
|
||||
if subclass == item_subclass then
|
||||
return i
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -322,12 +322,12 @@
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<OnEnter>
|
||||
if this.tooltip then
|
||||
Aux.info.set_game_tooltip(this, this.tooltip, 'ANCHOR_LEFT', this.EnhTooltip_info)
|
||||
if this.itemstring then
|
||||
Aux.info.set_tooltip(this.itemstring, this.EnhTooltip_info, this, 'ANCHOR_LEFT')
|
||||
end
|
||||
</OnEnter>
|
||||
<OnLeave>
|
||||
if this.tooltip then
|
||||
if this.itemstring then
|
||||
AuxTooltip:Hide()
|
||||
end
|
||||
</OnLeave>
|
||||
@@ -384,7 +384,7 @@
|
||||
</Button>
|
||||
<Button name="AuxAuctionFrameButton" inherits="UIPanelButtonTemplate" text="Default UI">
|
||||
<Size><AbsDimension x="65" y="17"/></Size>
|
||||
<Anchors><Anchor point="RIGHT" relativePoint="LEFT" relativeTo="AuxCloseButton"><Offset><AbsDimension x="-3" y="0"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="RIGHT" relativePoint="LEFT" relativeTo="AuxCloseButton"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
this:SetTextFontObject('GameFontNormalSmall')
|
||||
|
||||
+98
-80
@@ -29,14 +29,24 @@ public.views = {
|
||||
end,
|
||||
on_row_enter = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info, 0, 30)
|
||||
Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_CURSOR', 0, 30)
|
||||
end,
|
||||
on_row_leave = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
AuxTooltip:Hide()
|
||||
ResetCursor()
|
||||
end,
|
||||
on_row_update = function(sheet, row_index)
|
||||
if IsControlKeyDown() then
|
||||
ShowInspectCursor()
|
||||
elseif IsAltKeyDown() then
|
||||
SetCursor('BUY_CURSOR')
|
||||
else
|
||||
ResetCursor()
|
||||
end
|
||||
end,
|
||||
row_setter = function(row, group)
|
||||
row.tooltip = group[1].tooltip
|
||||
row.itemstring = Aux.info.itemstring(group[1].item_id, group[1].suffix_id, nil, group[1].enchant_id)
|
||||
row.EnhTooltip_info = group[1].EnhTooltip_info
|
||||
end,
|
||||
columns = {
|
||||
@@ -70,7 +80,7 @@ public.views = {
|
||||
cell.icon = icon
|
||||
end,
|
||||
cell_setter = function(cell, group)
|
||||
cell.icon.icon_texture:SetTexture(group[1].texture)
|
||||
cell.icon.icon_texture:SetTexture(Aux.info.item(group[1].item_id).texture)
|
||||
if not group[1].usable then
|
||||
cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
|
||||
else
|
||||
@@ -84,11 +94,11 @@ public.views = {
|
||||
},
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 23,
|
||||
comparator = function(group1, group2) return Aux.util.compare(group1[1].stack_size, group2[1].stack_size, Aux.util.LT) end,
|
||||
width = 25,
|
||||
comparator = function(group1, group2) return Aux.util.compare(group1[1].aux_quantity, group2[1].aux_quantity, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, group)
|
||||
cell.text:SetText(group[1].stack_size)
|
||||
cell.text:SetText(group[1].aux_quantity)
|
||||
group_alpha_setter(cell, group)
|
||||
end,
|
||||
},
|
||||
@@ -123,7 +133,7 @@ public.views = {
|
||||
end,
|
||||
},
|
||||
},
|
||||
sort_order = {{column = 2, order = 'ascending' }, {column = 4, order = 'ascending'}},
|
||||
sort_order = {{column = 1, order = 'ascending' }, {column = 4, order = 'ascending'}},
|
||||
},
|
||||
[BID] = {
|
||||
name = 'Bid',
|
||||
@@ -133,14 +143,24 @@ public.views = {
|
||||
end,
|
||||
on_row_enter = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info, 0, 30)
|
||||
Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_CURSOR', 0, 30)
|
||||
end,
|
||||
on_row_leave = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
AuxTooltip:Hide()
|
||||
ResetCursor()
|
||||
end,
|
||||
on_row_update = function(sheet, row_index)
|
||||
if IsControlKeyDown() then
|
||||
ShowInspectCursor()
|
||||
elseif IsAltKeyDown() then
|
||||
SetCursor('BUY_CURSOR')
|
||||
else
|
||||
ResetCursor()
|
||||
end
|
||||
end,
|
||||
row_setter = function(row, datum)
|
||||
row.tooltip = datum.tooltip
|
||||
row.itemstring = Aux.info.itemstring(datum.item_id, datum.suffix_id, datum.unique_id, datum.enchant_id)
|
||||
row.EnhTooltip_info = datum.EnhTooltip_info
|
||||
end,
|
||||
columns = {
|
||||
@@ -174,7 +194,7 @@ public.views = {
|
||||
cell.icon = icon
|
||||
end,
|
||||
cell_setter = function(cell, datum)
|
||||
cell.icon.icon_texture:SetTexture(datum.texture)
|
||||
cell.icon.icon_texture:SetTexture(Aux.info.item(datum.item_id).texture)
|
||||
if not datum.usable then
|
||||
cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
|
||||
else
|
||||
@@ -188,11 +208,11 @@ public.views = {
|
||||
},
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 23,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.stack_size, row2.stack_size, Aux.util.LT) end,
|
||||
width = 25,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.aux_quantity, row2.aux_quantity, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.stack_size)
|
||||
cell.text:SetText(datum.aux_quantity)
|
||||
auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
@@ -257,7 +277,7 @@ public.views = {
|
||||
end,
|
||||
},
|
||||
},
|
||||
sort_order = {{column = 2, order = 'ascending' }, {column = 6, order = 'ascending' }, {column = 3, order = 'ascending'}},
|
||||
sort_order = {{column = 1, order = 'ascending' }, {column = 4, order = 'ascending' }, {column = 6, order = 'ascending'}},
|
||||
},
|
||||
[FULL] = {
|
||||
name = 'Full',
|
||||
@@ -267,14 +287,24 @@ public.views = {
|
||||
end,
|
||||
on_row_enter = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info, 0, 20)
|
||||
Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_CURSOR', 0, 30)
|
||||
end,
|
||||
on_row_leave = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
AuxTooltip:Hide()
|
||||
ResetCursor()
|
||||
end,
|
||||
on_row_update = function(sheet, row_index)
|
||||
if IsControlKeyDown() then
|
||||
ShowInspectCursor()
|
||||
elseif IsAltKeyDown() then
|
||||
SetCursor('BUY_CURSOR')
|
||||
else
|
||||
ResetCursor()
|
||||
end
|
||||
end,
|
||||
row_setter = function(row, datum)
|
||||
row.tooltip = datum.tooltip
|
||||
row.itemstring = Aux.info.itemstring(datum.item_id, datum.suffix_id, datum.unique_id, datum.enchant_id)
|
||||
row.EnhTooltip_info = datum.EnhTooltip_info
|
||||
end,
|
||||
columns = {
|
||||
@@ -297,8 +327,6 @@ public.views = {
|
||||
icon:SetPoint('LEFT', cell)
|
||||
icon:SetWidth(12)
|
||||
icon:SetHeight(12)
|
||||
icon:SetScript('OnEnter', function() Aux.info.set_game_tooltip(this, cell.tooltip, 'ANCHOR_CURSOR', cell.EnhTooltip_info, 0, 30) end)
|
||||
icon:SetScript('OnLeave', function() AuxTooltip:Hide() end)
|
||||
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
|
||||
text:SetPoint("LEFT", icon, "RIGHT", 1, 0)
|
||||
text:SetPoint('TOPRIGHT', cell)
|
||||
@@ -310,7 +338,7 @@ public.views = {
|
||||
cell.icon = icon
|
||||
end,
|
||||
cell_setter = function(cell, datum)
|
||||
cell.icon.icon_texture:SetTexture(datum.texture)
|
||||
cell.icon.icon_texture:SetTexture(Aux.info.item(datum.item_id).texture)
|
||||
if not datum.usable then
|
||||
cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
|
||||
else
|
||||
@@ -324,7 +352,7 @@ public.views = {
|
||||
},
|
||||
{
|
||||
title = 'Lvl',
|
||||
width = 23,
|
||||
width = 25,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.level, row2.level, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
@@ -341,11 +369,11 @@ public.views = {
|
||||
},
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 23,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.stack_size, row2.stack_size, Aux.util.LT) end,
|
||||
width = 25,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.aux_quantity, row2.aux_quantity, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.stack_size)
|
||||
cell.text:SetText(datum.aux_quantity)
|
||||
auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
@@ -421,7 +449,7 @@ public.views = {
|
||||
},
|
||||
{
|
||||
title = 'Owner',
|
||||
width = 70,
|
||||
width = 90,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.owner, row2.owner, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('LEFT'),
|
||||
cell_setter = function(cell, datum)
|
||||
@@ -430,7 +458,7 @@ public.views = {
|
||||
end,
|
||||
},
|
||||
},
|
||||
sort_order = {},
|
||||
sort_order = {{column = 1, order = 'ascending' }},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -447,7 +475,7 @@ function public.on_open()
|
||||
end
|
||||
|
||||
function public.dialog_cancel()
|
||||
Aux.log('Canceled.')
|
||||
Aux.log('Aborted.')
|
||||
Aux.scan.abort()
|
||||
AuxFilterSearchFrameResultsConfirmation:Hide()
|
||||
update_sheet()
|
||||
@@ -466,7 +494,7 @@ function update_sheet()
|
||||
if private.view == BUYOUT then
|
||||
AuxFilterSearchFrameResultsBuyListing:Show()
|
||||
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(AuxFilterSearchFrameResultsBuyListing.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 {})
|
||||
Aux.list.populate(AuxFilterSearchFrameResultsBuyListing.sheet, auctions and Aux.util.group_by(buyout_auctions, function(a1, a2) return a1.item_id == a2.item_id and a1.suffix_id == a2.suffix_id and a1.enchant_id == a2.enchant_id and a1.aux_quantity == a2.aux_quantity and a1.buyout_price == a2.buyout_price end) or {})
|
||||
AuxFilterSearchFrameResults:SetWidth(AuxFilterSearchFrameResultsBuyListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxFilterSearchFrameFilters:GetWidth() + AuxFilterSearchFrameResults:GetWidth() + 15)
|
||||
elseif private.view == BID then
|
||||
@@ -545,14 +573,11 @@ function public.start_search()
|
||||
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)
|
||||
if auction_item then
|
||||
if Aux.info.tooltip_match(tooltip_patterns, auction_item.tooltip) then
|
||||
auctions = auctions or {}
|
||||
tinsert(auctions, create_auction_record(auction_item, current_page))
|
||||
end
|
||||
end
|
||||
on_read_auction = function(auction_info)
|
||||
if Aux.info.tooltip_match(tooltip_patterns, auction_info.tooltip) then
|
||||
auctions = auctions or {}
|
||||
tinsert(auctions, create_auction_record(auction_info, current_page))
|
||||
end
|
||||
end,
|
||||
on_complete = function()
|
||||
auctions = auctions or {}
|
||||
@@ -581,17 +606,18 @@ function public.start_search()
|
||||
end
|
||||
|
||||
function show_dialog(buyout_mode, entry, amount)
|
||||
AuxFilterSearchFrameResultsConfirmationContentItem.tooltip = entry.tooltip
|
||||
AuxFilterSearchFrameResultsConfirmationContentItem.itemstring = Aux.info.itemstring(entry.item_id, entry.suffix_id, entry.unique_id, entry.enchant_id)
|
||||
AuxFilterSearchFrameResultsConfirmationContentItem.EnhTooltip_info = entry.EnhTooltip_info
|
||||
|
||||
AuxFilterSearchFrameResultsConfirmationContentActionButton:Disable()
|
||||
AuxFilterSearchFrameResultsConfirmationContentItemIconTexture:SetTexture(entry.texture)
|
||||
AuxFilterSearchFrameResultsConfirmationContentItemIconTexture:SetTexture(Aux.info.item(entry.item_id).texture)
|
||||
|
||||
AuxFilterSearchFrameResultsConfirmationContentItemName:SetText(entry.tooltip[1][1].text)
|
||||
local color = ITEM_QUALITY_COLORS[entry.quality]
|
||||
AuxFilterSearchFrameResultsConfirmationContentItemName:SetTextColor(color.r, color.g, color.b)
|
||||
|
||||
if entry.stack_size > 1 then
|
||||
AuxFilterSearchFrameResultsConfirmationContentItemCount:SetText(entry.stack_size);
|
||||
if entry.aux_quantity > 1 then
|
||||
AuxFilterSearchFrameResultsConfirmationContentItemCount:SetText(entry.aux_quantity);
|
||||
AuxFilterSearchFrameResultsConfirmationContentItemCount:Show()
|
||||
else
|
||||
AuxFilterSearchFrameResultsConfirmationContentItemCount:Hide()
|
||||
@@ -629,7 +655,7 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
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)..' ...')
|
||||
Aux.log('Processing '..(buyout_mode and 'buyout' or 'bid')..' request for '..entry.hyperlink..' x '..entry.aux_quantity..' at '..Aux.util.money_string(amount)..' ...')
|
||||
AuxFilterSearchFrameFiltersSearchButton:Disable()
|
||||
|
||||
if not express_mode then
|
||||
@@ -649,27 +675,19 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
on_page_loaded = function(page)
|
||||
current_page = page
|
||||
end,
|
||||
on_read_auction = function(i, ctrl)
|
||||
local auction_item = Aux.info.auction_item(i)
|
||||
on_read_auction = function(auction_info, ctrl)
|
||||
|
||||
local auction_record = create_auction_record(auction_info)
|
||||
|
||||
if not auction_item then
|
||||
return
|
||||
end
|
||||
|
||||
local stack_size = auction_item.charges or auction_item.count
|
||||
local bid = (auction_item.current_bid > 0 and auction_item.current_bid or auction_item.min_bid) + auction_item.min_increment
|
||||
|
||||
local signature = Aux.auction_signature(auction_item.hyperlink, stack_size, bid, auction_item.buyout_price)
|
||||
|
||||
if entry.signature == signature then
|
||||
if entry.signature == auction_record.signature then
|
||||
ctrl.suspend()
|
||||
found = true
|
||||
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..' at '..Aux.util.money_string(amount)..'.')
|
||||
PlaceAuctionBid('list', auction_info.index, amount)
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(amount)..'.')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
@@ -677,10 +695,10 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
end
|
||||
Aux.scan.abort()
|
||||
else
|
||||
Aux.buy.dialog_action = function()
|
||||
public.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..' at '..Aux.util.money_string(amount)..'.')
|
||||
PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxFilterSearchFrameResultsConfirmationContentBid))
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(amount)..'.')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
@@ -731,45 +749,45 @@ function private.on_row_click(entry)
|
||||
end
|
||||
end
|
||||
|
||||
function create_auction_record(auction_item, current_page)
|
||||
function create_auction_record(auction_info, current_page)
|
||||
|
||||
local stack_size = auction_item.charges or auction_item.count
|
||||
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 aux_quantity = auction_info.charges or auction_info.count
|
||||
local bid = (auction_info.current_bid > 0 and auction_info.current_bid or auction_info.min_bid) + auction_info.min_increment
|
||||
local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
|
||||
local buyout_price_per_unit = buyout_price and Aux_Round(auction_info.buyout_price / aux_quantity)
|
||||
local status
|
||||
if auction_item.current_bid == 0 then
|
||||
if auction_info.current_bid == 0 then
|
||||
status = 'No Bid'
|
||||
elseif auction_item.high_bidder then
|
||||
elseif auction_info.high_bidder then
|
||||
status = GREEN_FONT_COLOR_CODE..'Your Bid'..FONT_COLOR_CODE_CLOSE
|
||||
else
|
||||
status = 'Other Bidder'
|
||||
end
|
||||
|
||||
return {
|
||||
key = auction_item.item_signature,
|
||||
signature = Aux.auction_signature(auction_item.hyperlink, stack_size, bid, auction_item.buyout_price),
|
||||
item_id = auction_info.item_id,
|
||||
key = auction_info.item_signature,
|
||||
signature = Aux.auction_signature(auction_info.hyperlink, aux_quantity, bid, auction_info.buyout_price),
|
||||
|
||||
name = auction_item.name,
|
||||
level = auction_item.level,
|
||||
texture = auction_item.texture,
|
||||
tooltip = auction_item.tooltip,
|
||||
stack_size = stack_size,
|
||||
name = auction_info.name,
|
||||
level = auction_info.level,
|
||||
tooltip = auction_info.tooltip,
|
||||
aux_quantity = aux_quantity,
|
||||
buyout_price = buyout_price,
|
||||
buyout_price_per_unit = buyout_price_per_unit,
|
||||
quality = auction_item.quality,
|
||||
hyperlink = auction_item.hyperlink,
|
||||
itemstring = auction_item.itemstring,
|
||||
quality = auction_info.quality,
|
||||
hyperlink = auction_info.hyperlink,
|
||||
itemstring = auction_info.itemstring,
|
||||
page = current_page,
|
||||
bid = bid,
|
||||
bid_per_unit = Aux_Round(bid/stack_size),
|
||||
owner = auction_item.owner,
|
||||
duration = auction_item.duration,
|
||||
usable = auction_item.usable,
|
||||
high_bidder = auction_item.high_bidder,
|
||||
bid_per_unit = Aux_Round(bid / aux_quantity),
|
||||
owner = auction_info.owner,
|
||||
duration = auction_info.duration,
|
||||
usable = auction_info.usable,
|
||||
high_bidder = auction_info.high_bidder,
|
||||
status = status,
|
||||
|
||||
EnhTooltip_info = auction_item.EnhTooltip_info,
|
||||
EnhTooltip_info = auction_info.EnhTooltip_info,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -300,7 +300,7 @@
|
||||
<OnLoad>
|
||||
local config = Aux.filter_search_frame.views[1]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
@@ -313,7 +313,7 @@
|
||||
<OnLoad>
|
||||
local config = Aux.filter_search_frame.views[2]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
@@ -326,7 +326,7 @@
|
||||
<OnLoad>
|
||||
local config = Aux.filter_search_frame.views[3]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
@@ -340,14 +340,14 @@
|
||||
</Scripts>
|
||||
<Frames>
|
||||
<Frame name="$parentContent">
|
||||
<Anchors><Anchor point="CENTER"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Size><AbsDimension x="193" y="140"/></Size>
|
||||
<Anchors><Anchor point="CENTER"><Offset><AbsDimension x="0" y="5"/></Offset></Anchor></Anchors>
|
||||
<Size><AbsDimension x="193" y="120"/></Size>
|
||||
<Frames>
|
||||
<Frame name="$parentItem" inherits="AuxItemTemplate">
|
||||
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
</Frame>
|
||||
<Frame name="$parentBid" inherits="MoneyInputFrameTemplate">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="48"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="43"/></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontNormal" text="Price:" justifyH="RIGHT">
|
||||
@@ -357,7 +357,7 @@
|
||||
</Layers>
|
||||
</Frame>
|
||||
<Frame name="$parentBuyoutPrice" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="50"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="45"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad()
|
||||
|
||||
@@ -3,57 +3,70 @@ local TOOLTIP_LENGTH = 30
|
||||
local private, public = {}, {}
|
||||
Aux.info = public
|
||||
|
||||
local hyperlink_item, item_id, item_charges, item_signature, parse_item_signature, parse_hyperlink
|
||||
|
||||
function Aux.info.container_item(bag, slot)
|
||||
function public.container_item(bag, slot)
|
||||
local hyperlink = GetContainerItemLink(bag, slot)
|
||||
|
||||
if not hyperlink then
|
||||
return
|
||||
end
|
||||
|
||||
local container_item = hyperlink_item(hyperlink)
|
||||
container_item.item_signature = item_signature(hyperlink)
|
||||
end
|
||||
|
||||
local item_id, suffix_id, unique_id, enchant_id = private.parse_hyperlink(hyperlink)
|
||||
local item_info = public.item(item_id, suffix_id, unique_id, enchant_id)
|
||||
|
||||
local texture, count, locked, quality, readable, lootable = GetContainerItemInfo(bag, slot)
|
||||
container_item.texture = texture
|
||||
container_item.count = count
|
||||
container_item.locked = locked
|
||||
container_item.readable = readable
|
||||
container_item.lootable = lootable
|
||||
container_item.hyperlink = hyperlink
|
||||
local tooltip = public.tooltip(function(tt) tt:SetBagItem(bag, slot) end)
|
||||
|
||||
container_item.tooltip = Aux.info.tooltip(function(tt) tt:SetBagItem(bag, slot) end)
|
||||
container_item.charges = item_charges(container_item.tooltip)
|
||||
|
||||
return container_item
|
||||
return {
|
||||
item_id = item_id,
|
||||
suffix_id = suffix_id,
|
||||
unique_id = unique_id,
|
||||
enchant_id = enchant_id,
|
||||
|
||||
hyperlink = hyperlink,
|
||||
itemstring = item_info.itemstring,
|
||||
item_key = item_id..':'..suffix_id,
|
||||
|
||||
name = item_info.name,
|
||||
texture = texture,
|
||||
level = item_info.level,
|
||||
type = item_info.type,
|
||||
subtype = item_info.subtype,
|
||||
quality = quality,
|
||||
max_stack = item_info.max_stack,
|
||||
|
||||
count = count,
|
||||
locked = locked,
|
||||
readable = readable,
|
||||
lootable = lootable,
|
||||
|
||||
tooltip = tooltip,
|
||||
charges = private.item_charges(tooltip),
|
||||
}
|
||||
end
|
||||
|
||||
function Aux.info.auction_sell_item()
|
||||
function public.auction_sell_item()
|
||||
local name, texture, stack_size, quality, usable, vendor_price = GetAuctionSellItemInfo()
|
||||
|
||||
if name then
|
||||
|
||||
local unit_vendor_price = vendor_price / stack_size
|
||||
local tooltip = public.tooltip(function(tt) tt:SetAuctionSellItem() end)
|
||||
|
||||
auction_sell_item = {
|
||||
return {
|
||||
name = name,
|
||||
texture = texture,
|
||||
quality = quality,
|
||||
|
||||
stack_size = stack_size,
|
||||
quality = quality,
|
||||
usable = usable,
|
||||
unit_vendor_price = unit_vendor_price,
|
||||
deposit_factor = deposit_factor,
|
||||
tooltip = tooltip,
|
||||
charges = private.item_charges(tooltip),
|
||||
}
|
||||
|
||||
auction_sell_item.tooltip = Aux.info.tooltip(function(tt) tt:SetAuctionSellItem() end)
|
||||
auction_sell_item.charges = item_charges(auction_sell_item.tooltip)
|
||||
|
||||
return auction_sell_item
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.info.auction_item(index, type)
|
||||
function public.auction(index, type)
|
||||
type = type or 'list'
|
||||
|
||||
local hyperlink = GetAuctionItemLink(type, index)
|
||||
@@ -61,36 +74,54 @@ function Aux.info.auction_item(index, type)
|
||||
if not hyperlink then
|
||||
return
|
||||
end
|
||||
|
||||
local auction_item = hyperlink_item(hyperlink)
|
||||
auction_item.item_signature = item_signature(hyperlink)
|
||||
|
||||
local name, texture, count, quality, usable, level, min_bid, min_increment, buyout_price, current_bid, high_bidder, owner, sale_status, id = GetAuctionItemInfo(type, index)
|
||||
local duration = GetAuctionItemTimeLeft(type, index)
|
||||
|
||||
auction_item.texture = texture
|
||||
auction_item.count = count
|
||||
auction_item.min_bid = min_bid
|
||||
auction_item.min_increment = min_increment
|
||||
auction_item.buyout_price = buyout_price
|
||||
auction_item.current_bid = current_bid
|
||||
auction_item.high_bidder = high_bidder
|
||||
auction_item.owner = owner
|
||||
auction_item.sale_status = sale_status
|
||||
auction_item.id = id
|
||||
auction_item.duration = duration
|
||||
auction_item.usable = usable
|
||||
auction_item.tooltip = Aux.info.tooltip(function(tt) tt:SetAuctionItem(type, index) end)
|
||||
auction_item.charges = item_charges(auction_item.tooltip)
|
||||
|
||||
auction_item.EnhTooltip_info = {
|
||||
name = auction_item.name,
|
||||
hyperlink = auction_item.hyperlink,
|
||||
quality = auction_item.quality,
|
||||
count = auction_item.count,
|
||||
}
|
||||
|
||||
return auction_item
|
||||
local item_id, suffix_id, unique_id, enchant_id = private.parse_hyperlink(hyperlink)
|
||||
local item_info = public.item(item_id, suffix_id, unique_id, enchant_id)
|
||||
|
||||
local name, texture, count, quality, usable, level, min_bid, min_increment, buyout_price, current_bid, high_bidder, owner, sale_status = GetAuctionItemInfo(type, index)
|
||||
local duration = GetAuctionItemTimeLeft(type, index)
|
||||
local tooltip = public.tooltip(function(tt) tt:SetAuctionItem(type, index) end)
|
||||
|
||||
return {
|
||||
index = index,
|
||||
|
||||
item_id = item_id,
|
||||
suffix_id = suffix_id,
|
||||
unique_id = unique_id,
|
||||
enchant_id = enchant_id,
|
||||
|
||||
hyperlink = hyperlink,
|
||||
itemstring = item_info.itemstring,
|
||||
item_key = item_id..':'..suffix_id,
|
||||
|
||||
name = name,
|
||||
texture = texture,
|
||||
level = item_info.level,
|
||||
type = item_info.type,
|
||||
subtype = item_info.subtype,
|
||||
quality = quality,
|
||||
max_stack = item_info.max_stack,
|
||||
|
||||
count = count,
|
||||
min_bid = min_bid,
|
||||
min_increment = min_increment,
|
||||
buyout_price = buyout_price,
|
||||
current_bid = current_bid,
|
||||
high_bidder = high_bidder,
|
||||
owner = owner,
|
||||
sale_status = sale_status,
|
||||
duration = duration,
|
||||
usable = usable,
|
||||
tooltip = tooltip,
|
||||
charges = private.item_charges(tooltip),
|
||||
|
||||
EnhTooltip_info = {
|
||||
name = name,
|
||||
hyperlink = hyperlink,
|
||||
quality = quality,
|
||||
count = count,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
||||
function public.reanchor_tooltip()
|
||||
@@ -102,7 +133,7 @@ function public.reanchor_tooltip()
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.info.set_game_tooltip(owner, tooltip, anchor, EnhTooltip_info, x_offset, y_offset)
|
||||
function public.set_tooltip(itemstring, EnhTooltip_info, owner, anchor, x_offset, y_offset)
|
||||
if anchor == 'ANCHOR_CURSOR' and (x_offset or y_offset) then
|
||||
private.anchor_cursor = true
|
||||
private.x_offset = x_offset
|
||||
@@ -112,16 +143,16 @@ function Aux.info.set_game_tooltip(owner, tooltip, anchor, EnhTooltip_info, x_of
|
||||
private.anchor_cursor = false
|
||||
end
|
||||
AuxTooltip:SetOwner(owner, anchor)
|
||||
for _, line in ipairs(tooltip) do
|
||||
AuxTooltip:AddDoubleLine(line[1].text, line[2].text, line[1].r, line[1].b, line[1].g, line[2].r, line[2].b, line[2].g, true)
|
||||
end
|
||||
|
||||
AuxTooltip:SetHyperlink(itemstring)
|
||||
|
||||
AuxTooltip:Show()
|
||||
if EnhTooltip and EnhTooltip_info then
|
||||
EnhTooltip.TooltipCAux(AuxTooltip, EnhTooltip_info.name, EnhTooltip_info.hyperlink, EnhTooltip_info.quality, EnhTooltip_info.count)
|
||||
EnhTooltip.TooltipCall(AuxTooltip, EnhTooltip_info.name, EnhTooltip_info.hyperlink, EnhTooltip_info.quality, EnhTooltip_info.count)
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.info.tooltip_match(patterns, tooltip)
|
||||
function public.tooltip_match(patterns, tooltip)
|
||||
return Aux.util.all(patterns, function(pattern)
|
||||
return Aux.util.any(tooltip, function(line)
|
||||
local left_match = line[1].text and strfind(strupper(line[1].text), strupper(pattern), 1, true)
|
||||
@@ -131,7 +162,7 @@ function Aux.info.tooltip_match(patterns, tooltip)
|
||||
end)
|
||||
end
|
||||
|
||||
function Aux.info.tooltip(setter)
|
||||
function public.tooltip(setter)
|
||||
for i = 1, TOOLTIP_LENGTH do
|
||||
getglobal('AuxInfoTooltipTextLeft'..i):SetText()
|
||||
getglobal('AuxInfoTooltipTextRight'..i):SetText()
|
||||
@@ -162,7 +193,7 @@ function Aux.info.tooltip(setter)
|
||||
return tooltip
|
||||
end
|
||||
|
||||
function item_charges(tooltip)
|
||||
function private.item_charges(tooltip)
|
||||
for _, line in ipairs(tooltip) do
|
||||
local _, _, left_charges_string = strfind(line[1].text or '', "^(%d+) Charges")
|
||||
local _, _, right_charges_string = strfind(line[2].text or '', "^(%d+) Charges$")
|
||||
@@ -171,33 +202,27 @@ function item_charges(tooltip)
|
||||
return charges
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.info.auction(args)
|
||||
local index = tremove(args, 1)
|
||||
|
||||
local key_set = Aux.util.array_to_set(args)
|
||||
end
|
||||
|
||||
-- not unique!
|
||||
function Aux.info.auction_signature(index)
|
||||
function public.auction_signature(index)
|
||||
-- owner not used because waiting for it would slow down the scan too much
|
||||
local _, _, count, _, _, _, min_bid, _, buyout_price, _, _, owner = GetAuctionItemInfo('list', index)
|
||||
local hyperlink = GetAuctionItemLink('list', index)
|
||||
local item_id, suffix_id, enchant_id, unique_id = parse_hyperlink(hyperlink)
|
||||
local item_id, suffix_id, unique_id, enchant_id = private.parse_hyperlink(hyperlink)
|
||||
return string.format(
|
||||
'%s:%s:%s:%s:%s:%s:%s',
|
||||
item_id or 0,
|
||||
suffix_id or 0,
|
||||
enchant_id or 0,
|
||||
unique_id or 0,
|
||||
enchant_id or 0,
|
||||
count or 0,
|
||||
min_bid or 0,
|
||||
buyout_price or 0
|
||||
)
|
||||
end
|
||||
|
||||
function Aux.info.break_auction_signature(signature)
|
||||
function public.break_auction_signature(signature)
|
||||
local parts = strfind(signature, '^(%d+):(%d+):(%d+):(%d+):(%d+):(%d+):(%d+)$')
|
||||
for i=1,2 do
|
||||
tremove(parts, 1)
|
||||
@@ -205,36 +230,32 @@ function Aux.info.break_auction_signature(signature)
|
||||
return unpack(parts)
|
||||
end
|
||||
|
||||
function item_signature(hyperlink)
|
||||
local item_id, suffix_id = parse_hyperlink(hyperlink)
|
||||
function public.item_key(hyperlink)
|
||||
local item_id, suffix_id = private.parse_hyperlink(hyperlink)
|
||||
return item_id..':'..suffix_id
|
||||
end
|
||||
|
||||
function parse_item_signature(item_signature)
|
||||
local _, _, item_id, suffix_id = strfind(item_signature, '^(%d+):(%d+)$')
|
||||
return item_id, suffix_id
|
||||
end
|
||||
|
||||
function item_id(hyperlink)
|
||||
local _, _, id_string = strfind(hyperlink, "^.-:(%d*).*")
|
||||
return tonumber(id_string)
|
||||
end
|
||||
|
||||
function parse_hyperlink(hyperlink)
|
||||
function private.parse_hyperlink(hyperlink)
|
||||
local _, _, item_id, enchant_id, suffix_id, unique_id, name = strfind(hyperlink, '|Hitem:(%d+):(%d+):(%d+):(%d+)|h[[]([^]]+)[]]|h')
|
||||
return tonumber(item_id) or 0, tonumber(suffix_id) or 0, tonumber(enchant_id) or 0, tonumber(unique_id) or 0, name
|
||||
return tonumber(item_id) or 0, tonumber(suffix_id) or 0, tonumber(unique_id) or 0, tonumber(enchant_id) or 0, name
|
||||
end
|
||||
|
||||
function hyperlink_item(hyperlink)
|
||||
local name, itemstring, quality, level, type, subtype, max_stack = GetItemInfo(item_id(hyperlink))
|
||||
return {
|
||||
name = name,
|
||||
hyperlink = hyperlink,
|
||||
itemstring = itemstring,
|
||||
quality = quality,
|
||||
level = level,
|
||||
type = type,
|
||||
subtype = subtype,
|
||||
max_stack = max_stack,
|
||||
}
|
||||
function public.itemstring(item_id, suffix_id, unique_id, enchant_id)
|
||||
return 'item:'..(item_id or 0)..':'..(enchant_id or 0)..':'..(suffix_id or 0)..':'..(unique_id or 0)
|
||||
end
|
||||
|
||||
function public.item(item_id, suffix_id, unique_id, enchant_id)
|
||||
local itemstring = 'item:'..(item_id or 0)..':'..(enchant_id or 0)..':'..(suffix_id or 0)..':'..(unique_id or 0)
|
||||
local name, itemstring, quality, level, class, subclass, max_stack, slot, texture = GetItemInfo(itemstring)
|
||||
return {
|
||||
itemstring = itemstring,
|
||||
name = name,
|
||||
texture = texture,
|
||||
quality = quality,
|
||||
level = level,
|
||||
slot = slot,
|
||||
class = class,
|
||||
subclass = subclass,
|
||||
max_stack = max_stack,
|
||||
}
|
||||
end
|
||||
|
||||
+134
-104
@@ -1,13 +1,13 @@
|
||||
local private, public = {}, {}
|
||||
Aux.item_search_frame = public
|
||||
|
||||
aux_recently_searched = {}
|
||||
|
||||
local create_auction_record, show_dialog, find_auction, hide_sheet, update_listing, auction_alpha_setter, group_alpha_setter, create_auction_record
|
||||
local auctions
|
||||
local search_query
|
||||
local tooltip_patterns = {}
|
||||
local current_page
|
||||
local refresh
|
||||
local recently_searched = {}
|
||||
|
||||
function auction_alpha_setter(cell, auction)
|
||||
cell:SetAlpha(auction.gone and 0.3 or 1)
|
||||
@@ -22,12 +22,13 @@ local BUYOUT, BID, FULL = 1, 2, 3
|
||||
public.recently_searched_config = {
|
||||
on_row_click = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
AuxItemSearchFrameItemItemInputBox:Hide()
|
||||
public.set_item(sheet.data[data_index].item_id)
|
||||
end,
|
||||
on_row_enter = function (sheet, row_index)
|
||||
on_row_enter = function(sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
end,
|
||||
on_row_leave = function (sheet, row_index)
|
||||
on_row_leave = function(sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
end,
|
||||
columns = {
|
||||
@@ -63,10 +64,10 @@ public.recently_searched_config = {
|
||||
cell.icon = icon
|
||||
end,
|
||||
cell_setter = function(cell, datum)
|
||||
local info = { GetItemInfo(datum.item_id) }
|
||||
cell.icon.icon_texture:SetTexture(info[9])
|
||||
cell.text:SetText('['..info[1]..']')
|
||||
local color = ITEM_QUALITY_COLORS[info[3]]
|
||||
local item_info = Aux.info.item(datum.item_id)
|
||||
cell.icon.icon_texture:SetTexture(item_info.texture)
|
||||
cell.text:SetText('['..item_info.name..']')
|
||||
local color = ITEM_QUALITY_COLORS[item_info.quality]
|
||||
cell.text:SetTextColor(color.r, color.g, color.b)
|
||||
end,
|
||||
},
|
||||
@@ -82,24 +83,34 @@ public.views = {
|
||||
end,
|
||||
on_row_enter = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info, 0, 30)
|
||||
Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_CURSOR', 0, 30)
|
||||
end,
|
||||
on_row_leave = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
AuxTooltip:Hide()
|
||||
ResetCursor()
|
||||
end,
|
||||
on_row_update = function(sheet, row_index)
|
||||
if IsControlKeyDown() then
|
||||
ShowInspectCursor()
|
||||
elseif IsAltKeyDown() then
|
||||
SetCursor('BUY_CURSOR')
|
||||
else
|
||||
ResetCursor()
|
||||
end
|
||||
end,
|
||||
row_setter = function(row, group)
|
||||
row.tooltip = group[1].tooltip
|
||||
row.itemstring = Aux.info.itemstring(group[1].item_id, group[1].suffix_id, nil, group[1].enchant_id)
|
||||
row.EnhTooltip_info = group[1].EnhTooltip_info
|
||||
end,
|
||||
columns = {
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 23,
|
||||
comparator = function(group1, group2) return Aux.util.compare(group1[1].stack_size, group2[1].stack_size, Aux.util.LT) end,
|
||||
width = 25,
|
||||
comparator = function(group1, group2) return Aux.util.compare(group1[1].aux_quantity, group2[1].aux_quantity, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, group)
|
||||
cell.text:SetText(group[1].stack_size)
|
||||
cell.text:SetText(group[1].aux_quantity)
|
||||
group_alpha_setter(cell, group)
|
||||
end,
|
||||
},
|
||||
@@ -144,24 +155,34 @@ public.views = {
|
||||
end,
|
||||
on_row_enter = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info, 0, 30)
|
||||
Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_CURSOR', 0, 30)
|
||||
end,
|
||||
on_row_leave = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
AuxTooltip:Hide()
|
||||
ResetCursor()
|
||||
end,
|
||||
on_row_update = function(sheet, row_index)
|
||||
if IsControlKeyDown() then
|
||||
ShowInspectCursor()
|
||||
elseif IsAltKeyDown() then
|
||||
SetCursor('BUY_CURSOR')
|
||||
else
|
||||
ResetCursor()
|
||||
end
|
||||
end,
|
||||
row_setter = function(row, datum)
|
||||
row.tooltip = datum.tooltip
|
||||
row.itemstring = Aux.info.itemstring(datum.item_id, datum.suffix_id, datum.unique_id, datum.enchant_id)
|
||||
row.EnhTooltip_info = datum.EnhTooltip_info
|
||||
end,
|
||||
columns = {
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 23,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.stack_size, row2.stack_size, Aux.util.LT) end,
|
||||
width = 25,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.aux_quantity, row2.aux_quantity, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.stack_size)
|
||||
cell.text:SetText(datum.aux_quantity)
|
||||
auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
@@ -226,7 +247,7 @@ public.views = {
|
||||
end,
|
||||
},
|
||||
},
|
||||
sort_order = {{column = 2, order = 'ascending' }, {column = 6, order = 'ascending' }, {column = 3, order = 'ascending'}},
|
||||
sort_order = {{column = 3, order = 'ascending'}, {column = 5, order = 'ascending'}},
|
||||
},
|
||||
[FULL] = {
|
||||
name = 'Full',
|
||||
@@ -236,24 +257,34 @@ public.views = {
|
||||
end,
|
||||
on_row_enter = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(.5)
|
||||
Aux.info.set_game_tooltip(this, sheet.rows[row_index].tooltip, 'ANCHOR_CURSOR', sheet.rows[row_index].EnhTooltip_info, 0, 30)
|
||||
Aux.info.set_tooltip(sheet.rows[row_index].itemstring, sheet.rows[row_index].EnhTooltip_info, this, 'ANCHOR_CURSOR', 0, 30)
|
||||
end,
|
||||
on_row_leave = function (sheet, row_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
AuxTooltip:Hide()
|
||||
ResetCursor()
|
||||
end,
|
||||
on_row_update = function(sheet, row_index)
|
||||
if IsControlKeyDown() then
|
||||
ShowInspectCursor()
|
||||
elseif IsAltKeyDown() then
|
||||
SetCursor('BUY_CURSOR')
|
||||
else
|
||||
ResetCursor()
|
||||
end
|
||||
end,
|
||||
row_setter = function(row, datum)
|
||||
row.tooltip = datum.tooltip
|
||||
row.itemstring = Aux.info.itemstring(datum.item_id, datum.suffix_id, datum.unique_id, datum.enchant_id)
|
||||
row.EnhTooltip_info = datum.EnhTooltip_info
|
||||
end,
|
||||
columns = {
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 23,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.stack_size, row2.stack_size, Aux.util.LT) end,
|
||||
width = 25,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.aux_quantity, row2.aux_quantity, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.stack_size)
|
||||
cell.text:SetText(datum.aux_quantity)
|
||||
auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
@@ -299,7 +330,7 @@ public.views = {
|
||||
},
|
||||
{
|
||||
title = 'Lvl',
|
||||
width = 23,
|
||||
width = 25,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.level, row2.level, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
@@ -346,7 +377,7 @@ public.views = {
|
||||
},
|
||||
{
|
||||
title = 'Owner',
|
||||
width = 70,
|
||||
width = 90,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.owner, row2.owner, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('LEFT'),
|
||||
cell_setter = function(cell, datum)
|
||||
@@ -381,14 +412,17 @@ function public.on_open()
|
||||
public.update_item()
|
||||
private.update_recently_searched()
|
||||
update_listing()
|
||||
if not private.item_id then
|
||||
AuxItemSearchFrameItemRefreshButton:Disable()
|
||||
end
|
||||
end
|
||||
|
||||
function public.dialog_cancel()
|
||||
Aux.log('Canceled.')
|
||||
Aux.log('Aborted.')
|
||||
Aux.scan.abort()
|
||||
AuxItemSearchFrameAuctionsConfirmation:Hide()
|
||||
update_listing()
|
||||
AuxItemSearchFrameItemSearchButton:Enable()
|
||||
AuxItemSearchFrameItemRefreshButton:Enable()
|
||||
end
|
||||
|
||||
function public.stop_search()
|
||||
@@ -403,7 +437,7 @@ function update_listing()
|
||||
if private.view == BUYOUT then
|
||||
AuxItemSearchFrameAuctionsBuyListing:Show()
|
||||
local buy_records = auctions and Aux.util.filter(auctions, function(auction) return auction.owner ~= UnitName('player') and auction.buyout_price end) or {}
|
||||
Aux.list.populate(AuxItemSearchFrameAuctionsBuyListing.sheet, auctions and Aux.util.group_by(buy_records, function(a1, a2) return a1.hyperlink == a2.hyperlink and a1.stack_size == a2.stack_size and a1.buyout_price == a2.buyout_price end) or {})
|
||||
Aux.list.populate(AuxItemSearchFrameAuctionsBuyListing.sheet, auctions and Aux.util.group_by(buy_records, function(a1, a2) return a1.item_id == a2.item_id and a1.suffix_id == a2.suffix_id and a1.enchant_id == a2.enchant_id and a1.aux_quantity == a2.aux_quantity and a1.buyout_price == a2.buyout_price end) or {})
|
||||
AuxItemSearchFrameAuctions:SetWidth(AuxItemSearchFrameAuctionsBuyListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxItemSearchFrameItem:GetWidth() + AuxItemSearchFrameAuctions:GetWidth() + 15)
|
||||
elseif private.view == BID then
|
||||
@@ -435,14 +469,18 @@ function public.set_view(view)
|
||||
end
|
||||
|
||||
function private.update_recently_searched()
|
||||
Aux.list.populate(AuxItemSearchFrameRecentlySearchedListing.sheet, recently_searched)
|
||||
Aux.list.populate(AuxItemSearchFrameRecentlySearchedListing.sheet, aux_recently_searched)
|
||||
end
|
||||
|
||||
function public.set_item(item_id)
|
||||
if item_id ~= private.item_id then
|
||||
AuxItemSearchFrameItemRefreshButton:Enable()
|
||||
private.item_id = item_id
|
||||
public.update_item()
|
||||
tinsert(recently_searched, 1, { item_id=item_id, time=time() })
|
||||
tinsert(aux_recently_searched, 1, { item_id=item_id, time=time() })
|
||||
while getn(aux_recently_searched) > 50 do
|
||||
tremove(aux_recently_searched, getn(aux_recently_searched))
|
||||
end
|
||||
private.update_recently_searched()
|
||||
public.start_search()
|
||||
end
|
||||
@@ -464,28 +502,32 @@ end
|
||||
|
||||
function public.start_search()
|
||||
|
||||
if not AuxItemSearchFrameItemSearchButton:IsVisible() then
|
||||
if not AuxItemSearchFrameItemRefreshButton:IsVisible() then
|
||||
return
|
||||
end
|
||||
|
||||
AuxItemSearchFrameItemSearchButton:Hide()
|
||||
AuxItemSearchFrameItemRefreshButton:Hide()
|
||||
AuxItemSearchFrameItemStopButton:Show()
|
||||
|
||||
auctions = nil
|
||||
|
||||
refresh = true
|
||||
|
||||
local name = GetItemInfo(private.item_id)
|
||||
|
||||
local item_id = private.item_id
|
||||
local item_info = Aux.info.item(item_id)
|
||||
|
||||
local class_index = Aux.item_class_index(item_info.class)
|
||||
local subclass_index = Aux.item_subclass_index(class_index, item_info.subclass)
|
||||
|
||||
search_query = {
|
||||
name = name,
|
||||
-- min_level = AuxBuyMinLevel:GetText(),
|
||||
-- max_level = AuxBuyMaxLevel:GetText(),
|
||||
-- slot = category and category.slot,
|
||||
-- class = category and category.class,
|
||||
-- subclass = category and category.subclass,
|
||||
-- quality = UIDropDownMenu_GetSelectedValue(AuxBuyQualityDropDown),
|
||||
-- usable = AuxBuyUsableCheckButton:GetChecked()
|
||||
name = item_info.name,
|
||||
min_level = item_info.level,
|
||||
min_level = item_info.level,
|
||||
slot = item_info.slot,
|
||||
class = Aux.item_class_index(item_info.class),
|
||||
subclass = item_info.subclass,
|
||||
quality = item_info.quality,
|
||||
usable = item_info.usable,
|
||||
}
|
||||
|
||||
Aux.log('Scanning auctions ...')
|
||||
@@ -499,28 +541,25 @@ function public.start_search()
|
||||
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)
|
||||
if auction_item then
|
||||
if auction_item.name == search_query.name then
|
||||
auctions = auctions or {}
|
||||
tinsert(auctions, create_auction_record(auction_item, current_page))
|
||||
end
|
||||
end
|
||||
on_read_auction = function(auction_info)
|
||||
if auction_info.item_id == item_id then
|
||||
auctions = auctions or {}
|
||||
tinsert(auctions, create_auction_record(auction_info, current_page))
|
||||
end
|
||||
end,
|
||||
on_complete = function()
|
||||
auctions = auctions or {}
|
||||
Aux.log('Scan complete: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
|
||||
|
||||
AuxItemSearchFrameItemStopButton:Hide()
|
||||
AuxItemSearchFrameItemSearchButton:Show()
|
||||
AuxItemSearchFrameItemRefreshButton:Show()
|
||||
refresh = true
|
||||
end,
|
||||
on_abort = function()
|
||||
auctions = auctions or {}
|
||||
Aux.log('Scan aborted: '..getn(auctions)..' '..Aux_PluralizeIf('auction', getn(auctions))..' found.')
|
||||
AuxItemSearchFrameItemStopButton:Hide()
|
||||
AuxItemSearchFrameItemSearchButton:Show()
|
||||
AuxItemSearchFrameItemRefreshButton:Show()
|
||||
refresh = true
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
@@ -535,17 +574,17 @@ function public.start_search()
|
||||
end
|
||||
|
||||
function show_dialog(buyout_mode, entry, amount)
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItem.tooltip = entry.tooltip
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItem.itemstring = Aux.info.itemstring(entry.item_id, entry.suffix_id, entry.unique_id, entry.enchant_id)
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItem.EnhTooltip_info = entry.EnhTooltip_info
|
||||
|
||||
AuxItemSearchFrameAuctionsConfirmationContentActionButton:Disable()
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItemIconTexture:SetTexture(entry.texture)
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItemName:SetText(entry.tooltip[1][1].text)
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItemIconTexture:SetTexture(Aux.info.item(entry.item_id).texture)
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItemName:SetText(entry.name)
|
||||
local color = ITEM_QUALITY_COLORS[entry.quality]
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItemName:SetTextColor(color.r, color.g, color.b)
|
||||
|
||||
if entry.stack_size > 1 then
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItemCount:SetText(entry.stack_size);
|
||||
if entry.aux_quantity > 1 then
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItemCount:SetText(entry.aux_quantity);
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItemCount:Show()
|
||||
else
|
||||
AuxItemSearchFrameAuctionsConfirmationContentItemCount:Hide()
|
||||
@@ -583,8 +622,8 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
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)..' ...')
|
||||
AuxItemSearchFrameItemSearchButton:Disable()
|
||||
Aux.log('Processing '..(buyout_mode and 'buyout' or 'bid')..' request for '..entry.hyperlink..' x '..entry.aux_quantity..' at '..Aux.util.money_string(amount)..' ...')
|
||||
AuxItemSearchFrameItemRefreshButton:Disable()
|
||||
|
||||
if not express_mode then
|
||||
show_dialog(buyout_mode, entry, amount)
|
||||
@@ -603,27 +642,17 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
on_page_loaded = function(page)
|
||||
current_page = page
|
||||
end,
|
||||
on_read_auction = function(i, ctrl)
|
||||
local auction_item = Aux.info.auction_item(i)
|
||||
|
||||
if not auction_item then
|
||||
return
|
||||
end
|
||||
|
||||
local stack_size = auction_item.charges or auction_item.count
|
||||
local bid = (auction_item.current_bid > 0 and auction_item.current_bid or auction_item.min_bid) + auction_item.min_increment
|
||||
|
||||
local signature = Aux.auction_signature(auction_item.hyperlink, stack_size, bid, auction_item.buyout_price)
|
||||
|
||||
if entry.signature == signature then
|
||||
on_read_auction = function(auction_info, ctrl)
|
||||
local auction_record = create_auction_record(auction_info)
|
||||
if entry.signature == auction_record.signature then
|
||||
ctrl.suspend()
|
||||
found = true
|
||||
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..' at '..Aux.util.money_string(amount)..'.')
|
||||
PlaceAuctionBid('list', auction_info.index, amount)
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(amount)..'.')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
@@ -631,17 +660,17 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
end
|
||||
Aux.scan.abort()
|
||||
else
|
||||
Aux.buy.dialog_action = function()
|
||||
public.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..' at '..Aux.util.money_string(amount)..'.')
|
||||
PlaceAuctionBid('list', auction_info.index, buyout_mode and amount or MoneyInputFrame_GetCopper(AuxItemSearchFrameAuctionsConfirmationContentBid))
|
||||
Aux.log((buyout_mode and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(amount)..'.')
|
||||
entry.gone = true
|
||||
refresh = true
|
||||
else
|
||||
Aux.log('Not enough money.')
|
||||
end
|
||||
Aux.scan.abort()
|
||||
AuxItemSearchFrameItemSearchButton:Enable()
|
||||
AuxItemSearchFrameItemRefreshButton:Enable()
|
||||
AuxItemSearchFrameAuctionsConfirmation:Hide()
|
||||
update_listing()
|
||||
end
|
||||
@@ -657,12 +686,12 @@ function find_auction(entry, buyout_mode, express_mode)
|
||||
public.dialog_cancel()
|
||||
end
|
||||
if express_mode then
|
||||
AuxItemSearchFrameItemSearchButton:Enable()
|
||||
AuxItemSearchFrameItemRefreshButton:Enable()
|
||||
end
|
||||
end,
|
||||
on_abort = function()
|
||||
if express_mode then
|
||||
AuxItemSearchFrameItemSearchButton:Enable()
|
||||
AuxItemSearchFrameItemRefreshButton:Enable()
|
||||
end
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
@@ -685,45 +714,46 @@ function public.on_row_click(entry)
|
||||
end
|
||||
end
|
||||
|
||||
function create_auction_record(auction_item, current_page)
|
||||
function create_auction_record(auction_info, current_page)
|
||||
|
||||
local stack_size = auction_item.charges or auction_item.count
|
||||
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 aux_quantity = auction_info.charges or auction_info.count
|
||||
local bid = (auction_info.current_bid > 0 and auction_info.current_bid or auction_info.min_bid) + auction_info.min_increment
|
||||
local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
|
||||
local buyout_price_per_unit = buyout_price and Aux_Round(auction_info.buyout_price / aux_quantity)
|
||||
local status
|
||||
if auction_item.current_bid == 0 then
|
||||
if auction_info.current_bid == 0 then
|
||||
status = 'No Bid'
|
||||
elseif auction_item.high_bidder then
|
||||
elseif auction_info.high_bidder then
|
||||
status = GREEN_FONT_COLOR_CODE..'Your Bid'..FONT_COLOR_CODE_CLOSE
|
||||
else
|
||||
status = 'Other Bidder'
|
||||
end
|
||||
|
||||
return {
|
||||
key = auction_item.item_signature,
|
||||
signature = Aux.auction_signature(auction_item.hyperlink, stack_size, bid, auction_item.buyout_price),
|
||||
item_id = auction_info.item_id,
|
||||
suffix_id = auction_info.suffix_id,
|
||||
unique_id = auction_info.unique_id,
|
||||
enchant_id = auction_info.enchant_id,
|
||||
|
||||
name = auction_item.name,
|
||||
level = auction_item.level,
|
||||
texture = auction_item.texture,
|
||||
tooltip = auction_item.tooltip,
|
||||
stack_size = stack_size,
|
||||
signature = Aux.auction_signature(auction_info.hyperlink, aux_quantity, bid, auction_info.buyout_price),
|
||||
|
||||
name = auction_info.name,
|
||||
level = auction_info.level,
|
||||
aux_quantity = aux_quantity,
|
||||
buyout_price = buyout_price,
|
||||
buyout_price_per_unit = buyout_price_per_unit,
|
||||
quality = auction_item.quality,
|
||||
hyperlink = auction_item.hyperlink,
|
||||
itemstring = auction_item.itemstring,
|
||||
quality = auction_info.quality,
|
||||
hyperlink = auction_info.hyperlink,
|
||||
page = current_page,
|
||||
bid = bid,
|
||||
bid_per_unit = Aux_Round(bid/stack_size),
|
||||
owner = auction_item.owner,
|
||||
duration = auction_item.duration,
|
||||
usable = auction_item.usable,
|
||||
high_bidder = auction_item.high_bidder,
|
||||
bid_per_unit = Aux_Round(bid/aux_quantity),
|
||||
owner = auction_info.owner,
|
||||
duration = auction_info.duration,
|
||||
usable = auction_info.usable,
|
||||
high_bidder = auction_info.high_bidder,
|
||||
status = status,
|
||||
|
||||
EnhTooltip_info = auction_item.EnhTooltip_info,
|
||||
EnhTooltip_info = auction_info.EnhTooltip_info,
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
|
||||
<Button name="$parentSearchButton" inherits="UIPanelButtonTemplate" text="Refresh">
|
||||
<Button name="$parentRefreshButton" inherits="UIPanelButtonTemplate" text="Refresh" disabled="true">
|
||||
<Size><AbsDimension x="90" y="26"/></Size>
|
||||
<Anchors><Anchor point="BOTTOMLEFT" ><Offset><AbsDimension x="8" y="15"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
@@ -230,7 +230,7 @@
|
||||
<OnLoad>
|
||||
local config = Aux.item_search_frame.views[1]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
@@ -243,7 +243,7 @@
|
||||
<OnLoad>
|
||||
local config = Aux.item_search_frame.views[2]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
@@ -256,7 +256,7 @@
|
||||
<OnLoad>
|
||||
local config = Aux.item_search_frame.views[3]
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
@@ -270,14 +270,14 @@
|
||||
</Scripts>
|
||||
<Frames>
|
||||
<Frame name="$parentContent">
|
||||
<Anchors><Anchor point="CENTER"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Size><AbsDimension x="193" y="140"/></Size>
|
||||
<Anchors><Anchor point="CENTER"><Offset><AbsDimension x="0" y="5"/></Offset></Anchor></Anchors>
|
||||
<Size><AbsDimension x="193" y="120"/></Size>
|
||||
<Frames>
|
||||
<Frame name="$parentItem" inherits="AuxItemTemplate">
|
||||
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
</Frame>
|
||||
<Frame name="$parentBid" inherits="MoneyInputFrameTemplate">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="48"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="43"/></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontNormal" text="Price:" justifyH="RIGHT">
|
||||
@@ -287,7 +287,7 @@
|
||||
</Layers>
|
||||
</Frame>
|
||||
<Frame name="$parentBuyoutPrice" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="50"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="45"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad()
|
||||
|
||||
@@ -66,7 +66,7 @@ function Aux.sheet.render(sheet)
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click, on_row_enter, on_row_leave)
|
||||
function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click, on_row_enter, on_row_leave, on_row_update)
|
||||
local sheet
|
||||
local name = (frame:GetName() or '')..'ScrollSheet'
|
||||
|
||||
@@ -162,9 +162,10 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
|
||||
row:SetHeight(14)
|
||||
|
||||
local row_idx = row_index
|
||||
row:SetScript("OnClick", function() if sheet.on_row_click then sheet.on_row_click(sheet, row_idx) end end)
|
||||
row:SetScript("OnEnter", function() if sheet.on_row_enter then sheet.on_row_enter(sheet, row_idx) end end)
|
||||
row:SetScript("OnLeave", function() if sheet.on_row_leave then sheet.on_row_leave(sheet, row_idx) end end)
|
||||
row:SetScript('OnClick', function() if sheet.on_row_click then sheet.on_row_click(sheet, row_idx) end end)
|
||||
row:SetScript('OnEnter', function() if sheet.on_row_enter then sheet.on_row_enter(sheet, row_idx) end end)
|
||||
row:SetScript('OnLeave', function() if sheet.on_row_leave then sheet.on_row_leave(sheet, row_idx) end end)
|
||||
row:SetScript('OnUpdate', function() if sheet.on_row_update then sheet.on_row_update(sheet, row_idx) end end)
|
||||
|
||||
row.cells = {}
|
||||
for i = 1,getn(columns) do
|
||||
@@ -213,6 +214,7 @@ function Aux.sheet.create(frame, columns, sort_order, row_setter, on_row_click,
|
||||
on_row_click = on_row_click,
|
||||
on_row_enter = on_row_enter,
|
||||
on_row_leave = on_row_leave,
|
||||
on_row_update = on_row_update,
|
||||
}
|
||||
scroll_frame.sheet = sheet
|
||||
|
||||
|
||||
+271
-89
@@ -10,7 +10,7 @@ local BIDS, AUCTIONS = 1, 2
|
||||
public.bid_listing_config = {
|
||||
on_row_click = function(sheet, row_index, column_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
AuxBuyEntry_OnClick(sheet.data[data_index])
|
||||
public.on_bid_click(sheet.data[data_index])
|
||||
end,
|
||||
|
||||
on_row_enter = function(sheet, row_index, column_index)
|
||||
@@ -19,18 +19,19 @@ public.bid_listing_config = {
|
||||
|
||||
on_row_leave = function(sheet, row_index, column_index)
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
ResetCursor()
|
||||
end,
|
||||
on_row_update = function(sheet, row_index)
|
||||
if IsControlKeyDown() then
|
||||
ShowInspectCursor()
|
||||
elseif IsAltKeyDown() then
|
||||
SetCursor('BUY_CURSOR')
|
||||
else
|
||||
ResetCursor()
|
||||
end
|
||||
end,
|
||||
|
||||
columns = {
|
||||
{
|
||||
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'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.stack_size)
|
||||
private.auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Auction Item',
|
||||
width = 157,
|
||||
@@ -50,8 +51,6 @@ public.bid_listing_config = {
|
||||
icon:SetPoint('LEFT', cell)
|
||||
icon:SetWidth(12)
|
||||
icon:SetHeight(12)
|
||||
icon:SetScript('OnEnter', function() Aux.info.set_game_tooltip(this, cell.tooltip, 'ANCHOR_CURSOR', cell.EnhTooltip_info) end)
|
||||
icon:SetScript('OnLeave', function() AuxTooltip:Hide() end)
|
||||
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
|
||||
text:SetPoint("LEFT", icon, "RIGHT", 1, 0)
|
||||
text:SetPoint('TOPRIGHT', cell)
|
||||
@@ -63,9 +62,7 @@ public.bid_listing_config = {
|
||||
cell.icon = icon
|
||||
end,
|
||||
cell_setter = function(cell, datum)
|
||||
cell.tooltip = datum.tooltip
|
||||
cell.EnhTooltip_info = datum.EnhTooltip_info
|
||||
cell.icon.icon_texture:SetTexture(datum.texture)
|
||||
cell.icon.icon_texture:SetTexture(Aux.info.item(datum.item_id).texture)
|
||||
if not datum.usable then
|
||||
cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
|
||||
else
|
||||
@@ -77,6 +74,26 @@ public.bid_listing_config = {
|
||||
private.auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 25,
|
||||
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'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.aux_quantity)
|
||||
private.auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
{
|
||||
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.status)
|
||||
private.auction_alpha_setter(cell, auction)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Left',
|
||||
width = 30,
|
||||
@@ -99,7 +116,7 @@ public.bid_listing_config = {
|
||||
},
|
||||
{
|
||||
title = 'Owner',
|
||||
width = 70,
|
||||
width = 90,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.owner, row2.owner, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('LEFT'),
|
||||
cell_setter = function(cell, datum)
|
||||
@@ -108,18 +125,18 @@ public.bid_listing_config = {
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Bid',
|
||||
width = 70,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.bid, row2.bid, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(Aux.util.money_string(datum.bid))
|
||||
private.auction_alpha_setter(cell, datum)
|
||||
title = 'Your Bid',
|
||||
width = 90,
|
||||
comparator = function(auction1, auction2) return Aux.util.compare(auction1.current_bid, auction2.current_bid, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||
cell_setter = function(cell, auction)
|
||||
cell.text:SetText(Aux.util.money_string(auction.current_bid))
|
||||
private.auction_alpha_setter(cell, auction)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Buy',
|
||||
width = 70,
|
||||
width = 90,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.buyout_price, row2.buyout_price, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
@@ -128,13 +145,13 @@ public.bid_listing_config = {
|
||||
end,
|
||||
},
|
||||
},
|
||||
sort_order = {},
|
||||
sort_order = {{ column = 1, order = 'ascending' }},
|
||||
}
|
||||
|
||||
public.auction_listing_config = {
|
||||
on_row_click = function (sheet, row_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
AuxBuyEntry_OnClick(sheet.data[data_index])
|
||||
public.on_auction_click(sheet.data[data_index])
|
||||
end,
|
||||
|
||||
on_row_enter = function (sheet, row_index)
|
||||
@@ -145,16 +162,6 @@ public.auction_listing_config = {
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
end,
|
||||
columns = {
|
||||
{
|
||||
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'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.stack_size)
|
||||
private.auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Auction Item',
|
||||
width = 157,
|
||||
@@ -174,8 +181,6 @@ public.auction_listing_config = {
|
||||
icon:SetPoint('LEFT', cell)
|
||||
icon:SetWidth(12)
|
||||
icon:SetHeight(12)
|
||||
icon:SetScript('OnEnter', function() Aux.info.set_game_tooltip(this, cell.tooltip, 'ANCHOR_CURSOR', cell.EnhTooltip_info) end)
|
||||
icon:SetScript('OnLeave', function() AuxTooltip:Hide() end)
|
||||
local text = cell:CreateFontString(nil, 'OVERLAY', 'GameFontHighlightSmall')
|
||||
text:SetPoint("LEFT", icon, "RIGHT", 1, 0)
|
||||
text:SetPoint('TOPRIGHT', cell)
|
||||
@@ -187,9 +192,7 @@ public.auction_listing_config = {
|
||||
cell.icon = icon
|
||||
end,
|
||||
cell_setter = function(cell, datum)
|
||||
cell.tooltip = datum.tooltip
|
||||
cell.EnhTooltip_info = datum.EnhTooltip_info
|
||||
cell.icon.icon_texture:SetTexture(datum.texture)
|
||||
cell.icon.icon_texture:SetTexture(Aux.info.item(datum.item_id).texture)
|
||||
if not datum.usable then
|
||||
cell.icon.icon_texture:SetVertexColor(1.0, 0.1, 0.1)
|
||||
else
|
||||
@@ -201,6 +204,16 @@ public.auction_listing_config = {
|
||||
private.auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 25,
|
||||
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'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(datum.aux_quantity)
|
||||
private.auction_alpha_setter(cell, datum)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Left',
|
||||
width = 30,
|
||||
@@ -222,18 +235,28 @@ public.auction_listing_config = {
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Bid',
|
||||
width = 70,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.bid, row2.bid, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
cell.text:SetText(Aux.util.money_string(datum.bid))
|
||||
private.auction_alpha_setter(cell, datum)
|
||||
title = 'Current Bid',
|
||||
width = 90,
|
||||
comparator = function(auction1, auction2) return Aux.util.compare(auction1.current_bid, auction2.current_bid, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||
cell_setter = function(cell, auction)
|
||||
cell.text:SetText(auction.current_bid and Aux.util.money_string(auction.current_bid) or RED_FONT_COLOR_CODE..'No Bids'..FONT_COLOR_CODE_CLOSE)
|
||||
private.auction_alpha_setter(cell, auction)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Min Bid',
|
||||
width = 90,
|
||||
comparator = function(auction1, auction2) return Aux.util.compare(auction1.min_bid, auction2.min_bid, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('CENTER'),
|
||||
cell_setter = function(cell, auction)
|
||||
cell.text:SetText(Aux.util.money_string(auction.min_bid))
|
||||
private.auction_alpha_setter(cell, auction)
|
||||
end,
|
||||
},
|
||||
{
|
||||
title = 'Buy',
|
||||
width = 70,
|
||||
width = 90,
|
||||
comparator = function(row1, row2) return Aux.util.compare(row1.buyout_price, row2.buyout_price, Aux.util.GT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
@@ -242,7 +265,7 @@ public.auction_listing_config = {
|
||||
end,
|
||||
},
|
||||
},
|
||||
sort_order = {},
|
||||
sort_order = {{ column = 1, order = 'ascending' }},
|
||||
}
|
||||
|
||||
function public.on_open()
|
||||
@@ -272,8 +295,8 @@ function public.update_bid_records()
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning bid page '..(page+1)..' out of '..total_pages..' ...')
|
||||
end,
|
||||
on_read_auction = function(i)
|
||||
private.create_bid_record(i)
|
||||
on_read_auction = function(auction_info)
|
||||
private.create_bid_record(auction_info)
|
||||
end,
|
||||
on_complete = function()
|
||||
Aux.log('Scan complete: '..getn(bid_records)..' bids found')
|
||||
@@ -298,8 +321,8 @@ function public.update_auction_records()
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning auction page '..(page+1)..' out of '..total_pages..' ...')
|
||||
end,
|
||||
on_read_auction = function(i)
|
||||
private.create_auction_record(i)
|
||||
on_read_auction = function(auction_info)
|
||||
private.create_auction_record(auction_info)
|
||||
end,
|
||||
on_complete = function()
|
||||
Aux.log('Scan complete: '..getn(auction_records)..' auctions found')
|
||||
@@ -337,59 +360,218 @@ function public.update_listing()
|
||||
end
|
||||
end
|
||||
|
||||
function private.create_record(auction_item)
|
||||
function private.create_record(auction_info)
|
||||
|
||||
local aux_quantity = auction_info.charges or auction_info.count
|
||||
local bid = (auction_info.current_bid > 0 and auction_info.current_bid or auction_info.min_bid) + auction_info.min_increment
|
||||
local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
|
||||
local buyout_price_per_unit = buyout_price and Aux_Round(auction_info.buyout_price / aux_quantity)
|
||||
|
||||
local stack_size = auction_item.charges or auction_item.count
|
||||
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
|
||||
if auction_info.high_bidder then
|
||||
status = GREEN_FONT_COLOR_CODE..'High Bidder'..FONT_COLOR_CODE_CLOSE
|
||||
else
|
||||
status = RED_FONT_COLOR_CODE..'Other Bidder'..FONT_COLOR_CODE_CLOSE
|
||||
status = RED_FONT_COLOR_CODE..'Outbid'..FONT_COLOR_CODE_CLOSE
|
||||
end
|
||||
|
||||
return {
|
||||
key = auction_item.item_signature,
|
||||
signature = Aux.auction_signature(auction_item.hyperlink, stack_size, bid, auction_item.buyout_price),
|
||||
item_id = auction_info.item_id,
|
||||
key = auction_info.item_signature,
|
||||
signature = Aux.auction_signature(auction_info.hyperlink, aux_quantity, bid, auction_info.buyout_price),
|
||||
|
||||
name = auction_item.name,
|
||||
level = auction_item.level,
|
||||
texture = auction_item.texture,
|
||||
tooltip = auction_item.tooltip,
|
||||
stack_size = stack_size,
|
||||
name = auction_info.name,
|
||||
level = auction_info.level,
|
||||
tooltip = auction_info.tooltip,
|
||||
aux_quantity = aux_quantity,
|
||||
buyout_price = buyout_price,
|
||||
buyout_price_per_unit = buyout_price_per_unit,
|
||||
quality = auction_item.quality,
|
||||
hyperlink = auction_item.hyperlink,
|
||||
itemstring = auction_item.itemstring,
|
||||
quality = auction_info.quality,
|
||||
hyperlink = auction_info.hyperlink,
|
||||
itemstring = auction_info.itemstring,
|
||||
bid = bid,
|
||||
bid_per_unit = Aux_Round(bid/stack_size),
|
||||
owner = auction_item.owner,
|
||||
duration = auction_item.duration,
|
||||
usable = auction_item.usable,
|
||||
high_bidder = auction_item.high_bidder,
|
||||
bid_per_unit = Aux_Round(bid / aux_quantity),
|
||||
owner = auction_info.owner,
|
||||
duration = auction_info.duration,
|
||||
usable = auction_info.usable,
|
||||
high_bidder = auction_info.high_bidder,
|
||||
current_bid = auction_info.current_bid > 0 and auction_info.current_bid or nil,
|
||||
min_bid = auction_info.min_bid,
|
||||
status = status,
|
||||
|
||||
EnhTooltip_info = auction_item.EnhTooltip_info,
|
||||
EnhTooltip_info = auction_info.EnhTooltip_info,
|
||||
}
|
||||
end
|
||||
|
||||
function private.create_auction_record(index)
|
||||
local auction_item = Aux.info.auction_item(index, 'owner')
|
||||
if auction_item then
|
||||
tinsert(auction_records, private.create_record(auction_item))
|
||||
function private.create_auction_record(auction_info)
|
||||
tinsert(auction_records, private.create_record(auction_info))
|
||||
end
|
||||
|
||||
function private.create_bid_record(auction_info)
|
||||
tinsert(bid_records, private.create_record(auction_info))
|
||||
end
|
||||
|
||||
function public.dialog_cancel()
|
||||
Aux.log('Aborted.')
|
||||
Aux.scan.abort()
|
||||
AuxManageFrameListingDialog:Hide()
|
||||
public.update_listing()
|
||||
end
|
||||
|
||||
function private.find_auction(entry, action, express_mode)
|
||||
|
||||
if entry.gone then
|
||||
Aux.log('Auction not available')
|
||||
return
|
||||
end
|
||||
|
||||
if action == 'buyout' and not entry.buyout_price then
|
||||
Aux.log('Auction has no buyout price')
|
||||
return
|
||||
end
|
||||
|
||||
local amount
|
||||
if action == 'buyout' then
|
||||
amount = entry.buyout_price
|
||||
elseif action == 'bid' then
|
||||
amount = entry.bid
|
||||
end
|
||||
|
||||
Aux.log('Processing '..action..' request for '..entry.hyperlink..' x '..entry.aux_quantity..' at '..Aux.util.money_string(amount)..' ...')
|
||||
|
||||
if not express_mode then
|
||||
private.show_dialog(action, entry, amount)
|
||||
end
|
||||
|
||||
PlaySound('igMainMenuOptionCheckBoxOn')
|
||||
|
||||
local found
|
||||
|
||||
Aux.scan.start{
|
||||
type = action == 'cancel' and 'owner' or 'bidder',
|
||||
page = entry.page,
|
||||
on_read_auction = function(auction_info, ctrl)
|
||||
|
||||
local auction_record = private.create_record(auction_info)
|
||||
|
||||
if entry.signature == auction_record.signature then
|
||||
ctrl.suspend()
|
||||
found = true
|
||||
Aux.log('Matching auction found.'..(express_mode and '' or ' Awaiting confirmation ...'))
|
||||
|
||||
if express_mode then
|
||||
if action == 'cancel' then
|
||||
CancelAuction(auction_info.index)
|
||||
entry.gone = true
|
||||
Aux.log('Canceled'..auction_record.hyperlink..' x '..auction_record.aux_quantity)
|
||||
elseif GetMoney() >= amount then
|
||||
PlaceAuctionBid('bidder', auction_info.index, amount)
|
||||
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(amount)..'.')
|
||||
entry.gone = true
|
||||
else
|
||||
Aux.log((action == 'buyout' and 'Purchase' or 'Bid')..' failed: Not enough money.')
|
||||
end
|
||||
Aux.scan.abort()
|
||||
else
|
||||
public.dialog_action = function()
|
||||
if action == 'cancel' then
|
||||
CancelAuction(auction_info.index)
|
||||
entry.gone = true
|
||||
Aux.log('Canceled'..auction_record.hyperlink..' x '..auction_record.aux_quantity)
|
||||
elseif GetMoney() >= amount then
|
||||
PlaceAuctionBid('bidder', auction_info.index, action == 'bid' and MoneyInputFrame_GetCopper(AuxManageFrameListingDialogContentBid) or amount)
|
||||
Aux.log((action == 'buyout' and 'Purchased ' or 'Bid on ')..auction_record.hyperlink..' x '..auction_record.aux_quantity..' at '..Aux.util.money_string(amount)..'.')
|
||||
entry.gone = true
|
||||
else
|
||||
Aux.log('Not enough money.')
|
||||
end
|
||||
Aux.scan.abort()
|
||||
AuxManageFrameListingDialog:Hide()
|
||||
public.update_listing()
|
||||
end
|
||||
AuxManageFrameListingDialogContentActionButton:Enable()
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_complete = function()
|
||||
if not found then
|
||||
Aux.log('No matching auction found. Removing entry from the cache.')
|
||||
entry.gone = true
|
||||
public.dialog_cancel()
|
||||
end
|
||||
end,
|
||||
on_abort = function()
|
||||
public.update_listing()
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
if not page or page == entry.page then
|
||||
return entry.page - 1
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
function public.on_auction_click(auction_record)
|
||||
|
||||
local express_mode = IsAltKeyDown()
|
||||
|
||||
if IsControlKeyDown() then
|
||||
DressUpItemLink(auction_record.hyperlink)
|
||||
else
|
||||
private.find_auction(auction_record, 'cancel', express_mode)
|
||||
end
|
||||
end
|
||||
|
||||
function private.create_bid_record(index)
|
||||
local auction_item = Aux.info.auction_item(index, 'bidder')
|
||||
if auction_item then
|
||||
tinsert(bid_records, private.create_record(auction_item))
|
||||
function public.on_bid_click(bid_record)
|
||||
|
||||
local express_mode = IsAltKeyDown()
|
||||
local action = arg1 == 'LeftButton' and 'buyout' or 'bid'
|
||||
|
||||
if IsControlKeyDown() then
|
||||
DressUpItemLink(bid_record.hyperlink)
|
||||
else
|
||||
private.find_auction(bid_record, action, express_mode)
|
||||
end
|
||||
end
|
||||
|
||||
function private.show_dialog(action, entry, amount)
|
||||
AuxManageFrameListingDialogContentItem.itemstring = Aux.info.itemstring(entry.item_id, entry.suffix_id, entry.unique_id, entry.enchant_id)
|
||||
AuxManageFrameListingDialogContentItem.EnhTooltip_info = entry.EnhTooltip_info
|
||||
|
||||
AuxManageFrameListingDialogContentActionButton:Disable()
|
||||
AuxManageFrameListingDialogContentItemIconTexture:SetTexture(Aux.info.item(entry.item_id).texture)
|
||||
AuxManageFrameListingDialogContentItemName:SetText(entry.name)
|
||||
local color = ITEM_QUALITY_COLORS[entry.quality]
|
||||
AuxManageFrameListingDialogContentItemName:SetTextColor(color.r, color.g, color.b)
|
||||
|
||||
if entry.aux_quantity > 1 then
|
||||
AuxManageFrameListingDialogContentItemCount:SetText(entry.aux_quantity);
|
||||
AuxManageFrameListingDialogContentItemCount:Show()
|
||||
else
|
||||
AuxManageFrameListingDialogContentItemCount:Hide()
|
||||
end
|
||||
|
||||
if action == 'buyout' then
|
||||
AuxManageFrameListingDialogContentActionButton:SetText('Buy')
|
||||
AuxManageFrameListingDialogContentCancelButton:SetText('Cancel')
|
||||
MoneyFrame_Update('AuxManageFrameListingDialogContentBuyoutPrice', amount)
|
||||
AuxManageFrameListingDialogContentBid:Hide()
|
||||
AuxManageFrameListingDialogContentCancelLabel:Hide()
|
||||
AuxManageFrameListingDialogContentBuyoutPrice:Show()
|
||||
elseif action == 'bid' then
|
||||
AuxManageFrameListingDialogContentActionButton:SetText('Bid')
|
||||
AuxManageFrameListingDialogContentCancelButton:SetText('Cancel')
|
||||
MoneyInputFrame_SetCopper(AuxManageFrameListingDialogContentBid, amount)
|
||||
AuxManageFrameListingDialogContentBuyoutPrice:Hide()
|
||||
AuxManageFrameListingDialogContentCancelLabel:Hide()
|
||||
AuxManageFrameListingDialogContentBid:Show()
|
||||
elseif action == 'cancel' then
|
||||
AuxManageFrameListingDialogContentBid:Hide()
|
||||
AuxManageFrameListingDialogContentBuyoutPrice:Hide()
|
||||
AuxManageFrameListingDialogContentCancelLabel:Show()
|
||||
AuxManageFrameListingDialogContentActionButton:SetText('Yes')
|
||||
AuxManageFrameListingDialogContentCancelButton:SetText('No')
|
||||
end
|
||||
AuxManageFrameListingDialog:Show()
|
||||
end
|
||||
|
||||
|
||||
|
||||
+18
-75
@@ -63,74 +63,10 @@
|
||||
<OnLoad>
|
||||
local config = Aux.manage_frame.bid_listing_config
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Frame name="$parentBidConfirmation" frameStrata="FULLSCREEN_DIALOG" inherits="OptionFrameBoxTemplate" enableMouse="true" enableMouseWheel="true" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
<Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnMouseWheel></OnMouseWheel>
|
||||
</Scripts>
|
||||
<Frames>
|
||||
<Frame name="$parentContent">
|
||||
<Anchors><Anchor point="CENTER"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Size><AbsDimension x="193" y="300"/></Size>
|
||||
<Frames>
|
||||
<Frame name="$parentItem" inherits="AuxItemTemplate">
|
||||
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
</Frame>
|
||||
<Frame name="$parentBid" inherits="MoneyInputFrameTemplate">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="148"/></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontNormal" text="Price:" justifyH="RIGHT">
|
||||
<Anchors><Anchor point="RIGHT" relativePoint="LEFT"><Offset><AbsDimension x="-10" y="0"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</Frame>
|
||||
<Frame name="$parentBuyoutPrice" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="150"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad()
|
||||
MoneyFrame_SetType("STATIC")
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontNormal" text="Price:" justifyH="RIGHT">
|
||||
<Anchors><Anchor point="RIGHT" relativePoint="LEFT"><Offset><AbsDimension x="-5" y="0"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</Frame>
|
||||
<Button name="$parentActionButton" inherits="UIPanelButtonTemplate" text="Buy" disabled="true">
|
||||
<Size><AbsDimension x="90" y="26"/> </Size>
|
||||
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="229" y="110"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.buy.dialog_action()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Button name="$parentCancelButton" inherits="UIPanelButtonTemplate" text="Cancel">
|
||||
<Size><AbsDimension x="90" y="26"/></Size>
|
||||
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="-229" y="110"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.buy.dialog_cancel()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
<Frame name="$parentAuctionListing">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
@@ -140,11 +76,11 @@
|
||||
<OnLoad>
|
||||
local config = Aux.manage_frame.auction_listing_config
|
||||
local sort_order = Aux.util.map(config.sort_order, function(column_order) return { column = config.columns[column_order.column], sort_ascending = column_order.order == 'ascending' } end)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave)
|
||||
this.sheet = Aux.sheet.create(this, config.columns, sort_order, config.row_setter, config.on_row_click, config.on_row_enter, config.on_row_leave, config.on_row_update)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Frame name="$parentAuctionConfirmation" frameStrata="FULLSCREEN_DIALOG" inherits="OptionFrameBoxTemplate" enableMouse="true" enableMouseWheel="true" hidden="true">
|
||||
<Frame name="$parentDialog" frameStrata="FULLSCREEN_DIALOG" inherits="OptionFrameBoxTemplate" enableMouse="true" enableMouseWheel="true" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
<Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor>
|
||||
@@ -154,14 +90,21 @@
|
||||
</Scripts>
|
||||
<Frames>
|
||||
<Frame name="$parentContent">
|
||||
<Anchors><Anchor point="CENTER"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Size><AbsDimension x="193" y="300"/></Size>
|
||||
<Anchors><Anchor point="CENTER"><Offset><AbsDimension x="0" y="5"/></Offset></Anchor></Anchors>
|
||||
<Size><AbsDimension x="193" y="120"/></Size>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString name="$parentCancelLabel" inherits="GameFontNormal" text="Cancel this auction?" justifyH="RIGHT">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="0" y="45"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<Frame name="$parentItem" inherits="AuxItemTemplate">
|
||||
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
</Frame>
|
||||
<Frame name="$parentBid" inherits="MoneyInputFrameTemplate">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="148"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="43"/></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontNormal" text="Price:" justifyH="RIGHT">
|
||||
@@ -171,7 +114,7 @@
|
||||
</Layers>
|
||||
</Frame>
|
||||
<Frame name="$parentBuyoutPrice" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="150"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="BOTTOM"><Offset><AbsDimension x="30" y="45"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad()
|
||||
@@ -188,19 +131,19 @@
|
||||
</Frame>
|
||||
<Button name="$parentActionButton" inherits="UIPanelButtonTemplate" text="Buy" disabled="true">
|
||||
<Size><AbsDimension x="90" y="26"/> </Size>
|
||||
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="229" y="110"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.buy.dialog_action()
|
||||
Aux.manage_frame.dialog_action()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Button name="$parentCancelButton" inherits="UIPanelButtonTemplate" text="Cancel">
|
||||
<Size><AbsDimension x="90" y="26"/></Size>
|
||||
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="-229" y="110"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.buy.dialog_cancel()
|
||||
Aux.manage_frame.dialog_cancel()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
Aux.post = {
|
||||
orig = {}
|
||||
}
|
||||
local private, public = {}, {}
|
||||
Aux.post = public
|
||||
|
||||
local controller = (function()
|
||||
local controller
|
||||
@@ -20,7 +19,7 @@ function process()
|
||||
local stack_slot
|
||||
|
||||
Aux.stack.start(
|
||||
state.name,
|
||||
state.item_key,
|
||||
state.stack_size,
|
||||
function(slot)
|
||||
stacking_complete = true
|
||||
@@ -43,7 +42,7 @@ function process()
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.post.stop(k)
|
||||
function public.stop(k)
|
||||
Aux.control.on_next_update(function()
|
||||
stop()
|
||||
|
||||
@@ -78,7 +77,7 @@ function post_auction(slot, k)
|
||||
controller().wait(function() return not GetContainerItemInfo(slot.bag, slot.bag_slot) end, k)
|
||||
end
|
||||
|
||||
function Aux.post.start(name, stack_size, duration, bid, buyout, count, callback)
|
||||
function public.start(item_key, stack_size, duration, bid, buyout, count, callback)
|
||||
Aux.control.on_next_update(function()
|
||||
stop()
|
||||
|
||||
@@ -87,7 +86,7 @@ function Aux.post.start(name, stack_size, duration, bid, buyout, count, callback
|
||||
ClearCursor()
|
||||
|
||||
state = {
|
||||
name = name,
|
||||
item_key = item_key,
|
||||
stack_size = stack_size,
|
||||
duration = duration,
|
||||
bid = bid,
|
||||
|
||||
+72
-94
@@ -1,6 +1,7 @@
|
||||
Aux.sell = {}
|
||||
local private, public = {}, {}
|
||||
Aux.sell = public
|
||||
|
||||
local auxSellEntries = {}
|
||||
local existing_auctions = {}
|
||||
|
||||
local inventory_data
|
||||
|
||||
@@ -40,7 +41,7 @@ Aux.sell.inventory_listing_config = {
|
||||
columns = {
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 23,
|
||||
width = 25,
|
||||
comparator = function(datum1, datum2) return Aux.util.compare(datum1.aux_quantity, datum2.aux_quantity, Aux.util.LT) end,
|
||||
cell_initializer = Aux.sheet.default_cell_initializer('RIGHT'),
|
||||
cell_setter = function(cell, datum)
|
||||
@@ -100,13 +101,13 @@ Aux.sell.auction_listing_config = {
|
||||
on_cell_leave = function (sheet, row_index, column_index)
|
||||
local data_index = row_index + FauxScrollFrame_GetOffset(sheet.scroll_frame)
|
||||
local datum = sheet.data[data_index]
|
||||
if not (datum and current_auction and Aux.util.safe_index{auxSellEntries, current_auction.name, 'selected', 'key'} == datum.key) then
|
||||
if not (datum and current_auction and Aux.util.safe_index{existing_auctions, current_auction.key, 'selected', 'key'} == datum.key) then
|
||||
sheet.rows[row_index].highlight:SetAlpha(0)
|
||||
end
|
||||
end,
|
||||
|
||||
row_setter = function(row, datum)
|
||||
if datum and current_auction and Aux.util.safe_index{auxSellEntries, current_auction.name, 'selected', 'key'} == datum.key then
|
||||
if datum and current_auction and Aux.util.safe_index{existing_auctions, current_auction.key, 'selected', 'key'} == datum.key then
|
||||
row.highlight:SetAlpha(.5)
|
||||
else
|
||||
row.highlight:SetAlpha(0)
|
||||
@@ -153,11 +154,11 @@ Aux.sell.auction_listing_config = {
|
||||
},
|
||||
{
|
||||
title = 'Qty',
|
||||
width = 23,
|
||||
width = 25,
|
||||
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'),
|
||||
cell_setter = function(cell, row)
|
||||
cell.text:SetText(row.stack_size)
|
||||
cell.text:SetText(row.stack_size == get_stack_size_slider_value() and GREEN_FONT_COLOR_CODE..row.stack_size..FONT_COLOR_CODE_CLOSE or row.stack_size)
|
||||
end,
|
||||
},
|
||||
{
|
||||
@@ -178,11 +179,12 @@ function update_inventory_listing()
|
||||
end
|
||||
|
||||
function update_auction_listing()
|
||||
Aux.list.populate(AuxSellAuctionsListing.sheet, current_auction and auxSellEntries[current_auction.name] or {})
|
||||
Aux.list.populate(AuxSellAuctionsListing.sheet, current_auction and existing_auctions[current_auction.key] or {})
|
||||
end
|
||||
|
||||
function Aux.sell.on_open()
|
||||
MoneyFrame_Update('AuxSellParametersDepositMoneyFrame', 0)
|
||||
AuxSellInventory:SetWidth(AuxSellInventoryListing:GetWidth() + 40)
|
||||
AuxSellAuctions:SetWidth(AuxSellAuctionsListing:GetWidth() + 40)
|
||||
AuxFrame:SetWidth(AuxSellInventory:GetWidth() + AuxSellParameters:GetWidth() + AuxSellAuctions:GetWidth() + 15)
|
||||
|
||||
@@ -247,7 +249,7 @@ end
|
||||
|
||||
function Aux.sell.post_auctions()
|
||||
if current_auction then
|
||||
local name, hyperlink, stack_size, buyout_price, stack_count = current_auction.name, current_auction.hyperlink, get_stack_size_slider_value(), MoneyInputFrame_GetCopper(AuxSellParametersBuyoutPrice), AuxSellStackCountSlider:GetValue()
|
||||
local key, hyperlink, stack_size, buyout_price, stack_count = current_auction.key, current_auction.hyperlink, get_stack_size_slider_value(), MoneyInputFrame_GetCopper(AuxSellParametersBuyoutPrice), AuxSellStackCountSlider:GetValue()
|
||||
local duration
|
||||
if AuctionFrameAuctions.duration == 120 then
|
||||
duration = 2
|
||||
@@ -258,7 +260,7 @@ function Aux.sell.post_auctions()
|
||||
end
|
||||
|
||||
Aux.post.start(
|
||||
name,
|
||||
key,
|
||||
stack_size,
|
||||
AuctionFrameAuctions.duration,
|
||||
MoneyInputFrame_GetCopper(AuxSellParametersStartPrice),
|
||||
@@ -266,12 +268,12 @@ function Aux.sell.post_auctions()
|
||||
stack_count,
|
||||
function(posted)
|
||||
for i = 1, posted do
|
||||
record_auction(name, stack_size, buyout_price, duration, UnitName("player"))
|
||||
record_auction(key, stack_size, buyout_price, duration, UnitName("player"))
|
||||
end
|
||||
if auxSellEntries[name] then
|
||||
for _, entry in ipairs(auxSellEntries[name]) do
|
||||
if existing_auctions[key] then
|
||||
for _, entry in ipairs(existing_auctions[key]) do
|
||||
if entry.buyout_price == buyout_price and entry.stack_size == stack_size then
|
||||
auxSellEntries[name].selected = entry
|
||||
existing_auctions[key].selected = entry
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -285,13 +287,13 @@ function Aux.sell.post_auctions()
|
||||
end
|
||||
|
||||
function select_entry()
|
||||
if current_auction and auxSellEntries[current_auction.name] and not auxSellEntries[current_auction.name].selected then
|
||||
if current_auction and existing_auctions[current_auction.key] and not existing_auctions[current_auction.key].selected then
|
||||
local bestPrice = {} -- a table with one entry per stack_size that is the cheapest auction for that particular stack_size
|
||||
local absoluteBest -- the overall cheapest auction
|
||||
|
||||
----- find the best price per stacksize and overall -----
|
||||
|
||||
for _, auction_datum in ipairs(auxSellEntries[current_auction.name]) do
|
||||
for _, auction_datum in ipairs(existing_auctions[current_auction.key]) do
|
||||
if not bestPrice[auction_datum.stack_size] or bestPrice[auction_datum.stack_size].unit_buyout_price >= auction_datum.unit_buyout_price then
|
||||
bestPrice[auction_datum.stack_size] = auction_datum
|
||||
end
|
||||
@@ -301,10 +303,10 @@ function select_entry()
|
||||
end
|
||||
end
|
||||
|
||||
auxSellEntries[current_auction.name].selected = absoluteBest
|
||||
existing_auctions[current_auction.key].selected = absoluteBest
|
||||
|
||||
if bestPrice[get_stack_size_slider_value()] then
|
||||
auxSellEntries[current_auction.name].selected = bestPrice[get_stack_size_slider_value()]
|
||||
existing_auctions[current_auction.key].selected = bestPrice[get_stack_size_slider_value()]
|
||||
bestPriceOurStackSize = bestPrice[get_stack_size_slider_value()]
|
||||
end
|
||||
end
|
||||
@@ -374,21 +376,21 @@ function update_recommendation()
|
||||
-- TODO neutral AH deposit formula
|
||||
MoneyFrame_Update('AuxSellParametersDepositMoneyFrame', floor(current_auction.unit_vendor_price * 0.05 * (current_auction.charges and 1 or get_stack_size_slider_value())) * AuxSellStackCountSlider:GetValue() * 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
|
||||
if existing_auctions[current_auction.key] and existing_auctions[current_auction.key].selected then
|
||||
if not existing_auctions[current_auction.key].created or GetTime() - existing_auctions[current_auction.key].created > 1800 then
|
||||
AuxSellParametersStrategyDropDownStaleWarning:SetText('Stale data!') -- data older than half an hour marked as stale
|
||||
end
|
||||
|
||||
local new_buyout_price = auxSellEntries[current_auction.name].selected.unit_buyout_price * get_stack_size_slider_value()
|
||||
local new_buyout_price = existing_auctions[current_auction.key].selected.unit_buyout_price * get_stack_size_slider_value()
|
||||
|
||||
if auxSellEntries[current_auction.name].selected.yours == 0 then
|
||||
if existing_auctions[current_auction.key].selected.yours == 0 then
|
||||
new_buyout_price = undercut(new_buyout_price)
|
||||
end
|
||||
|
||||
local new_start_price = new_buyout_price * 0.95
|
||||
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, Aux_Round(new_buyout_price))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, Aux_Round(new_start_price))
|
||||
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersStartPrice, max(1, Aux_Round(new_start_price)))
|
||||
MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, max(1, Aux_Round(new_buyout_price)))
|
||||
-- elseif UIDropDownMenu_GetSelectedValue(AuxSellParametersStrategyDropDown) == HISTORICAL then
|
||||
-- local market_price = Aux.history.get_price_suggestion(current_auction.key, current_auction.aux_quantity)
|
||||
-- MoneyInputFrame_SetCopper(AuxSellParametersBuyoutPrice, Aux_Round(market_price * 0.95))
|
||||
@@ -406,18 +408,15 @@ function Aux.sell.quantity_update()
|
||||
end
|
||||
select_entry()
|
||||
update_recommendation()
|
||||
update_auction_listing()
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function Aux.sell.clear_auction()
|
||||
current_auction = nil
|
||||
select_entry()
|
||||
update_recommendation()
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function set_auction(auction_candidate)
|
||||
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
@@ -436,7 +435,7 @@ function set_auction(auction_candidate)
|
||||
Aux.sell.quantity_update()
|
||||
AuxSellStackCountSlider:SetValue(current_auction.aux_quantity) -- reduced to max possible
|
||||
|
||||
if not auxSellEntries[current_auction.name] then
|
||||
if not existing_auctions[current_auction.key] then
|
||||
refresh_entries()
|
||||
end
|
||||
|
||||
@@ -495,11 +494,15 @@ function update_inventory_data()
|
||||
end)
|
||||
|
||||
if auction_sell_item then
|
||||
if not auction_candidate_map[item_info.item_signature] then
|
||||
if not auction_candidate_map[item_info.item_key] then
|
||||
|
||||
auction_candidate_map[item_info.item_signature] = {
|
||||
key = item_info.item_signature,
|
||||
auction_candidate_map[item_info.item_key] = {
|
||||
item_id = item_info.item_id,
|
||||
suffix_id = item_info.suffix_id,
|
||||
|
||||
key = item_info.item_key,
|
||||
hyperlink = item_info.hyperlink,
|
||||
|
||||
name = item_info.name,
|
||||
texture = item_info.texture,
|
||||
quality = item_info.quality,
|
||||
@@ -512,7 +515,7 @@ function update_inventory_data()
|
||||
availability = { [charge_class]=item_info.count },
|
||||
}
|
||||
else
|
||||
local candidate = auction_candidate_map[item_info.item_signature]
|
||||
local candidate = auction_candidate_map[item_info.item_key]
|
||||
candidate.availability[charge_class] = (candidate.availability[charge_class] or 0) + item_info.count
|
||||
candidate.aux_quantity = candidate.aux_quantity + (item_info.charges or item_info.count)
|
||||
end
|
||||
@@ -537,43 +540,50 @@ end
|
||||
|
||||
function refresh_entries()
|
||||
if current_auction then
|
||||
local name, class, subclass = current_auction.name, current_auction.class, current_auction.subclass
|
||||
|
||||
auxSellEntries[name] = nil
|
||||
|
||||
class, subclass = GetItemInfo(name)
|
||||
local item_id, suffix_id = current_auction.item_id, current_auction.suffix_id
|
||||
local item_key = item_id..':'..suffix_id
|
||||
local item_info = Aux.info.item(item_id, suffix_id)
|
||||
|
||||
-- local class_index = item_class_index(current_auction.class)
|
||||
-- local subclass_index = item_subclass_index(class_index, current_auction.subclass)
|
||||
existing_auctions[item_key] = nil
|
||||
|
||||
|
||||
local class_index = Aux.item_class_index(item_info.class)
|
||||
local subclass_index = Aux.item_subclass_index(class_index, item_info.subclass)
|
||||
|
||||
local search_query = {
|
||||
name = Aux.info.item(item_id).name, -- blizzard doesn't support queries with name suffixes
|
||||
min_level = item_info.level,
|
||||
min_level = item_info.level,
|
||||
slot = item_info.slot,
|
||||
class = class_index,
|
||||
subclass = subclass_index,
|
||||
quality = item_info.quality,
|
||||
usable = item_info.usable,
|
||||
}
|
||||
|
||||
Aux.log('Scanning auctions ...')
|
||||
Aux.scan.start{
|
||||
query = {
|
||||
name = name,
|
||||
class = class_index,
|
||||
subclass = subclass_index,
|
||||
},
|
||||
query = search_query,
|
||||
page = 0,
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning page '..(page + 1)..' out of '..total_pages..' ...')
|
||||
end,
|
||||
on_read_auction = function(i)
|
||||
local auction_item = Aux.info.auction_item(i)
|
||||
if auction_item and auction_item.name == name then
|
||||
local aux_quantity = auction_item.charges or auction_item.count
|
||||
record_auction(auction_item.name, aux_quantity, auction_item.buyout_price, auction_item.duration, auction_item.owner)
|
||||
on_read_auction = function(auction_info)
|
||||
if auction_info.name == item_info.name then
|
||||
local aux_quantity = auction_info.charges or auction_info.count
|
||||
record_auction(auction_info.item_key, aux_quantity, auction_info.buyout_price, auction_info.duration, auction_info.owner)
|
||||
end
|
||||
end,
|
||||
on_abort = function()
|
||||
auxSellEntries[name] = nil
|
||||
existing_auctions[item_key] = nil
|
||||
Aux.log('Scan aborted.')
|
||||
end,
|
||||
on_complete = function()
|
||||
auxSellEntries[name] = auxSellEntries[name] or { created = GetTime() }
|
||||
existing_auctions[item_key] = existing_auctions[item_key] or { created = GetTime() }
|
||||
select_entry()
|
||||
update_recommendation()
|
||||
update_auction_listing()
|
||||
Aux.log('Scan complete: '..getn(auxSellEntries[name])..' '..Aux_PluralizeIf('auction', getn(auxSellEntries[name]))..' of '..current_auction.hyperlink..' found.')
|
||||
Aux.log('Scan complete: '..getn(existing_auctions[item_key])..' '..Aux_PluralizeIf('auction', getn(existing_auctions[item_key]))..' of '..current_auction.hyperlink..' found.')
|
||||
end,
|
||||
next_page = function(page, total_pages)
|
||||
local last_page = max(total_pages - 1, 0)
|
||||
@@ -587,7 +597,7 @@ end
|
||||
|
||||
function AuxSellEntry_OnClick(entry)
|
||||
|
||||
auxSellEntries[current_auction.name].selected = entry
|
||||
existing_auctions[current_auction.key].selected = entry
|
||||
|
||||
update_auction_listing()
|
||||
update_recommendation()
|
||||
@@ -604,21 +614,11 @@ function AuxSellParametersRefreshButton_OnClick()
|
||||
end)
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function AuxMoneyFrame_OnLoad()
|
||||
this.small = 1
|
||||
SmallMoneyFrame_OnLoad()
|
||||
MoneyFrame_SetType("AUCTION")
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function record_auction(name, aux_quantity, buyout_price, duration, owner)
|
||||
function record_auction(key, aux_quantity, buyout_price, duration, owner)
|
||||
if buyout_price > 0 then
|
||||
auxSellEntries[name] = auxSellEntries[name] or { created = GetTime() }
|
||||
existing_auctions[key] = existing_auctions[key] or { created = GetTime() }
|
||||
local entry
|
||||
for _, existingEntry in ipairs(auxSellEntries[name]) do
|
||||
for _, existingEntry in ipairs(existing_auctions[key]) do
|
||||
if existingEntry.buyout_price == buyout_price and existingEntry.stack_size == aux_quantity then
|
||||
entry = existingEntry
|
||||
end
|
||||
@@ -638,45 +638,23 @@ function record_auction(name, aux_quantity, buyout_price, duration, owner)
|
||||
count = 1,
|
||||
yours = owner == UnitName("player") and 1 or 0,
|
||||
}
|
||||
tinsert(auxSellEntries[name], entry)
|
||||
table.sort(auxSellEntries[name], function(a,b) return a.unit_buyout_price < b.unit_buyout_price end)
|
||||
tinsert(existing_auctions[key], entry)
|
||||
table.sort(existing_auctions[key], function(a,b) return a.unit_buyout_price < b.unit_buyout_price end)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function undercut(price)
|
||||
return math.max(0, price - 1)
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
-- function item_class_index(item_class)
|
||||
-- for i, class in ipairs({ GetAuctionItemClasses() }) do
|
||||
-- if class == item_class then
|
||||
-- return i
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- -----------------------------------------
|
||||
|
||||
-- function item_subclass_index(class_index, item_subclass)
|
||||
-- for i, subclass in ipairs({ GetAuctionItemSubClasses(class_index) }) do
|
||||
-- if subclass == item_subclass then
|
||||
-- return i
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
function report(hyperlink, stack_size, buyout_price, posted)
|
||||
function report(hyperlink, aux_quantity, buyout_price, posted)
|
||||
Aux.log(string.format(
|
||||
'%i %s of %s x %i posted at %s.',
|
||||
posted,
|
||||
Aux_PluralizeIf('auction', posted),
|
||||
hyperlink,
|
||||
stack_size,
|
||||
aux_quantity,
|
||||
Aux.util.money_string(buyout_price)
|
||||
))
|
||||
end
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Aux.scan = {}
|
||||
local private , public = {}, {}
|
||||
Aux.scan = public
|
||||
|
||||
local PAGE_SIZE = 50
|
||||
|
||||
@@ -70,8 +71,8 @@ function wait_for_owner_data(k)
|
||||
return controller().wait(function()
|
||||
local count, _ = GetNumAuctionItems(state.job.type)
|
||||
for i=1,count do
|
||||
local auction_item_info = Aux.info.auction_item(i)
|
||||
if auction_item_info and not auction_item_info.owner then
|
||||
local auction_info = Aux.info.auction(i, state.job.type)
|
||||
if auction_info and not auction_info.owner then
|
||||
return false
|
||||
end
|
||||
end
|
||||
@@ -128,15 +129,20 @@ function scan_auctions(count, k)
|
||||
end
|
||||
|
||||
function scan_auctions_helper(i, n, k)
|
||||
wait_for_callback{state.job.on_read_auction, i, function()
|
||||
|
||||
local recurse = function()
|
||||
if i >= n then
|
||||
return k()
|
||||
else
|
||||
return scan_auctions_helper(i + 1, n, k)
|
||||
end
|
||||
|
||||
end}
|
||||
end
|
||||
|
||||
local auction_info = Aux.info.auction(i, state.job.type)
|
||||
if auction_info then
|
||||
wait_for_callback{state.job.on_read_auction, auction_info, recurse}
|
||||
else
|
||||
recurse()
|
||||
end
|
||||
end
|
||||
|
||||
function submit_query(k)
|
||||
|
||||
+3
-4
@@ -35,8 +35,8 @@ function Aux.history.start_scan()
|
||||
on_page_loaded = function(page, total_pages)
|
||||
Aux.log('Scanning page '..(page+1)..' out of '..total_pages..' ...')
|
||||
end,
|
||||
on_read_auction = function(i)
|
||||
process_auction(i)
|
||||
on_read_auction = function(auction_info)
|
||||
process_auction(auction_info)
|
||||
end,
|
||||
on_complete = function()
|
||||
process_scanned_auctions()
|
||||
@@ -82,8 +82,7 @@ function Aux.history.stop_scan()
|
||||
Aux.scan.abort()
|
||||
end
|
||||
|
||||
function process_auction(index)
|
||||
local auction_info = Aux.info.auction_item(index)
|
||||
function process_auction(auction_info)
|
||||
local buyout_price = Aux.util.safe_index{auction_info, 'buyout_price'}
|
||||
if buyout_price and buyout_price > 0 then
|
||||
local aux_quantity = auction_info.charges or auction_info.count
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
Aux.stack = {}
|
||||
local private, public = {}, {}
|
||||
Aux.stack = public
|
||||
|
||||
local controller = (function()
|
||||
local controller
|
||||
@@ -10,19 +11,18 @@ end)()
|
||||
|
||||
local state
|
||||
|
||||
local item_slots, find_empty_slot, locked, same_slot, move_item, item_name, stack_size, stop, process
|
||||
|
||||
function item_slots(name)
|
||||
function private.item_slots(item_key)
|
||||
local slots = Aux.util.inventory_iterator()
|
||||
return function()
|
||||
local slot
|
||||
repeat
|
||||
slot = slots()
|
||||
until slot == nil or item_name(slot) == name
|
||||
until slot == nil or private.item_key(slot) == item_key
|
||||
return slot
|
||||
end
|
||||
end
|
||||
|
||||
function find_empty_slot()
|
||||
function private.find_empty_slot()
|
||||
for slot in Aux.util.inventory_iterator() do
|
||||
if not GetContainerItemInfo(slot.bag, slot.bag_slot) then
|
||||
return slot
|
||||
@@ -30,106 +30,90 @@ function find_empty_slot()
|
||||
end
|
||||
end
|
||||
|
||||
function find_charges_item_slot(name, charges)
|
||||
for slot in item_slots(name) do
|
||||
if item_charges(slot) == charges then
|
||||
function private.find_charges_item_slot(item_key, charges)
|
||||
for slot in private.item_slots(item_key) do
|
||||
if private.item_charges(slot) == charges then
|
||||
return slot
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function locked(slot)
|
||||
local _, _, locked = GetContainerItemInfo(slog.bag, slot.bag_slot)
|
||||
return locked
|
||||
end
|
||||
|
||||
function same_slot(slot1, slot2)
|
||||
return slot1.bag == slot2.bag and slot1.bag_slot == slot2.bag_slot
|
||||
end
|
||||
|
||||
function move_item(from_slot, to_slot, amount, k)
|
||||
local size_before = stack_size(to_slot)
|
||||
function private.move_item(from_slot, to_slot, amount, k)
|
||||
local size_before = private.stack_size(to_slot)
|
||||
|
||||
amount = min(max_stack(from_slot) - stack_size(to_slot), amount)
|
||||
amount = min(private.max_stack(from_slot) - private.stack_size(to_slot), amount)
|
||||
|
||||
ClearCursor()
|
||||
SplitContainerItem(from_slot.bag, from_slot.bag_slot, amount)
|
||||
PickupContainerItem(to_slot.bag, to_slot.bag_slot)
|
||||
|
||||
return controller().wait(function() return stack_size(to_slot) == size_before + amount end, k)
|
||||
return controller().wait(function() return private.stack_size(to_slot) == size_before + amount end, k)
|
||||
end
|
||||
|
||||
function item_name(slot)
|
||||
function private.item_key(slot)
|
||||
local container_item_info = Aux.info.container_item(slot.bag, slot.bag_slot)
|
||||
return container_item_info and container_item_info.name
|
||||
return container_item_info and container_item_info.item_key
|
||||
end
|
||||
|
||||
function item_id(slot)
|
||||
local hyperlink = GetContainerItemLink(slot.bag, slot.bag_slot)
|
||||
if hyperlink then
|
||||
local _, _, id_string = strfind(hyperlink, "^.-:(%d*).*")
|
||||
return tonumber(id_string)
|
||||
end
|
||||
function private.stack_size(slot)
|
||||
local container_item_info = Aux.info.container_item(slot.bag, slot.bag_slot)
|
||||
return container_item_info and container_item_info.count or 0
|
||||
end
|
||||
|
||||
function stack_size(slot)
|
||||
local _, item_count = GetContainerItemInfo(slot.bag, slot.bag_slot)
|
||||
return item_count or 0
|
||||
function private.item_charges(slot)
|
||||
local container_item_info = Aux.info.container_item(slot.bag, slot.bag_slot)
|
||||
return container_item_info and container_item_info.charges
|
||||
end
|
||||
|
||||
function item_charges(slot)
|
||||
return Aux.info.container_item(slot.bag, slot.bag_slot).charges
|
||||
end
|
||||
function private.process()
|
||||
|
||||
function process()
|
||||
|
||||
if stack_size(state.target_slot) > state.target_size then
|
||||
local empty_slot = find_empty_slot()
|
||||
if private.stack_size(state.target_slot) > state.target_size then
|
||||
local empty_slot = private.find_empty_slot()
|
||||
|
||||
if empty_slot then
|
||||
return move_item(
|
||||
return private.move_item(
|
||||
state.target_slot,
|
||||
empty_slot,
|
||||
stack_size(state.target_slot) - state.target_size,
|
||||
private.stack_size(state.target_slot) - state.target_size,
|
||||
function()
|
||||
return process()
|
||||
return private.process()
|
||||
end)
|
||||
else
|
||||
local next_slot = state.other_slots()
|
||||
if next_slot then
|
||||
return move_item(
|
||||
return private.move_item(
|
||||
state.target_slot,
|
||||
next_slot,
|
||||
stack_size(state.target_slot) - state.target_size,
|
||||
private.stack_size(state.target_slot) - state.target_size,
|
||||
function()
|
||||
return process()
|
||||
return private.process()
|
||||
end)
|
||||
end
|
||||
end
|
||||
elseif stack_size(state.target_slot) < state.target_size then
|
||||
elseif private.stack_size(state.target_slot) < state.target_size then
|
||||
local next_slot = state.other_slots()
|
||||
if next_slot then
|
||||
return move_item(
|
||||
return private.move_item(
|
||||
next_slot,
|
||||
state.target_slot,
|
||||
state.target_size - stack_size(state.target_slot),
|
||||
state.target_size - private.stack_size(state.target_slot),
|
||||
function()
|
||||
return process()
|
||||
return private.process()
|
||||
end)
|
||||
end
|
||||
end
|
||||
|
||||
return stop()
|
||||
return private.stop()
|
||||
end
|
||||
|
||||
function max_stack(slot)
|
||||
local _, _, _, _, _, _, max_stack = GetItemInfo(item_id(slot))
|
||||
return max_stack
|
||||
function private.max_stack(slot)
|
||||
local container_item_info = Aux.info.container_item(slot.bag, slot.bag_slot)
|
||||
return container_item_info and container_item_info.max_stack
|
||||
end
|
||||
|
||||
function Aux.stack.stop(k)
|
||||
function public.stop(k)
|
||||
Aux.control.on_next_update(function()
|
||||
stop()
|
||||
private.stop()
|
||||
|
||||
if k then
|
||||
return k()
|
||||
@@ -137,11 +121,11 @@ function Aux.stack.stop(k)
|
||||
end)
|
||||
end
|
||||
|
||||
function stop()
|
||||
function private.stop()
|
||||
controller().reset()
|
||||
if state then
|
||||
local slot
|
||||
if state.target_slot and (stack_size(state.target_slot) == state.target_size or item_charges(state.target_slot) == state.target_size) then
|
||||
if state.target_slot and (private.stack_size(state.target_slot) == state.target_size or private.item_charges(state.target_slot) == state.target_size) then
|
||||
slot = state.target_slot
|
||||
end
|
||||
local callback = state.callback
|
||||
@@ -154,11 +138,11 @@ function stop()
|
||||
end
|
||||
end
|
||||
|
||||
function Aux.stack.start(name, size, callback)
|
||||
function public.start(item_key, size, callback)
|
||||
Aux.control.on_next_update(function()
|
||||
stop()
|
||||
private.stop()
|
||||
|
||||
local slots = item_slots(name)
|
||||
local slots = private.item_slots(item_key)
|
||||
local target_slot = slots()
|
||||
|
||||
state = {
|
||||
@@ -169,12 +153,12 @@ function Aux.stack.start(name, size, callback)
|
||||
}
|
||||
|
||||
if not target_slot then
|
||||
return stop()
|
||||
elseif item_charges(target_slot) then
|
||||
state.target_slot = find_charges_item_slot(name, size)
|
||||
return stop()
|
||||
return private.stop()
|
||||
elseif private.item_charges(target_slot) then
|
||||
state.target_slot = private.find_charges_item_slot(item_key, size)
|
||||
return private.stop()
|
||||
else
|
||||
return process()
|
||||
return private.process()
|
||||
end
|
||||
end)
|
||||
end
|
||||
Reference in New Issue
Block a user