fixed up ui in buy and added missing filters, changed buy search mechanism
This commit is contained in:
@@ -17,3 +17,5 @@ util.lua
|
||||
options.xml
|
||||
about.xml
|
||||
|
||||
list.xml
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
Aux.buy = {}
|
||||
|
||||
local record_auction, createOrder, updateOrder, set_message, report, tooltip_match
|
||||
local record_auction, set_message, report, tooltip_match
|
||||
local entries
|
||||
local selectedEntries = {}
|
||||
local search_query
|
||||
local tooltip_patterns = {}
|
||||
local current_page
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
@@ -17,8 +18,17 @@ end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function AuxBuySearchButton_OnClick()
|
||||
function Aux.buy.StopButton_onclick()
|
||||
Aux.scan.abort()
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function Aux.buy.SearchButton_onclick()
|
||||
|
||||
AuxBuySearchButton:Hide()
|
||||
AuxBuyStopButton:Show()
|
||||
|
||||
entries = nil
|
||||
selectedEntries = {}
|
||||
|
||||
@@ -26,7 +36,7 @@ function AuxBuySearchButton_OnClick()
|
||||
|
||||
local category = UIDropDownMenu_GetSelectedValue(AuxBuyCategoryDropDown)
|
||||
|
||||
search_query = Aux.scan.create_query{
|
||||
search_query = {
|
||||
name = AuxBuySearchBox:GetText(),
|
||||
slot = category and category.slot,
|
||||
class = category and category.class,
|
||||
@@ -36,7 +46,9 @@ function AuxBuySearchButton_OnClick()
|
||||
set_message('Scanning auctions ...')
|
||||
Aux.scan.start{
|
||||
query = search_query,
|
||||
start_page = 0,
|
||||
on_start_page = function(i)
|
||||
current_page = i
|
||||
set_message('Scanning auctions: page ' .. i + 1 .. ' ...')
|
||||
end,
|
||||
on_read_auction = function(i)
|
||||
@@ -46,37 +58,41 @@ function AuxBuySearchButton_OnClick()
|
||||
end
|
||||
local stack_size = auction_item.charges or auction_item.count
|
||||
if (auction_item.name == search_query.name or search_query.name == '' or not AuxBuyExactCheckButton:GetChecked()) and tooltip_match(Aux.util.set_to_array(tooltip_patterns), auction_item.tooltip) then
|
||||
record_auction(auction_item.name, auction_item.tooltip, stack_size, auction_item.buyout_price, auction_item.quality, auction_item.owner, auction_item.hyperlink, auction_item.itemstring)
|
||||
record_auction(
|
||||
auction_item.name,
|
||||
auction_item.tooltip,
|
||||
stack_size,
|
||||
auction_item.buyout_price,
|
||||
auction_item.quality,
|
||||
auction_item.owner,
|
||||
auction_item.hyperlink,
|
||||
auction_item.itemstring,
|
||||
current_page
|
||||
)
|
||||
end
|
||||
end,
|
||||
on_complete = function()
|
||||
entries = entries or {}
|
||||
AuxBuyStopButton:Hide()
|
||||
AuxBuySearchButton:Show()
|
||||
Aux_Buy_ScrollbarUpdate()
|
||||
end,
|
||||
on_abort = function()
|
||||
entries = nil
|
||||
end
|
||||
entries = entries or {}
|
||||
AuxBuyStopButton:Hide()
|
||||
AuxBuySearchButton:Show()
|
||||
Aux_Buy_ScrollbarUpdate()
|
||||
end,
|
||||
next_page = function(page, auctions)
|
||||
if auctions == Aux.scan.MAX_AUCTIONS_PER_PAGE then
|
||||
return page + 1
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function createOrder()
|
||||
local order = {}
|
||||
for entry,_ in pairs(selectedEntries) do
|
||||
local key = Aux.auction_key(entry.tooltip, entry.stackSize, entry.buyoutPrice)
|
||||
|
||||
if order[key] then
|
||||
order[key] = order[key] + 1
|
||||
else
|
||||
order[key] = 1
|
||||
end
|
||||
end
|
||||
return order
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function set_message(msg)
|
||||
AuxBuyMessage:SetText(msg)
|
||||
AuxBuyMessage:Show()
|
||||
@@ -85,71 +101,77 @@ end
|
||||
-----------------------------------------
|
||||
|
||||
function AuxBuyBuySelectedButton_OnClick()
|
||||
|
||||
local order = createOrder(selectedEntries)
|
||||
local orderedCount = Aux.util.set_size(selectedEntries)
|
||||
|
||||
entries = nil
|
||||
selectedEntries = {}
|
||||
|
||||
Aux_Buy_ScrollbarUpdate()
|
||||
AuxBuySearchButton:Disable()
|
||||
AuxBuyBuySelectedButton:Disable()
|
||||
|
||||
local progress = {
|
||||
auctions = 0,
|
||||
units = 0,
|
||||
expense = 0,
|
||||
}
|
||||
|
||||
set_message('Scanning auctions ...')
|
||||
Aux.scan.start{
|
||||
query = search_query,
|
||||
on_start_page = function(i)
|
||||
set_message('Scanning auctions: page ' .. i + 1 .. ' ...')
|
||||
end,
|
||||
on_read_auction = function(i)
|
||||
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
|
||||
|
||||
if not auction_item.name or not stack_size or not auction_item.buyout_price then
|
||||
return
|
||||
end
|
||||
|
||||
local key = Aux.auction_key(auction_item.tooltip, stack_size, auction_item.buyout_price)
|
||||
if order[key] then
|
||||
-- local order = createOrder(selectedEntries)
|
||||
-- local orderedCount = Aux.util.set_size(selectedEntries)
|
||||
|
||||
-- entries = nil
|
||||
-- selectedEntries = {}
|
||||
|
||||
-- Aux_Buy_ScrollbarUpdate()
|
||||
-- AuxBuySearchButton:Disable()
|
||||
-- AuxBuyBuySelectedButton:Disable()
|
||||
|
||||
-- local progress = {
|
||||
-- auctions = 0,
|
||||
-- units = 0,
|
||||
-- expense = 0,
|
||||
-- }
|
||||
|
||||
-- set_message('Scanning auctions ...')
|
||||
-- Aux.scan.start{
|
||||
-- query = search_query,
|
||||
-- start_page = 0,
|
||||
-- on_start_page = function(i)
|
||||
-- set_message('Scanning auctions: page ' .. i + 1 .. ' ...')
|
||||
-- end,
|
||||
-- on_read_auction = function(i)
|
||||
-- local auction_item = Aux.info.auction_item(i)
|
||||
|
||||
if GetMoney() >= auction_item.buyout_price then
|
||||
PlaceAuctionBid("list", i, auction_item.buyout_price)
|
||||
progress.auctions = progress.auctions + 1
|
||||
progress.units = progress.units + stack_size
|
||||
progress.expense = progress.expense + auction_item.buyout_price
|
||||
end
|
||||
-- if not auction_item then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
-- local stack_size = auction_item.charges or auction_item.count
|
||||
|
||||
-- if not auction_item.name or not stack_size or not auction_item.buyout_price then
|
||||
-- return
|
||||
-- end
|
||||
|
||||
-- local key = Aux.auction_key(auction_item.tooltip, stack_size, auction_item.buyout_price)
|
||||
-- if order[key] then
|
||||
|
||||
-- if GetMoney() >= auction_item.buyout_price then
|
||||
-- PlaceAuctionBid("list", i, auction_item.buyout_price)
|
||||
-- progress.auctions = progress.auctions + 1
|
||||
-- progress.units = progress.units + stack_size
|
||||
-- progress.expense = progress.expense + auction_item.buyout_price
|
||||
-- end
|
||||
|
||||
if order[key] > 1 then
|
||||
order[key] = order[key] - 1
|
||||
else
|
||||
order[key] = nil
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_complete = function()
|
||||
entries = entries or {}
|
||||
Aux_Buy_ScrollbarUpdate()
|
||||
AuxBuySearchButton:Enable()
|
||||
report(true, search_query.name, orderedCount, progress)
|
||||
end,
|
||||
on_abort = function()
|
||||
entries = nil
|
||||
AuxBuySearchButton:Enable()
|
||||
report(false, search_query.name, orderedCount, progress)
|
||||
end
|
||||
}
|
||||
-- if order[key] > 1 then
|
||||
-- order[key] = order[key] - 1
|
||||
-- else
|
||||
-- order[key] = nil
|
||||
-- end
|
||||
-- end
|
||||
-- end,
|
||||
-- on_complete = function()
|
||||
-- entries = entries or {}
|
||||
-- Aux_Buy_ScrollbarUpdate()
|
||||
-- AuxBuySearchButton:Enable()
|
||||
-- report(true, search_query.name, orderedCount, progress)
|
||||
-- end,
|
||||
-- on_abort = function()
|
||||
-- entries = nil
|
||||
-- AuxBuySearchButton:Enable()
|
||||
-- report(false, search_query.name, orderedCount, progress)
|
||||
-- end,
|
||||
-- next_page = function(page, auctions)
|
||||
-- if auctions == Aux.scan.MAX_AUCTIONS_PER_PAGE then
|
||||
-- return page + 1
|
||||
-- end
|
||||
-- end,
|
||||
-- }
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
@@ -158,15 +180,58 @@ function AuxBuyEntry_OnClick()
|
||||
local i = this:GetID()
|
||||
local entry = entries[i]
|
||||
|
||||
if Aux.util.set_contains(selectedEntries, entry) then
|
||||
Aux.util.set_remove(selectedEntries, entry)
|
||||
else
|
||||
Aux.util.set_add(selectedEntries, entry)
|
||||
end
|
||||
-- if Aux.util.set_contains(selectedEntries, entry) then
|
||||
-- Aux.util.set_remove(selectedEntries, entry)
|
||||
-- else
|
||||
-- Aux.util.set_add(selectedEntries, entry)
|
||||
-- end
|
||||
|
||||
Aux_Buy_ScrollbarUpdate()
|
||||
-- Aux_Buy_ScrollbarUpdate()
|
||||
|
||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
-- PlaySound("igMainMenuOptionCheckBoxOn")
|
||||
|
||||
local found
|
||||
local order_key = Aux.auction_key(entry.tooltip, entry.stack_size, entry.buyout_price)
|
||||
|
||||
Aux.log('starting' .. entry.page .. ' - ' .. current_page)
|
||||
Aux.scan.start{
|
||||
query = search_query,
|
||||
start_page = entry.page ~= current_page and entry.page,
|
||||
on_read_auction = function(i)
|
||||
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
|
||||
|
||||
if not auction_item.tooltip or not stack_size or not auction_item.buyout_price then
|
||||
return
|
||||
end
|
||||
|
||||
local key = Aux.auction_key(auction_item.tooltip, stack_size, auction_item.buyout_price)
|
||||
if key == order_key then
|
||||
found = true
|
||||
Aux.log('found')
|
||||
if GetMoney() >= auction_item.buyout_price then
|
||||
|
||||
PlaceAuctionBid("list", i, auction_item.buyout_price)
|
||||
|
||||
-- TODO remove
|
||||
end
|
||||
end
|
||||
end,
|
||||
on_complete = function()
|
||||
if not found then
|
||||
-- TODO remove
|
||||
end
|
||||
Aux_Buy_ScrollbarUpdate()
|
||||
end,
|
||||
on_abort = function()
|
||||
Aux_Buy_ScrollbarUpdate()
|
||||
end,
|
||||
}
|
||||
end
|
||||
|
||||
function AuxBuyEntry_OnEnter()
|
||||
@@ -176,29 +241,30 @@ function AuxBuyEntry_OnEnter()
|
||||
Aux.info.set_game_tooltip(this, entry.tooltip)
|
||||
|
||||
if(EnhTooltip ~= nil) then
|
||||
EnhTooltip.TooltipCall(GameTooltip, entry.name, entry.hyperlink, entry.quality, entry.stackSize)
|
||||
EnhTooltip.TooltipCall(GameTooltip, entry.name, entry.hyperlink, entry.quality, entry.stack_size)
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function record_auction(name, tooltip, stack_size, buyout_price, quality, owner, hyperlink, itemstring)
|
||||
function record_auction(name, tooltip, stack_size, buyout_price, quality, owner, hyperlink, itemstring, page)
|
||||
entries = entries or {}
|
||||
|
||||
if buyout_price > 0 and owner ~= UnitName("player") then
|
||||
tinsert(entries, {
|
||||
name = name,
|
||||
tooltip = tooltip,
|
||||
stackSize = stack_size,
|
||||
buyoutPrice = buyout_price,
|
||||
itemPrice = buyout_price / stack_size,
|
||||
stack_size = stack_size,
|
||||
buyout_price = buyout_price,
|
||||
item_price = buyout_price / stack_size,
|
||||
quality = quality,
|
||||
hyperlink = hyperlink,
|
||||
itemstring = itemstring,
|
||||
page = current_page,
|
||||
})
|
||||
end
|
||||
|
||||
table.sort(entries, function(a,b) return a.itemPrice < b.itemPrice end)
|
||||
table.sort(entries, function(a,b) return a.item_price < b.item_price end)
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
@@ -210,18 +276,6 @@ function Aux_Buy_ScrollbarUpdate()
|
||||
AuxBuyMessage:Hide()
|
||||
end
|
||||
|
||||
local total = 0
|
||||
for entry, _ in selectedEntries do
|
||||
total = total + entry.buyoutPrice
|
||||
end
|
||||
MoneyFrame_Update("AuxBuyTotal", Aux_Round(total))
|
||||
|
||||
if Aux.util.set_size(selectedEntries) > 0 and GetMoney() >= total then
|
||||
AuxBuyBuySelectedButton:Enable()
|
||||
else
|
||||
AuxBuyBuySelectedButton:Disable()
|
||||
end
|
||||
|
||||
local numrows
|
||||
if not entries then
|
||||
numrows = 0
|
||||
@@ -249,7 +303,7 @@ function Aux_Buy_ScrollbarUpdate()
|
||||
local entry = entries[dataOffset]
|
||||
|
||||
local lineEntry_name = getglobal("AuxBuyEntry"..line.."_Name")
|
||||
local lineEntry_stackSize = getglobal("AuxBuyEntry"..line.."_StackSize")
|
||||
local lineEntry_stack_size = getglobal("AuxBuyEntry"..line.."_StackSize")
|
||||
|
||||
local color = "ffffffff"
|
||||
if Aux_QualityColor(entry.quality) then
|
||||
@@ -264,10 +318,10 @@ function Aux_Buy_ScrollbarUpdate()
|
||||
lineEntry:UnlockHighlight()
|
||||
end
|
||||
|
||||
lineEntry_stackSize:SetText(entry.stackSize)
|
||||
lineEntry_stack_size:SetText(entry.stack_size)
|
||||
|
||||
MoneyFrame_Update("AuxBuyEntry"..line.."_UnitPrice", Aux_Round(entry.buyoutPrice/entry.stackSize))
|
||||
MoneyFrame_Update("AuxBuyEntry"..line.."_TotalPrice", Aux_Round(entry.buyoutPrice))
|
||||
MoneyFrame_Update("AuxBuyEntry"..line.."_UnitPrice", Aux_Round(entry.buyout_price/entry.stack_size))
|
||||
MoneyFrame_Update("AuxBuyEntry"..line.."_TotalPrice", Aux_Round(entry.buyout_price))
|
||||
|
||||
lineEntry:Show()
|
||||
else
|
||||
@@ -375,7 +429,7 @@ end
|
||||
function AuxBuyCategoryDropDown_OnClick()
|
||||
local qualified_name = ({ GetAuctionItemClasses() })[this.value.class] or 'All'
|
||||
if this.value.subclass then
|
||||
local subclass_name = ({ GetAuctionItemSubclasses(this.value.class) })[this.value.subclass]
|
||||
local subclass_name = ({ GetAuctionItemSubClasses(this.value.class) })[this.value.subclass]
|
||||
qualified_name = qualified_name .. ' - ' .. subclass_name
|
||||
if this.value.slot then
|
||||
local slot_name = getglobal(({ GetAuctionInvTypes(this.value.class, this.value.subclass) })[this.value.slot])
|
||||
@@ -442,7 +496,7 @@ function AuxBuyTooltipDropDown_Initialize()
|
||||
end
|
||||
|
||||
function AuxBuyTooltipDropDown_OnClick()
|
||||
AuxBuyTooltipEdit:SetText(this.value)
|
||||
Aux.util.set_remove(tooltip_patterns, this.value)
|
||||
end
|
||||
|
||||
function Aux.buy.toggle_tooltip_dropdown()
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||
|
||||
<Script file="buy.lua"/>
|
||||
|
||||
|
||||
<Button name="AuxBuyEntryTemplate" virtual="true" hidden="true">
|
||||
<Size><AbsDimension y="16"/></Size>
|
||||
<Frames>
|
||||
@@ -97,15 +97,6 @@
|
||||
</FontString>
|
||||
</Layer>
|
||||
<Layer level="ARTWORK">
|
||||
<FontString name="AuxBuyTotalLabel" inherits="GameFontHighlightSmall" text="Total">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="70" y="22"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<Texture name="$parentMiddle" file="Interface\Glues\CharacterCreate\CharacterCreate-LabelFrame">
|
||||
<Size><AbsDimension x="802" y="64"/></Size>
|
||||
<Anchors>
|
||||
@@ -137,45 +128,83 @@
|
||||
</Layers>
|
||||
|
||||
<Frames>
|
||||
<Frame name="AuxBuyList" inherits="ListTemplate">
|
||||
<Size><AbsDimension x="610" y="334"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="187" y="-77"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
Aux.list.initialize(this, {{ width=50, logicalColumns={1,2,3} }, { width=50, logicalColumns={1,2,3} }})
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Frame name="AuxBuyFilters">
|
||||
<Size><AbsDimension x="1" y="1"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="80" y="-45"/></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<FontString name="AuxBuySearchBoxLabel" inherits="GameFontHighlightSmall" text="Name">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0" /></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
|
||||
<FontString name="AuxBuyExactLabel" inherits="GameFontHighlightSmall" text="Exact">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="225" y="0" /></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="80" y="-46"/></Offset></Anchor></Anchors>
|
||||
<Frames>
|
||||
<EditBox name="AuxBuySearchBox" autoFocus="false" inherits="InputBoxTemplate">
|
||||
<Size><AbsDimension x="180" y="22"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="40" y="0"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontHighlightSmall" text="Name">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="-3" y="9"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<OnChar>
|
||||
Aux.util.item_name_autocomplete()
|
||||
</OnChar>
|
||||
<OnEnterPressed>
|
||||
this:ClearFocus()
|
||||
AuxBuySearchButton_OnClick()
|
||||
Aux.buy.SearchButton_onclick()
|
||||
</OnEnterPressed>
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
|
||||
<CheckButton name="AuxBuyExactCheckButton" inherits="UICheckButtonTemplate" checked="true">
|
||||
<Size><AbsDimension x="22" y="22"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="255" y="0" /></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="200" y="0" /></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontHighlightSmall" text="Exact">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="9"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</CheckButton>
|
||||
|
||||
<Frame name="AuxBuyCategoryDropDown" inherits="UIDropDownMenuTemplate">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="270" y="3" /></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="235" y="3" /></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontHighlightSmall" text="Category">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="20" y="8"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
UIDropDownMenu_Initialize(this, AuxBuyCategoryDropDown_Initialize)
|
||||
UIDropDownMenu_SetWidth(200)
|
||||
</OnLoad>
|
||||
<OnShow>
|
||||
UIDropDownMenu_Initialize(this, AuxBuyCategoryDropDown_Initialize)
|
||||
@@ -183,9 +212,40 @@
|
||||
</Scripts>
|
||||
</Frame>
|
||||
|
||||
<CheckButton name="AuxBuyUsableCheckButton" inherits="UICheckButtonTemplate">
|
||||
<Size><AbsDimension x="22" y="22"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="500" y="0" /></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontHighlightSmall" text="Usable">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="9"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</CheckButton>
|
||||
|
||||
<EditBox name="AuxBuyTooltipEdit" autoFocus="false" inherits="InputBoxTemplate">
|
||||
<Size><AbsDimension x="130" y="22"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="430" y="0"/></Offset></Anchor></Anchors>
|
||||
<Size><AbsDimension x="145" y="22"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="557" y="0"/></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="OVERLAY">
|
||||
<FontString inherits="GameFontHighlightSmall" text="Tooltip">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="-3" y="9"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<OnEnterPressed>
|
||||
AuxBuyTooltipAddButton_OnClick(this)
|
||||
@@ -194,7 +254,7 @@
|
||||
</EditBox>
|
||||
|
||||
<Frame name="AuxBuyTooltipDropDown" inherits="UIDropDownMenuTemplate">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="413" y="0"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="555" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
getglobal(this:GetName().."Left"):Hide()
|
||||
@@ -202,7 +262,6 @@
|
||||
getglobal(this:GetName().."Right"):Hide()
|
||||
getglobal(this:GetName().."Text"):Hide()
|
||||
getglobal(this:GetName().."Button"):SetScript("OnClick", Aux.buy.toggle_tooltip_dropdown)
|
||||
UIDropDownMenu_SetWidth(115)
|
||||
UIDropDownMenu_Initialize(this, AuxBuyTooltipDropDown_Initialize)
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
@@ -210,7 +269,7 @@
|
||||
|
||||
<Button name="AuxBuyTooltipAddButton" inherits="UIPanelButtonTemplate" text="+">
|
||||
<Size><AbsDimension x="22" y="22"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="578" y="0"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="720" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
AuxBuyTooltipAddButton_OnClick(this)
|
||||
@@ -218,26 +277,6 @@
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<Button name="AuxBuyTooltipRemoveButton" inherits="UIPanelButtonTemplate" text="-">
|
||||
<Size><AbsDimension x="22" y="22"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="600" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
AuxBuyTooltipRemoveButton_OnClick(this)
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<Button name="AuxBuySearchButton" inherits="UIPanelButtonTemplate" text="Search">
|
||||
<Size><AbsDimension x="80" y="22"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="653" y="0" /></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
AuxBuySearchButton_OnClick()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<!-- <Frame name="AuxBuySlotDropDown" inherits="UIDropDownMenuTemplate">
|
||||
<Anchors><Anchor point="LEFT"><Offset><AbsDimension x="500" y="1" /></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
@@ -252,7 +291,7 @@
|
||||
</Frames>
|
||||
</Frame>
|
||||
|
||||
<Button name="AuxBuyBuySelectedButton" inherits="UIPanelButtonTemplate" text="Buy Selected Auctions">
|
||||
<Button name="AuxBuySearchButton" inherits="UIPanelButtonTemplate" text="Search">
|
||||
<Size><AbsDimension x="166" y="22"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMRIGHT">
|
||||
@@ -263,26 +302,26 @@
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
AuxBuyBuySelectedButton_OnClick()
|
||||
Aux.buy.SearchButton_onclick()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<Frame name="AuxBuyTotal" inherits="SmallMoneyFrameTemplate">
|
||||
<Button name="AuxBuyStopButton" inherits="UIPanelButtonTemplate" text="Stop" hidden="true">
|
||||
<Size><AbsDimension x="166" y="22"/></Size>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativePoint="RIGHT" relativeTo="AuxBuyTotalLabel">
|
||||
<Anchor point="BOTTOMRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="10" y="0"/>
|
||||
<AbsDimension x="51" y="14"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad()
|
||||
MoneyFrame_SetType("STATIC")
|
||||
</OnLoad>
|
||||
<OnClick>
|
||||
Aux.buy.StopButton_onclick()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</Button>
|
||||
|
||||
<ScrollFrame name="AuxBuyScrollFrame" inherits="FauxScrollFrameTemplate">
|
||||
<Size><AbsDimension x="785" y="309"/></Size>
|
||||
|
||||
@@ -24,7 +24,7 @@ local relevel
|
||||
-----------------------------------------
|
||||
|
||||
function Aux_OnLoad()
|
||||
Aux_Log("Aux v"..AuxVersion.." loaded")
|
||||
Aux.log("Aux v"..AuxVersion.." loaded")
|
||||
Aux.loaded = true
|
||||
end
|
||||
|
||||
@@ -263,7 +263,7 @@ end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function Aux_Log(msg)
|
||||
function Aux.log(msg)
|
||||
if DEFAULT_CHAT_FRAME then
|
||||
DEFAULT_CHAT_FRAME:AddMessage(msg, 1, 1, 0)
|
||||
end
|
||||
@@ -454,7 +454,7 @@ function Aux_ContainerFrameItemButton_OnClick(button)
|
||||
AuctionFrameTab_OnClick(Aux.tabs.buy.index)
|
||||
end
|
||||
AuxBuySearchBox:SetText(container_item.name)
|
||||
AuxBuySearchButton_OnClick()
|
||||
Aux.buy.SearchButton_onclick()
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,316 @@
|
||||
Aux.list = {}
|
||||
|
||||
local MAX_COLUMNS = 6
|
||||
|
||||
local order = {
|
||||
BUYOUT = "Buyout price",
|
||||
BID = "Bid price",
|
||||
BUYOUT_UNIT = "Unit buyout price",
|
||||
BID_UNIT = "Unit bid price",
|
||||
}
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Compare two rows
|
||||
-------------------------------------------------------------------------------
|
||||
local CurrentListFrame = nil;
|
||||
function ListTemplate_CompareRows(row1, row2)
|
||||
frame = CurrentListFrame;
|
||||
for index, value in ipairs(frame.sortOrder) do
|
||||
local column = value;
|
||||
local physicalColumn = frame.physicalColumns[column.columnIndex];
|
||||
local logicalColumn = physicalColumn.logicalColumn;
|
||||
if (logicalColumn.compareAscendingFunc and logicalColumn.compareDescendingFunc) then
|
||||
local ascending = logicalColumn.compareAscendingFunc(row1, row2);
|
||||
local descending = logicalColumn.compareDescendingFunc(row1, row2);
|
||||
if (ascending or descending) then
|
||||
if (column.sortAscending) then
|
||||
return ascending;
|
||||
else
|
||||
return descending;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return false;
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Initialize the list with the column information
|
||||
-------------------------------------------------------------------------------
|
||||
function Aux.list.initialize(frame, physicalColumns, logicalColumns)
|
||||
frame.lines = 19
|
||||
frame.lineHeight = 16
|
||||
frame.content = {}
|
||||
frame.physicalColumns = physicalColumns
|
||||
frame.logicalColumns = logicalColumns
|
||||
|
||||
frame.sortOrder = {}
|
||||
for physicalColumnIndex = 1, MAX_COLUMNS do
|
||||
local button = getglobal(frame:GetName().."Column"..physicalColumnIndex.."Sort")
|
||||
local dropdown = getglobal(frame:GetName().."Column"..physicalColumnIndex.."DropDown")
|
||||
if (physicalColumnIndex <= table.getn(physicalColumns)) then
|
||||
local physicalColumn = physicalColumns[physicalColumnIndex]
|
||||
local logicalColumn = {title='kek'} -- physicalColumn.logicalColumn
|
||||
local column = {}
|
||||
column.columnIndex = physicalColumnIndex
|
||||
column.sortAscending = true
|
||||
table.insert(frame.sortOrder, column)
|
||||
getglobal(button:GetName().."Arrow"):Hide()
|
||||
getglobal(button:GetName().."Text"):SetText(logicalColumn.title)
|
||||
button:Show()
|
||||
if (table.getn(physicalColumn.logicalColumns) > 1) then
|
||||
dropdown:Show()
|
||||
else
|
||||
dropdown:Hide()
|
||||
end
|
||||
Aux.list.set_column_width(frame, physicalColumnIndex, physicalColumn.width);
|
||||
else
|
||||
button:Hide()
|
||||
dropdown:Hide()
|
||||
end
|
||||
end
|
||||
getglobal(frame:GetName().."Column1SortArrow"):Show()
|
||||
getglobal(frame:GetName().."Column1SortArrow"):SetTexCoord(0, 0.5625, 0, 1.0)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Initialize the list with the column information
|
||||
-------------------------------------------------------------------------------
|
||||
function Aux.list.set_column_width(frame, column, width)
|
||||
-- Resize the header
|
||||
frame.physicalColumns[column].width = width
|
||||
local button = getglobal(frame:GetName().."Column"..column.."Sort")
|
||||
button:SetWidth(width + 2)
|
||||
local dropdown = getglobal(frame:GetName().."Column"..column.."DropDown")
|
||||
UIDropDownMenu_SetWidth(width - 18, dropdown)
|
||||
|
||||
-- Resize each cell in the columns
|
||||
for line = 1, frame.lines do
|
||||
local textControl = getglobal(frame:GetName().."Item"..line.."Column"..column)
|
||||
if textControl then
|
||||
textControl:SetWidth(width - 20)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-- Set the item to display.
|
||||
-------------------------------------------------------------------------------
|
||||
function ListTemplate_SetContent(frame, content)
|
||||
frame.content = content
|
||||
|
||||
-- Perform the sort.
|
||||
CurrentListFrame = frame
|
||||
table.sort(frame.content, ListTemplate_CompareRows)
|
||||
CurrentListFrame = nil
|
||||
|
||||
-- Update the scroll pane.
|
||||
ListTemplateScrollFrame_Update(getglobal(frame:GetName().."ScrollFrame"))
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
function ListTemplate_SelectRow(frame, row)
|
||||
if (frame.selectedRow ~= row) then
|
||||
local scrollFrame = getglobal(frame:GetName().."ScrollFrame");
|
||||
local firstVisibleRow = FauxScrollFrame_GetOffset(scrollFrame) + 1;
|
||||
local lastVisibleRow = firstVisibleRow + frame.lines - 1;
|
||||
|
||||
-- Deselect the previous row
|
||||
if (frame.selectedRow and firstVisibleRow <= frame.selectedRow and frame.selectedRow <= lastVisibleRow) then
|
||||
local line = frame.selectedRow - firstVisibleRow + 1;
|
||||
local item = getglobal(frame:GetName().."Item"..line);
|
||||
item:UnlockHighlight();
|
||||
end
|
||||
|
||||
-- Update the selected item
|
||||
frame.selectedRow = row;
|
||||
|
||||
-- Select the new row
|
||||
if (frame.selectedRow and firstVisibleRow <= frame.selectedRow and frame.selectedRow <= lastVisibleRow) then
|
||||
local line = frame.selectedRow - firstVisibleRow + 1;
|
||||
local item = getglobal(frame:GetName().."Item"..line);
|
||||
item:LockHighlight();
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
function Aux.list.sort(frame, columnIndex)
|
||||
-- -- Update the SortColumn order
|
||||
-- if (frame.sortOrder[1].columnIndex == columnIndex) then
|
||||
-- frame.sortOrder[1].sortAscending = not frame.sortOrder[1].sortAscending;
|
||||
-- else
|
||||
-- getglobal(frame:GetName().."Column"..frame.sortOrder[1].columnIndex.."SortArrow"):Hide();
|
||||
-- for index, value in ipairs(frame.sortOrder) do
|
||||
-- if (value.columnIndex == columnIndex) then
|
||||
-- local temp = value;
|
||||
-- table.remove(frame.sortOrder, index);
|
||||
-- table.insert(frame.sortOrder, 1, temp);
|
||||
-- break;
|
||||
-- end
|
||||
-- end
|
||||
-- frame.sortOrder[1].sortAscending = true;
|
||||
-- getglobal(frame:GetName().."Column"..frame.sortOrder[1].columnIndex.."SortArrow"):Show();
|
||||
-- end
|
||||
|
||||
-- -- Perform the sort.
|
||||
-- CurrentListFrame = frame;
|
||||
-- table.sort(frame.content, ListTemplate_CompareRows);
|
||||
-- CurrentListFrame = nil;
|
||||
|
||||
-- -- Update the sort arrow.
|
||||
-- if (frame.sortOrder[1].sortAscending) then
|
||||
-- getglobal(frame:GetName().."Column"..frame.sortOrder[1].columnIndex.."SortArrow"):SetTexCoord(0, 0.5625, 0, 1.0);
|
||||
-- else
|
||||
-- getglobal(frame:GetName().."Column"..frame.sortOrder[1].columnIndex.."SortArrow"):SetTexCoord(0, 0.5625, 1.0, 0);
|
||||
-- end
|
||||
|
||||
-- -- Update the scroll pane.
|
||||
-- ListTemplateScrollFrame_Update(getglobal(frame:GetName().."ScrollFrame"));
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
function ListTemplateScrollFrame_Update(frame)
|
||||
if (not frame) then frame = this end;
|
||||
local parent = frame:GetParent();
|
||||
local content = parent.content;
|
||||
FauxScrollFrame_Update(frame, table.getn(content), parent.lines, parent.lineHeight);
|
||||
for line = 1, parent.lines do
|
||||
local item = getglobal(parent:GetName().."Item"..line);
|
||||
local contentIndex = line + FauxScrollFrame_GetOffset(frame);
|
||||
if contentIndex <= table.getn(content) then
|
||||
for columnIndex = 1, MAX_COLUMNS do
|
||||
-- Get the text control (if any)
|
||||
local text = getglobal(parent:GetName().."Item"..line.."Column"..columnIndex);
|
||||
if (text) then
|
||||
text:Hide();
|
||||
end
|
||||
|
||||
-- Get the money frame (if any)
|
||||
local moneyFrame = getglobal(parent:GetName().."Item"..line.."Column"..columnIndex.."MoneyFrame");
|
||||
if (moneyFrame) then
|
||||
moneyFrame:Hide();
|
||||
end
|
||||
|
||||
-- If the column exists, update it
|
||||
if (columnIndex <= table.getn(parent.physicalColumns)) then
|
||||
local physicalColumn = parent.physicalColumns[columnIndex];
|
||||
local logicalColumn = physicalColumn.logicalColumn;
|
||||
local value = logicalColumn.valueFunc(content[contentIndex]);
|
||||
|
||||
-- Setup the control based on the datatype
|
||||
if (value) then
|
||||
if (text and (logicalColumn.dataType == "Date" or logicalColumn.dataType == "Number" or logicalColumn.dataType == "String")) then
|
||||
text:SetText(value);
|
||||
if (logicalColumn.colorFunc) then
|
||||
local color = logicalColumn.colorFunc(content[contentIndex]);
|
||||
text:SetTextColor(color.r, color.g, color.b);
|
||||
else
|
||||
text:SetTextColor(255, 255, 255);
|
||||
end
|
||||
if (logicalColumn.alphaFunc) then
|
||||
text:SetAlpha(logicalColumn.alphaFunc(content[contentIndex]));
|
||||
else
|
||||
text:SetAlpha(1.0);
|
||||
end
|
||||
if (logicalColumn.dataType == "Number") then
|
||||
text:SetJustifyH("RIGHT");
|
||||
else
|
||||
text:SetJustifyH("LEFT");
|
||||
end
|
||||
text:Show();
|
||||
elseif (moneyFrame and logicalColumn.dataType == "Money") then
|
||||
if (value >= 0) then
|
||||
MoneyFrame_Update(moneyFrame:GetName(), value);
|
||||
SetMoneyFrameColor(moneyFrame:GetName(), 255, 255, 255);
|
||||
else
|
||||
MoneyFrame_Update(moneyFrame:GetName(), -value);
|
||||
SetMoneyFrameColor(moneyFrame:GetName(), 255, 0, 0);
|
||||
end
|
||||
if (logicalColumn.alphaFunc) then
|
||||
moneyFrame:SetAlpha(logicalColumn.alphaFunc(content[contentIndex]));
|
||||
else
|
||||
moneyFrame:SetAlpha(1.0);
|
||||
end
|
||||
moneyFrame:Show();
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Update the row highlight
|
||||
if (parent.selectedRow and parent.selectedRow == contentIndex) then
|
||||
item:LockHighlight();
|
||||
else
|
||||
item:UnlockHighlight();
|
||||
end
|
||||
item:Show();
|
||||
else
|
||||
item:Hide();
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
function Aux.list.dropdown_onload()
|
||||
getglobal(this:GetName().."Text"):Hide()
|
||||
this.initialize = ListTemplate_DropDown_Initialize
|
||||
UIDropDownMenu_SetSelectedID(this, 1)
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
function ListTemplate_DropDown_Initialize()
|
||||
local dropdown = this:GetParent()
|
||||
local frame = dropdown:GetParent()
|
||||
|
||||
-- if (frame.physicalColumns) then
|
||||
-- local physicalColumnIndex = dropdown:GetID();
|
||||
-- local physicalColumn = frame.physicalColumns[physicalColumnIndex];
|
||||
-- for index, value in pairs(physicalColumn.logicalColumns) do
|
||||
-- local logicalColumn = value;
|
||||
-- local info = {};
|
||||
-- info.text = logicalColumn.title;
|
||||
-- info.func = ListTemplate_DropDownItem_OnClick;
|
||||
-- info.owner = dropdown;
|
||||
-- UIDropDownMenu_AddButton(info);
|
||||
-- end
|
||||
-- end
|
||||
|
||||
for _, name in pairs(order) do
|
||||
UIDropDownMenu_AddButton({
|
||||
text = name,
|
||||
owner = dropdown,
|
||||
func = Aux.list.dropdown_item_onclick
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
-------------------------------------------------------------------------------
|
||||
function Aux.list.dropdown_item_onclick()
|
||||
-- local logicalColumnIndex = this:GetID()
|
||||
-- local physicalColumnIndex = this.owner:GetID()
|
||||
-- local dropdown = this.owner
|
||||
-- local frame = dropdown:GetParent()
|
||||
-- if (frame.physicalColumns[physicalColumnIndex].logicalColumn ~= frame.physicalColumns[physicalColumnIndex].logicalColumns[logicalColumnIndex]) then
|
||||
-- -- Change the physical column's logical column
|
||||
-- frame.physicalColumns[physicalColumnIndex].logicalColumn = frame.physicalColumns[physicalColumnIndex].logicalColumns[logicalColumnIndex]
|
||||
-- getglobal(frame:GetName().."Column"..physicalColumnIndex.."SortText"):SetText(frame.physicalColumns[physicalColumnIndex].logicalColumn.title)
|
||||
|
||||
-- -- Sort the content based on the new logical column
|
||||
-- CurrentListFrame = frame;
|
||||
-- table.sort(frame.content, ListTemplate_CompareRows)
|
||||
-- CurrentListFrame = nil
|
||||
|
||||
-- -- Update the combo and scroll pane.
|
||||
-- UIDropDownMenu_SetSelectedID(dropdown, logicalColumnIndex)
|
||||
-- ListTemplateScrollFrame_Update(getglobal(frame:GetName().."ScrollFrame"))
|
||||
-- end
|
||||
end
|
||||
|
||||
|
||||
@@ -0,0 +1,439 @@
|
||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||
|
||||
<Script file="list.lua"/>
|
||||
|
||||
<!-- <Button name="ListItemTemplate" hidden="true" virtual="true">
|
||||
<Size>
|
||||
<AbsDimension x="605" y="16"/>
|
||||
</Size>
|
||||
<Layers>
|
||||
<Layer level="BORDER">
|
||||
<FontString name="$parentColumn1" inherits="GameFontHighlight" wraponspaces="false" justifyH="LEFT">
|
||||
<Size>
|
||||
<AbsDimension x="100" y="16"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="10" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString name="$parentColumn2" inherits="GameFontHighlight" wraponspaces="false" justifyH="LEFT">
|
||||
<Size>
|
||||
<AbsDimension x="100" y="16"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="$parentColumn1" relativePoint="TOPRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="20" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString name="$parentColumn3" inherits="GameFontHighlight" wraponspaces="false" justifyH="LEFT">
|
||||
<Size>
|
||||
<AbsDimension x="100" y="16"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="$parentColumn2" relativePoint="TOPRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="20" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString name="$parentColumn4" inherits="GameFontHighlight" wraponspaces="false" justifyH="LEFT">
|
||||
<Size>
|
||||
<AbsDimension x="100" y="16"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="$parentColumn3" relativePoint="TOPRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="20" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString name="$parentColumn5" inherits="GameFontHighlight" wraponspaces="false" justifyH="LEFT">
|
||||
<Size>
|
||||
<AbsDimension x="100" y="16"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="$parentColumn4" relativePoint="TOPRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="20" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString name="$parentColumn6" inherits="GameFontHighlight" wraponspaces="false" justifyH="RIGHT">
|
||||
<Size>
|
||||
<AbsDimension x="100" y="16"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="$parentColumn5" relativePoint="TOPRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="20" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<Frame name="$parentColumn3MoneyFrame" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT" relativeTo="$parentColumn3" relativePoint="TOPRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="10" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad();
|
||||
MoneyFrame_SetType("AUCTIONEER");
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Frame name="$parentColumn4MoneyFrame" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT" relativeTo="$parentColumn4" relativePoint="TOPRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="10" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad();
|
||||
MoneyFrame_SetType("AUCTIONEER");
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Frame name="$parentColumn5MoneyFrame" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT" relativeTo="$parentColumn5" relativePoint="TOPRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="10" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad();
|
||||
MoneyFrame_SetType("AUCTIONEER");
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Frame name="$parentColumn6MoneyFrame" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT" relativeTo="$parentColumn6" relativePoint="TOPRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="10" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad();
|
||||
MoneyFrame_SetType("AUCTIONEER");
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Button> -->
|
||||
|
||||
<Button name="ListSortButtonTemplate" virtual="true">
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<Texture name="$parentLeft" file="Interface\FriendsFrame\WhoFrame-ColumnTabs">
|
||||
<Size>
|
||||
<AbsDimension x="5" y="24"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT"/>
|
||||
</Anchors>
|
||||
<TexCoords left="0" right="0.078125" top="0" bottom="0.59375"/>
|
||||
</Texture>
|
||||
<Texture name="$parentRight" file="Interface\FriendsFrame\WhoFrame-ColumnTabs">
|
||||
<Size>
|
||||
<AbsDimension x="4" y="24"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT"/>
|
||||
</Anchors>
|
||||
<TexCoords left="0.90625" right="0.96875" top="0" bottom="0.59375"/>
|
||||
</Texture>
|
||||
<Texture name="$parentMiddle" file="Interface\FriendsFrame\WhoFrame-ColumnTabs">
|
||||
<Size>
|
||||
<AbsDimension x="10" y="24"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT"/>
|
||||
<Anchor point="RIGHT" relativeTo="$parentRight" relativePoint="LEFT"/>
|
||||
</Anchors>
|
||||
<TexCoords left="0.078125" right="0.90625" top="0" bottom="0.59375"/>
|
||||
</Texture>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<NormalText name="$parentText" inherits="GameFontHighlightSmall">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="8" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</NormalText>
|
||||
<NormalTexture name="$parentArrow" hidden="true" file="Interface\Buttons\UI-SortArrow">
|
||||
<Size>
|
||||
<AbsDimension x="9" y="8"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentText" relativePoint="RIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="3" y="-2"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<TexCoords left="0" right="0.5625" top="0" bottom="1.0"/>
|
||||
</NormalTexture>
|
||||
<HighlightTexture file="Interface\PaperDollInfoFrame\UI-Character-Tab-Highlight" alphaMode="ADD">
|
||||
<Size>
|
||||
<AbsDimension x="5" y="24"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
<Anchor point="RIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="4" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</HighlightTexture>
|
||||
</Button>
|
||||
|
||||
<Frame name="ListTemplate" virtual="true">
|
||||
<Frames>
|
||||
<Button name="$parentColumn1Sort" inherits="ListSortButtonTemplate">
|
||||
<Size><AbsDimension x="134" y="24"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.list.sort(this:GetParent(), 1)
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Frame name="$parentColumn1DropDown" inherits="UIDropDownMenuTemplate" id="1"><Anchors><Anchor point="LEFT" relativeTo="$parentColumn1Sort" relativePoint="LEFT"><Offset><AbsDimension x="-14" y="-3"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
Aux.list.dropdown_onload()
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Button name="$parentColumn2Sort" inherits="ListSortButtonTemplate">
|
||||
<Size><AbsDimension x="44" y="24"/></Size>
|
||||
<Anchors><Anchor point="LEFT" relativeTo="$parentColumn1Sort" relativePoint="RIGHT"><Offset><AbsDimension x="-2" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.list.sort(this:GetParent(), 2)
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Frame name="$parentColumn2DropDown" inherits="UIDropDownMenuTemplate" id="2">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentColumn2Sort" relativePoint="LEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="-14" y="-3"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
Aux.list.dropdown_onload()
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Button name="$parentColumn3Sort" inherits="ListSortButtonTemplate">
|
||||
<Size>
|
||||
<AbsDimension x="174" y="24"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentColumn2Sort" relativePoint="RIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="-2" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.list.sort(this:GetParent(), 3)
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Frame name="$parentColumn3DropDown" inherits="UIDropDownMenuTemplate" id="3">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentColumn3Sort" relativePoint="LEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="-14" y="-3"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
Aux.list.dropdown_onload()
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Button name="$parentColumn4Sort" inherits="ListSortButtonTemplate">
|
||||
<Size>
|
||||
<AbsDimension x="174" y="24"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentColumn3Sort" relativePoint="RIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="-2" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.list.sort(this:GetParent(), 4)
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Frame name="$parentColumn4DropDown" inherits="UIDropDownMenuTemplate" id="4">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentColumn4Sort" relativePoint="LEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="-15" y="-3"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
Aux.list.dropdown_onload()
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Button name="$parentColumn5Sort" inherits="ListSortButtonTemplate">
|
||||
<Size>
|
||||
<AbsDimension x="174" y="24"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentColumn4Sort" relativePoint="RIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="-2" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.list.sort(this:GetParent(), 5)
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Frame name="$parentColumn5DropDown" inherits="UIDropDownMenuTemplate" id="5">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentColumn5Sort" relativePoint="LEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="-14" y="-3"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
Aux.list.dropdown_onload()
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Button name="$parentColumn6Sort" inherits="ListSortButtonTemplate">
|
||||
<Size>
|
||||
<AbsDimension x="174" y="24"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentColumn5Sort" relativePoint="RIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="-2" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
Aux.list.sort(this:GetParent(), 6)
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Frame name="$parentColumn6DropDown" inherits="UIDropDownMenuTemplate" id="6">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentColumn6Sort" relativePoint="LEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="-14" y="-3"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
Aux.list.dropdown_onload()
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<!-- <ScrollFrame name="$parentScrollFrame" inherits="FauxScrollFrameTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="2" y="-28"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
<Anchor point="BOTTOMRIGHT" relativePoint="BOTTOMRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="ARTWORK">
|
||||
<Texture file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
|
||||
<Size>
|
||||
<AbsDimension x="31" y="256"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativePoint="TOPRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="-2" y="5"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<TexCoords left="0" right="0.484375" top="0" bottom="1.0"/>
|
||||
</Texture>
|
||||
<Texture file="Interface\PaperDollInfoFrame\UI-Character-ScrollBar">
|
||||
<Size>
|
||||
<AbsDimension x="31" y="106"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT" relativePoint="BOTTOMRIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="-2" y="-2"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<TexCoords left="0.515625" right="1.0" top="0" bottom="0.4140625"/>
|
||||
</Texture>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<OnVerticalScroll>
|
||||
FauxScrollFrame_OnVerticalScroll(16, ListTemplateScrollFrame_Update)
|
||||
</OnVerticalScroll>
|
||||
</Scripts>
|
||||
</ScrollFrame> -->
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Ui>
|
||||
@@ -1,6 +1,6 @@
|
||||
Aux.scan = {}
|
||||
|
||||
local NUM_AUCTION_ITEMS_PER_PAGE = 50
|
||||
Aux.scan.MAX_AUCTIONS_PER_PAGE = 50
|
||||
|
||||
local current_job
|
||||
local current_page
|
||||
@@ -8,54 +8,66 @@ local page_state
|
||||
|
||||
local last_queried = GetTime()
|
||||
|
||||
local timeout
|
||||
local processing
|
||||
|
||||
-- forward declaration of local functions
|
||||
local submit_query, process_query_results
|
||||
local submit_query, start_processing_page
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function Aux.scan.on_event()
|
||||
if event == "AUCTION_ITEM_LIST_UPDATE" and current_job and not page_state and not timeout then
|
||||
timeout = true
|
||||
page_state = {} -- careful, race conditions
|
||||
local count, total_count = GetNumAuctionItems("list")
|
||||
page_state.index = 1
|
||||
page_state.count = count
|
||||
page_state.total_count = total_count
|
||||
|
||||
if current_job.on_start_page then
|
||||
current_job.on_start_page(current_page)
|
||||
end
|
||||
if event == "AUCTION_ITEM_LIST_UPDATE" and current_job and not page_state and not processing then
|
||||
processing = true -- careful, race conditions
|
||||
start_processing_page()
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function start_processing_page()
|
||||
page_state = {}
|
||||
local count, total_count = GetNumAuctionItems("list")
|
||||
page_state.index = 1
|
||||
page_state.count = count
|
||||
page_state.total_count = total_count
|
||||
|
||||
if current_job.on_start_page then
|
||||
current_job.on_start_page(current_page)
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function Aux.scan.on_update()
|
||||
if current_job and CanSendAuctionQuery() then
|
||||
timeout = false
|
||||
end
|
||||
|
||||
if page_state then
|
||||
if page_state.index <= page_state.count and current_job.on_read_auction then
|
||||
current_job.on_read_auction(page_state.index)
|
||||
end
|
||||
|
||||
if page_state.index == page_state.count then
|
||||
if page_state.index == NUM_AUCTION_ITEMS_PER_PAGE then
|
||||
current_page = current_job.next_page and current_job.next_page(current_page, page_state.count, page_state.total_count)
|
||||
if current_page then
|
||||
page_state = nil
|
||||
current_page = current_page + 1
|
||||
else
|
||||
Aux.scan.complete()
|
||||
end
|
||||
end
|
||||
|
||||
-- if page_state.index == page_state.count then
|
||||
-- if page_state.index == MAX_AUCTIONS_PER_PAGE then
|
||||
-- page_state = nil
|
||||
-- current_page = current_page + 1
|
||||
-- else
|
||||
-- Aux.scan.complete()
|
||||
-- end
|
||||
-- end
|
||||
|
||||
if page_state then
|
||||
page_state.index = min(page_state.index + 1, page_state.count)
|
||||
end
|
||||
|
||||
elseif current_job and not timeout then
|
||||
elseif current_job and CanSendAuctionQuery() then
|
||||
processing = false
|
||||
submit_query()
|
||||
end
|
||||
end
|
||||
@@ -96,7 +108,11 @@ function Aux.scan.start(job)
|
||||
Aux.scan.abort()
|
||||
|
||||
current_job = job
|
||||
current_page = 0
|
||||
current_page = job.start_page
|
||||
|
||||
if not current_page then
|
||||
start_processing_page()
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
@@ -300,11 +300,12 @@ function Aux_RefreshEntries()
|
||||
|
||||
set_message('Scanning auctions ...')
|
||||
Aux.scan.start{
|
||||
query = Aux.scan.create_query{
|
||||
query = {
|
||||
name = name,
|
||||
class = class_index,
|
||||
subclass = subclass_index,
|
||||
},
|
||||
start_page = 0,
|
||||
on_start_page = function(i)
|
||||
set_message('Scanning auctions: page ' .. i + 1 .. ' ...')
|
||||
end,
|
||||
@@ -323,6 +324,11 @@ function Aux_RefreshEntries()
|
||||
Aux_SelectAuxEntry()
|
||||
Aux_UpdateRecommendation()
|
||||
end,
|
||||
next_page = function(page, auctions)
|
||||
if auctions == Aux.scan.MAX_AUCTIONS_PER_PAGE then
|
||||
return page + 1
|
||||
end
|
||||
end,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user