improved buy dialogs
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
Aux.buy = {}
|
||||
|
||||
local record_auction, set_message, report, tooltip_match, show_buyout_dialog, show_bid_dialog
|
||||
local process_auction, set_message, report, tooltip_match, show_buyout_dialog, show_bid_dialog
|
||||
local entries
|
||||
local selectedEntries = {}
|
||||
local search_query
|
||||
@@ -77,19 +77,8 @@ function Aux.buy.SearchButton_onclick()
|
||||
on_read_auction = function(k, i)
|
||||
local auction_item = Aux.info.auction_item(i)
|
||||
if auction_item then
|
||||
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(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,
|
||||
current_page
|
||||
)
|
||||
process_auction(auction_item, current_page)
|
||||
end
|
||||
end
|
||||
k()
|
||||
@@ -138,11 +127,11 @@ function show_buyout_dialog(hyperlink, stack_size, buyout_price)
|
||||
hyperlink,
|
||||
stack_size
|
||||
))
|
||||
--MoneyFrame_Update('AuxBuyBuyoutDialogBuyoutPrice', Aux_Round(buyout_price))
|
||||
MoneyFrame_Update('AuxBuyBuyoutDialogBuyoutPrice', buyout_price)
|
||||
AuxBuyBuyoutDialog:Show()
|
||||
end
|
||||
|
||||
function show_bid_dialog(hyperlink, stack_size, bid)
|
||||
function show_bid_dialog(hyperlink, stack_size, highest_bid, min_increment)
|
||||
AuxBuyBidDialogBidButton:Disable()
|
||||
AuxBuyBidDialogHTML:SetFontObject('h1', GameFontWhite)
|
||||
AuxBuyBidDialogHTML:SetScript('OnHyperlinkClick', function() SetItemRef(arg1) end)
|
||||
@@ -158,7 +147,8 @@ function show_bid_dialog(hyperlink, stack_size, bid)
|
||||
stack_size
|
||||
))
|
||||
AuxBuyBidDialog:Show()
|
||||
MoneyInputFrame_SetCopper(AuxBuyBidDialogBid, 5)
|
||||
MoneyFrame_Update('AuxBuyBuyoutDialogBuyoutPrice', buyout_price)
|
||||
MoneyInputFrame_SetCopper(AuxBuyBidDialogBid, highest_bid + min_increment)
|
||||
end
|
||||
|
||||
function AuxBuyEntry_OnClick()
|
||||
@@ -266,24 +256,23 @@ end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function record_auction(name, tooltip, stack_size, buyout_price, quality, owner, hyperlink, itemstring, page)
|
||||
function process_auction(auction_item, current_page)
|
||||
entries = entries or {}
|
||||
|
||||
if buyout_price > 0 and owner ~= UnitName("player") then
|
||||
local stack_size = auction_item.charges or auction_item.count
|
||||
if auction_item.buyout_price > 0 and auction_item.owner ~= UnitName("player") then
|
||||
tinsert(entries, {
|
||||
name = name,
|
||||
tooltip = tooltip,
|
||||
name = auction_item.name,
|
||||
tooltip = auction_item.tooltip,
|
||||
stack_size = stack_size,
|
||||
buyout_price = buyout_price,
|
||||
item_price = buyout_price / stack_size,
|
||||
quality = quality,
|
||||
hyperlink = hyperlink,
|
||||
itemstring = itemstring,
|
||||
buyout_price = auction_item.buyout_price,
|
||||
unit_price = Aux_Round(auction_item.buyout_price / stack_size),
|
||||
quality = auction_item.quality,
|
||||
hyperlink = auction_item.hyperlink,
|
||||
itemstring = auction_item.itemstring,
|
||||
page = current_page,
|
||||
})
|
||||
end
|
||||
|
||||
table.sort(entries, function(a,b) return a.item_price < b.item_price end)
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
@@ -298,6 +287,10 @@ end
|
||||
-----------------------------------------
|
||||
|
||||
function Aux_Buy_ScrollbarUpdate()
|
||||
if entries then
|
||||
table.sort(entries, function(a,b) return a.unit_price < b.unit_price end)
|
||||
end
|
||||
|
||||
if entries and getn(entries) == 0 then
|
||||
set_message("No auctions were found")
|
||||
else
|
||||
|
||||
@@ -373,7 +373,7 @@
|
||||
<Button name="AuxBuyEntry19" inherits="AuxBuyEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="AuxBuyEntry18" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
|
||||
<Frame name="AuxBuyBuyoutDialog" frameStrata="FULLSCREEN_DIALOG" toplevel="true" enableMouse="true" hidden="true" movable="true">
|
||||
<Size><AbsDimension x="260" y="160" /></Size>
|
||||
<Size><AbsDimension x="230" y="140" /></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="300" y="-150"/></Offset></Anchor></Anchors>
|
||||
|
||||
<Scripts>
|
||||
@@ -388,30 +388,21 @@
|
||||
</Backdrop>
|
||||
<Frames>
|
||||
<SimpleHTML name="$parentHTML">
|
||||
<Size><AbsDimension x="260" y="160" /></Size>
|
||||
<Size><AbsDimension x="200" y="110" /></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor></Anchors>
|
||||
<FontStringHeader1 inherits="GameFontNormalWhite"/>
|
||||
</SimpleHTML>
|
||||
<Frame>
|
||||
<Frame>
|
||||
<Size><AbsDimension x="120" y="16" /></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-70"/></Offset></Anchor></Anchors>
|
||||
<Frames>
|
||||
<Frame name="$parentBuyoutPrice" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors><Anchor point="RIGHT"><Offset><AbsDimension x="0" y="0"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad()
|
||||
MoneyFrame_SetType("STATIC")
|
||||
snipe.log('kek'..this:GetName())
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Frame>
|
||||
<Frame name="$parentBuyoutPrice" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-60"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad()
|
||||
MoneyFrame_SetType("STATIC")
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Button name="$parentBuyButton" inherits="UIPanelButtonTemplate" text="Buy" disabled="true">
|
||||
<Size><AbsDimension x="100" y="22"/> </Size>
|
||||
<Size><AbsDimension x="85" y="22"/> </Size>
|
||||
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="20" y="15"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
@@ -420,7 +411,7 @@
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Button name="$parentCancelButton" inherits="UIPanelButtonTemplate" text="Cancel">
|
||||
<Size><AbsDimension x="100" y="22"/> </Size>
|
||||
<Size><AbsDimension x="85" y="22"/> </Size>
|
||||
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="-20" y="15"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
@@ -433,8 +424,8 @@
|
||||
|
||||
<Frame name="AuxBuyBidDialog" frameStrata="FULLSCREEN_DIALOG" toplevel="true" enableMouse="true" hidden="true" movable="true">
|
||||
|
||||
<Size><AbsDimension x="260" y="160" /></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="300" y="-150"/></Offset></Anchor></Anchors>
|
||||
<Size><AbsDimension x="230" y="170" /></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="300" y="-135"/></Offset></Anchor></Anchors>
|
||||
|
||||
<Scripts>
|
||||
<OnLoad>this:RegisterForDrag("LeftButton")</OnLoad>
|
||||
@@ -449,14 +440,23 @@
|
||||
|
||||
<Frames>
|
||||
<SimpleHTML name="$parentHTML">
|
||||
<Size><AbsDimension x="260" y="160" /></Size>
|
||||
<Size><AbsDimension x="200" y="110" /></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor></Anchors>
|
||||
</SimpleHTML>
|
||||
<Frame name="$parentHighestBid" inherits="SmallMoneyFrameTemplate">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-60"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
SmallMoneyFrame_OnLoad()
|
||||
MoneyFrame_SetType("STATIC")
|
||||
</OnLoad>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<Frame name="$parentBid" inherits="MoneyInputFrameTemplate">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-70"/></Offset></Anchor></Anchors>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="35" y="-88"/></Offset></Anchor></Anchors>
|
||||
</Frame>
|
||||
<Button name="$parentBidButton" inherits="UIPanelButtonTemplate" text="Bid" disabled="true">
|
||||
<Size><AbsDimension x="100" y="22"/> </Size>
|
||||
<Size><AbsDimension x="85" y="22"/> </Size>
|
||||
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="20" y="15"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
@@ -465,7 +465,7 @@
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Button name="$parentCancelButton" inherits="UIPanelButtonTemplate" text="Cancel">
|
||||
<Size><AbsDimension x="100" y="22"/> </Size>
|
||||
<Size><AbsDimension x="85" y="22"/> </Size>
|
||||
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="-20" y="15"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
|
||||
Reference in New Issue
Block a user