starting to add some more refined filters to buy, preparing for merge with browse
This commit is contained in:
@@ -23,9 +23,13 @@ function AuxBuySearchButton_OnClick()
|
||||
|
||||
Aux_Buy_ScrollbarUpdate()
|
||||
|
||||
local category = UIDropDownMenu_GetSelectedValue(AuxBuyCategoryDropDown)
|
||||
|
||||
search_query = Aux.scan.create_query{
|
||||
name = AuxBuySearchBox:GetText(),
|
||||
exactMatch = true,
|
||||
invTypeIndex = category and category.type,
|
||||
classIndex = category and category.class,
|
||||
subclassIndex = category and category.subclass,
|
||||
}
|
||||
|
||||
set_message('Scanning auctions ...')
|
||||
@@ -41,7 +45,7 @@ function AuxBuySearchButton_OnClick()
|
||||
end
|
||||
|
||||
local stack_size = auction_item.charges or auction_item.count
|
||||
if auction_item.name == search_query.name then
|
||||
if auction_item.name == search_query.name or name == '' or not AuxBuyExactCheckButton:GetChecked() then
|
||||
record_auction(auction_item.name, stack_size, auction_item.buyout_price, auction_item.quality, auction_item.owner, auction_item.itemlink)
|
||||
end
|
||||
end,
|
||||
@@ -278,35 +282,117 @@ function Aux_Buy_ScrollbarUpdate()
|
||||
lineEntry:Hide()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function report(completed, item_name, ordered_count, progress)
|
||||
|
||||
function report(completed, item_name, ordered_count, progress)
|
||||
|
||||
AuxBuyReportHTML:SetText(string.format(
|
||||
[[
|
||||
<html>
|
||||
<body>
|
||||
<h1>Aux Buy Report%s</h1>
|
||||
AuxBuyReportHTML:SetText(string.format(
|
||||
[[
|
||||
<html>
|
||||
<body>
|
||||
<h1>Aux Buy Report%s</h1>
|
||||
<br/>
|
||||
<p>
|
||||
%i out of %i ordered auctions of %s purchased
|
||||
<br/><br/>
|
||||
Total units purchased: %i
|
||||
<br/>
|
||||
<p>
|
||||
%i out of %i ordered auctions of %s purchased
|
||||
<br/><br/>
|
||||
Total units purchased: %i
|
||||
<br/>
|
||||
Total expense: %s
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
]],
|
||||
completed and '' or ' (Aborted)',
|
||||
progress.auctions,
|
||||
ordered_count,
|
||||
item_name,
|
||||
progress.units,
|
||||
Aux.util.format_money(progress.expense)
|
||||
))
|
||||
|
||||
AuxBuyReportHTML:SetSpacing(3)
|
||||
Total expense: %s
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
]],
|
||||
completed and '' or ' (Aborted)',
|
||||
progress.auctions,
|
||||
ordered_count,
|
||||
item_name,
|
||||
progress.units,
|
||||
Aux.util.format_money(progress.expense)
|
||||
))
|
||||
|
||||
AuxBuyReport:Show()
|
||||
AuxBuyReportHTML:SetSpacing(3)
|
||||
|
||||
AuxBuyReport:Show()
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function AuxBuyCategoryDropDown_Initialize(arg1)
|
||||
local level = arg1 or 1
|
||||
|
||||
if level == 1 then
|
||||
local value = {}
|
||||
UIDropDownMenu_AddButton({
|
||||
text= 'All',
|
||||
value = value,
|
||||
func = AuxBuyCategoryDropDown_OnClick('All', value),
|
||||
}, 1)
|
||||
|
||||
for i, class in pairs({ GetAuctionItemClasses() }) do
|
||||
local value = { class = i }
|
||||
UIDropDownMenu_AddButton({
|
||||
hasArrow = GetAuctionItemSubClasses(value.class),
|
||||
text = class,
|
||||
value = value,
|
||||
func = AuxBuyCategoryDropDown_OnClick(class, value),
|
||||
}, 1)
|
||||
end
|
||||
end
|
||||
|
||||
if level == 2 then
|
||||
local menu_value = UIDROPDOWNMENU_MENU_VALUE
|
||||
for i, subclass in pairs({ GetAuctionItemSubClasses(menu_value.class) }) do
|
||||
local value = { class = menu_value.class, subclass = i }
|
||||
UIDropDownMenu_AddButton({
|
||||
hasArrow = GetAuctionInvTypes(value.class, value.subclass),
|
||||
text = subclass,
|
||||
value = value,
|
||||
func = AuxBuyCategoryDropDown_OnClick(subclass, value),
|
||||
}, 2)
|
||||
end
|
||||
end
|
||||
|
||||
if level == 3 then
|
||||
local menu_value = UIDROPDOWNMENU_MENU_VALUE
|
||||
for i, type in pairs({ GetAuctionInvTypes(menu_value.class, menu_value.subclass) }) do
|
||||
local type_name = getglobal(type)
|
||||
local value = { class = menu_value.class, subclass = menu_value.subclass, type = i }
|
||||
UIDropDownMenu_AddButton({
|
||||
text = type_name,
|
||||
value = value,
|
||||
func = AuxBuyCategoryDropDown_OnClick(type_name, value),
|
||||
}, 3)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function AuxBuyCategoryDropDown_OnClick(text, value)
|
||||
return function()
|
||||
UIDropDownMenu_SetSelectedValue(AuxBuyCategoryDropDown, value)
|
||||
UIDropDownMenu_SetText(text, AuxBuyCategoryDropDown) -- shouldn't be necessary ...
|
||||
CloseDropDownMenus(1) -- nor this
|
||||
end
|
||||
end
|
||||
|
||||
function AuxBuySlotDropDown_Initialize(arg1)
|
||||
|
||||
UIDropDownMenu_AddButton{
|
||||
text= 'All',
|
||||
value = value,
|
||||
func = AuxBuySlotDropDown_OnClick('All', value),
|
||||
}
|
||||
|
||||
-- for i, type in pairs({ GetAuctionInvTypes() }) do
|
||||
-- UIDropDownMenu_AddButton{
|
||||
-- text = class,
|
||||
-- value = i,
|
||||
-- func = AuxBuySlotDropDown_OnClick(),
|
||||
-- }
|
||||
-- end
|
||||
end
|
||||
|
||||
function AuxBuySlotDropDown_OnClick()
|
||||
UIDropDownMenu_SetSelectedValue(AuxBuySlotDropDown, this.value)
|
||||
end
|
||||
@@ -95,10 +95,6 @@
|
||||
<FontString name="AuxBuyMessage" inherits="GameFontNormal">
|
||||
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="70" y="-120"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
|
||||
<FontString name="AuxBuySearchBoxLabel" inherits="GameFontHighlightSmall" text="Search For">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="160" y="-50"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
<Layer level="ARTWORK">
|
||||
<FontString name="AuxBuyTotalLabel" inherits="GameFontHighlightSmall" text="Total">
|
||||
@@ -140,30 +136,75 @@
|
||||
</Layer>
|
||||
</Layers>
|
||||
|
||||
<Frames>
|
||||
<EditBox name="AuxBuySearchBox" autoFocus="false" inherits="InputBoxTemplate">
|
||||
<Size><AbsDimension x="240" y="20"/></Size>
|
||||
<Anchors><Anchor point="LEFT" relativeTo="AuxBuySearchBoxLabel" relativePoint="RIGHT"><Offset><AbsDimension x="10" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnChar>
|
||||
Aux.util.item_name_autocomplete()
|
||||
</OnChar>
|
||||
<OnEnterPressed>
|
||||
this:ClearFocus()
|
||||
AuxBuySearchButton_OnClick()
|
||||
</OnEnterPressed>
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
|
||||
<Button name="AuxBuySearchButton" inherits="UIPanelButtonTemplate" text="Search">
|
||||
<Size><AbsDimension x="80" y="22"/></Size>
|
||||
<Anchors><Anchor point="LEFT" relativeTo="AuxBuySearchBox" relativePoint="RIGHT"><Offset><AbsDimension x="10" y="1" /></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
AuxBuySearchButton_OnClick()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Frames>
|
||||
<Frame name="AuxBuyFilters">
|
||||
<Size><AbsDimension x="1" y="1"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="80" y="-55"/></Offset></Anchor></Anchors>
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<FontString name="AuxBuySearchBoxLabel" inherits="GameFontHighlightSmall" text="Name">
|
||||
<Anchors><Anchor point="LEFT"><Offset><AbsDimension x="0" y="1" /></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
|
||||
<FontString name="AuxBuyExactLabel" inherits="GameFontHighlightSmall" text="Exact">
|
||||
<Anchors><Anchor point="LEFT"><Offset><AbsDimension x="240" y="1" /></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<EditBox name="AuxBuySearchBox" autoFocus="false" inherits="InputBoxTemplate">
|
||||
<Size><AbsDimension x="180" y="20"/></Size>
|
||||
<Anchors><Anchor point="LEFT"><Offset><AbsDimension x="50" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnChar>
|
||||
Aux.util.item_name_autocomplete()
|
||||
</OnChar>
|
||||
<OnEnterPressed>
|
||||
this:ClearFocus()
|
||||
AuxBuySearchButton_OnClick()
|
||||
</OnEnterPressed>
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
<CheckButton name="AuxBuyExactCheckButton" inherits="UICheckButtonTemplate" checked="true">
|
||||
<Size><AbsDimension x="24" y="24"/></Size>
|
||||
<Anchors><Anchor point="LEFT"><Offset><AbsDimension x="270" y="1" /></Offset></Anchor></Anchors>
|
||||
</CheckButton>
|
||||
|
||||
<Button name="AuxBuySearchButton" inherits="UIPanelButtonTemplate" text="Search">
|
||||
<Size><AbsDimension x="80" y="22"/></Size>
|
||||
<Anchors><Anchor point="LEFT"><Offset><AbsDimension x="300" y="1" /></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
AuxBuySearchButton_OnClick()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<Frame name="AuxBuyCategoryDropDown" inherits="UIDropDownMenuTemplate">
|
||||
<Anchors><Anchor point="LEFT"><Offset><AbsDimension x="380" y="1" /></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
UIDropDownMenu_Initialize(this, AuxBuyCategoryDropDown_Initialize)
|
||||
</OnLoad>
|
||||
<OnShow>
|
||||
UIDropDownMenu_Initialize(this, AuxBuyCategoryDropDown_Initialize)
|
||||
</OnShow>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
|
||||
<!-- <Frame name="AuxBuySlotDropDown" inherits="UIDropDownMenuTemplate">
|
||||
<Anchors><Anchor point="LEFT"><Offset><AbsDimension x="500" y="1" /></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
UIDropDownMenu_Initialize(this, AuxBuySlotDropDown_Initialize)
|
||||
</OnLoad>
|
||||
<OnShow>
|
||||
UIDropDownMenu_Initialize(this, AuxBuySlotDropDown_Initialize)
|
||||
</OnShow>
|
||||
</Scripts>
|
||||
</Frame> -->
|
||||
</Frames>
|
||||
</Frame>
|
||||
|
||||
<Button name="AuxBuyBuySelectedButton" inherits="UIPanelButtonTemplate" text="Buy Selected Auctions">
|
||||
<Size><AbsDimension x="166" y="22"/></Size>
|
||||
@@ -196,16 +237,6 @@
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
|
||||
<!-- <Frame name="BidBidPrice" inherits="MoneyInputFrameTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOM">
|
||||
<Offset>
|
||||
<AbsDimension x="-15" y="18"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Frame> -->
|
||||
|
||||
<ScrollFrame name="AuxBuyScrollFrame" inherits="FauxScrollFrameTemplate">
|
||||
<Size><AbsDimension x="785" y="309"/></Size>
|
||||
|
||||
@@ -15,15 +15,15 @@ local submit_query, process_query_results
|
||||
|
||||
function Aux.scan.on_event()
|
||||
if event == "AUCTION_ITEM_LIST_UPDATE" and current_job and not page_state then
|
||||
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
|
||||
page_state = {
|
||||
index = 1,
|
||||
count = count,
|
||||
total_count = total_count,
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user