significantly changed the buying mechanism
This commit is contained in:
@@ -6,6 +6,14 @@ local selectedEntries = {}
|
|||||||
local search_query
|
local search_query
|
||||||
local tooltip_patterns = {}
|
local tooltip_patterns = {}
|
||||||
local current_page
|
local current_page
|
||||||
|
local refresh
|
||||||
|
|
||||||
|
|
||||||
|
function Aux.buy.exit()
|
||||||
|
|
||||||
|
Aux.buy.buyout_dialog_cancel()
|
||||||
|
current_page = nil
|
||||||
|
end
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
@@ -18,6 +26,14 @@ end
|
|||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
|
function Aux.buy.buyout_dialog_cancel()
|
||||||
|
Aux.scan.abort()
|
||||||
|
AuxBuyBuyoutDialog:Hide()
|
||||||
|
AuxBuySearchButton:Enable()
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux.buy.StopButton_onclick()
|
function Aux.buy.StopButton_onclick()
|
||||||
Aux.scan.abort()
|
Aux.scan.abort()
|
||||||
end
|
end
|
||||||
@@ -32,7 +48,7 @@ function Aux.buy.SearchButton_onclick()
|
|||||||
entries = nil
|
entries = nil
|
||||||
selectedEntries = {}
|
selectedEntries = {}
|
||||||
|
|
||||||
Aux_Buy_ScrollbarUpdate()
|
refresh = true
|
||||||
|
|
||||||
local category = UIDropDownMenu_GetSelectedValue(AuxBuyCategoryDropDown)
|
local category = UIDropDownMenu_GetSelectedValue(AuxBuyCategoryDropDown)
|
||||||
local tooltip_patterns = Aux.util.set_to_array(tooltip_patterns)
|
local tooltip_patterns = Aux.util.set_to_array(tooltip_patterns)
|
||||||
@@ -77,13 +93,13 @@ function Aux.buy.SearchButton_onclick()
|
|||||||
entries = entries or {}
|
entries = entries or {}
|
||||||
AuxBuyStopButton:Hide()
|
AuxBuyStopButton:Hide()
|
||||||
AuxBuySearchButton:Show()
|
AuxBuySearchButton:Show()
|
||||||
Aux_Buy_ScrollbarUpdate()
|
refresh = true
|
||||||
end,
|
end,
|
||||||
on_abort = function()
|
on_abort = function()
|
||||||
entries = entries or {}
|
entries = entries or {}
|
||||||
AuxBuyStopButton:Hide()
|
AuxBuyStopButton:Hide()
|
||||||
AuxBuySearchButton:Show()
|
AuxBuySearchButton:Show()
|
||||||
Aux_Buy_ScrollbarUpdate()
|
refresh = true
|
||||||
end,
|
end,
|
||||||
next_page = function(page, auctions)
|
next_page = function(page, auctions)
|
||||||
if auctions == Aux.scan.MAX_AUCTIONS_PER_PAGE then
|
if auctions == Aux.scan.MAX_AUCTIONS_PER_PAGE then
|
||||||
@@ -103,10 +119,38 @@ end
|
|||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function AuxBuyEntry_OnClick()
|
function AuxBuyEntry_OnClick()
|
||||||
|
local express_mode = IsControlKeyDown()
|
||||||
|
|
||||||
AuxBuySearchButton:Disable()
|
AuxBuySearchButton:Disable()
|
||||||
|
|
||||||
local i = this:GetID()
|
local entry_index = this:GetID()
|
||||||
local entry = entries[i]
|
local entry = entries[entry_index]
|
||||||
|
|
||||||
|
if not express_mode then
|
||||||
|
AuxBuyBuyoutDialogBuyButton:Disable()
|
||||||
|
AuxBuyBuyoutDialogHTML:SetText(string.format(
|
||||||
|
[[
|
||||||
|
<html>
|
||||||
|
<body>
|
||||||
|
<h1>%s</h1>
|
||||||
|
<br/>
|
||||||
|
<p>
|
||||||
|
Stack Size: %i
|
||||||
|
<br/><br/>
|
||||||
|
Buyout Price: %s
|
||||||
|
<br/><br/>
|
||||||
|
Unit Price: %s
|
||||||
|
</p>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
]],
|
||||||
|
entry.name,
|
||||||
|
entry.stack_size,
|
||||||
|
Aux.util.format_money(entry.buyout_price),
|
||||||
|
Aux.util.format_money(entry.item_price)
|
||||||
|
))
|
||||||
|
AuxBuyBuyoutDialog:Show()
|
||||||
|
end
|
||||||
|
|
||||||
PlaySound("igMainMenuOptionCheckBoxOn")
|
PlaySound("igMainMenuOptionCheckBoxOn")
|
||||||
|
|
||||||
@@ -132,25 +176,47 @@ function AuxBuyEntry_OnClick()
|
|||||||
local key = Aux.auction_key(auction_item.tooltip, stack_size, auction_item.buyout_price)
|
local key = Aux.auction_key(auction_item.tooltip, stack_size, auction_item.buyout_price)
|
||||||
if key == order_key then
|
if key == order_key then
|
||||||
found = true
|
found = true
|
||||||
if GetMoney() >= auction_item.buyout_price then
|
|
||||||
|
if express_mode then
|
||||||
|
if GetMoney() >= auction_item.buyout_price then
|
||||||
|
tremove(entries, entry_index)
|
||||||
|
refresh = true
|
||||||
|
end
|
||||||
|
|
||||||
PlaceAuctionBid("list", i, auction_item.buyout_price)
|
PlaceAuctionBid("list", i, auction_item.buyout_price)
|
||||||
tremove(entries,i)
|
|
||||||
|
|
||||||
Aux.scan.abort()
|
Aux.scan.abort()
|
||||||
|
else
|
||||||
|
Aux.buy.buyout_dialog_buy = function()
|
||||||
|
if GetMoney() >= auction_item.buyout_price then
|
||||||
|
tremove(entries, entry_index)
|
||||||
|
refresh = true
|
||||||
|
end
|
||||||
|
|
||||||
|
PlaceAuctionBid("list", i, auction_item.buyout_price)
|
||||||
|
|
||||||
|
Aux.scan.abort()
|
||||||
|
AuxBuySearchButton:Enable()
|
||||||
|
AuxBuyBuyoutDialog:Hide()
|
||||||
|
end
|
||||||
|
AuxBuyBuyoutDialogBuyButton:Enable()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
on_complete = function()
|
on_complete = function()
|
||||||
if not found then
|
if not found then
|
||||||
tremove(entries,i)
|
tremove(entries, entry_index)
|
||||||
|
refresh = true
|
||||||
|
Aux.buy.buyout_dialog_cancel()
|
||||||
|
end
|
||||||
|
if express_mode then
|
||||||
|
AuxBuySearchButton:Enable()
|
||||||
end
|
end
|
||||||
AuxBuySearchButton:Enable()
|
|
||||||
Aux_Buy_ScrollbarUpdate()
|
|
||||||
end,
|
end,
|
||||||
on_abort = function()
|
on_abort = function()
|
||||||
AuxBuySearchButton:Enable()
|
if express_mode then
|
||||||
Aux_Buy_ScrollbarUpdate()
|
AuxBuySearchButton:Enable()
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
@@ -173,13 +239,13 @@ function record_auction(name, tooltip, stack_size, buyout_price, quality, owner,
|
|||||||
|
|
||||||
if buyout_price > 0 and owner ~= UnitName("player") then
|
if buyout_price > 0 and owner ~= UnitName("player") then
|
||||||
tinsert(entries, {
|
tinsert(entries, {
|
||||||
name = name,
|
name = name,
|
||||||
tooltip = tooltip,
|
tooltip = tooltip,
|
||||||
stack_size = stack_size,
|
stack_size = stack_size,
|
||||||
buyout_price = buyout_price,
|
buyout_price = buyout_price,
|
||||||
item_price = buyout_price / stack_size,
|
item_price = buyout_price / stack_size,
|
||||||
quality = quality,
|
quality = quality,
|
||||||
hyperlink = hyperlink,
|
hyperlink = hyperlink,
|
||||||
itemstring = itemstring,
|
itemstring = itemstring,
|
||||||
page = current_page,
|
page = current_page,
|
||||||
})
|
})
|
||||||
@@ -190,6 +256,15 @@ end
|
|||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
|
function Aux.buy.onupdate()
|
||||||
|
if refresh then
|
||||||
|
refresh = false
|
||||||
|
Aux_Buy_ScrollbarUpdate()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux_Buy_ScrollbarUpdate()
|
function Aux_Buy_ScrollbarUpdate()
|
||||||
if entries and getn(entries) == 0 then
|
if entries and getn(entries) == 0 then
|
||||||
set_message("No auctions were found")
|
set_message("No auctions were found")
|
||||||
@@ -265,39 +340,6 @@ end
|
|||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function report(completed, item_name, ordered_count, progress)
|
|
||||||
|
|
||||||
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/>
|
|
||||||
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)
|
|
||||||
|
|
||||||
AuxBuyReport:Show()
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------
|
|
||||||
|
|
||||||
function AuxBuyCategoryDropDown_Initialize(arg1)
|
function AuxBuyCategoryDropDown_Initialize(arg1)
|
||||||
local level = arg1 or 1
|
local level = arg1 or 1
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
<Script file="buy.lua"/>
|
<Script file="buy.lua"/>
|
||||||
|
|
||||||
|
<Frame>
|
||||||
|
<Scripts>
|
||||||
|
<OnUpdate>
|
||||||
|
Aux.buy.onupdate()
|
||||||
|
</OnUpdate>
|
||||||
|
</Scripts>
|
||||||
|
</Frame>
|
||||||
|
|
||||||
<Button name="AuxBuyEntryTemplate" virtual="true" hidden="true">
|
<Button name="AuxBuyEntryTemplate" virtual="true" hidden="true">
|
||||||
<Size><AbsDimension y="16"/></Size>
|
<Size><AbsDimension y="16"/></Size>
|
||||||
<Frames>
|
<Frames>
|
||||||
@@ -128,7 +136,7 @@
|
|||||||
</Layers>
|
</Layers>
|
||||||
|
|
||||||
<Frames>
|
<Frames>
|
||||||
<Frame name="AuxBuyList" inherits="ListTemplate">
|
<!-- <Frame name="AuxBuyList" inherits="ListTemplate">
|
||||||
<Size><AbsDimension x="610" y="334"/></Size>
|
<Size><AbsDimension x="610" y="334"/></Size>
|
||||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="187" y="-77"/></Offset></Anchor></Anchors>
|
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="187" y="-77"/></Offset></Anchor></Anchors>
|
||||||
<Scripts>
|
<Scripts>
|
||||||
@@ -136,7 +144,7 @@
|
|||||||
Aux.list.initialize(this, {{ width=50, logicalColumns={1,2,3} }, { width=50, logicalColumns={1,2,3} }})
|
Aux.list.initialize(this, {{ width=50, logicalColumns={1,2,3} }, { width=50, logicalColumns={1,2,3} }})
|
||||||
</OnLoad>
|
</OnLoad>
|
||||||
</Scripts>
|
</Scripts>
|
||||||
</Frame>
|
</Frame> -->
|
||||||
<Frame name="AuxBuyFilters">
|
<Frame name="AuxBuyFilters">
|
||||||
<Size><AbsDimension x="1" y="1"/></Size>
|
<Size><AbsDimension x="1" y="1"/></Size>
|
||||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="80" y="-46"/></Offset></Anchor></Anchors>
|
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="80" y="-46"/></Offset></Anchor></Anchors>
|
||||||
@@ -358,6 +366,51 @@
|
|||||||
<Button name="AuxBuyEntry17" inherits="AuxBuyEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="AuxBuyEntry16" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
<Button name="AuxBuyEntry17" inherits="AuxBuyEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="AuxBuyEntry16" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||||
<Button name="AuxBuyEntry18" inherits="AuxBuyEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="AuxBuyEntry17" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
<Button name="AuxBuyEntry18" inherits="AuxBuyEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="AuxBuyEntry17" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||||
<Button name="AuxBuyEntry19" inherits="AuxBuyEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="AuxBuyEntry18" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
<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>
|
||||||
|
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="300" y="-150"/></Offset></Anchor></Anchors>
|
||||||
|
|
||||||
|
<Scripts>
|
||||||
|
<OnLoad>this:RegisterForDrag("LeftButton")</OnLoad>
|
||||||
|
<OnDragStart>this:StartMoving()</OnDragStart>
|
||||||
|
<OnDragStop>this:StopMovingOrSizing()</OnDragStop>
|
||||||
|
</Scripts>
|
||||||
|
<Backdrop bgFile="Interface\CharacterFrame\UI-Party-Background" edgeFile="Interface\DialogFrame\UI-DialogBox-Border" tile="true">
|
||||||
|
<BackgroundInsets><AbsInset left="11" right="12" top="12" bottom="11"/></BackgroundInsets>
|
||||||
|
<TileSize><AbsValue val="32"/></TileSize>
|
||||||
|
<EdgeSize><AbsValue val="32"/></EdgeSize>
|
||||||
|
</Backdrop>
|
||||||
|
|
||||||
|
<Frames>
|
||||||
|
<SimpleHTML name="$parentHTML">
|
||||||
|
<Size><AbsDimension x="420" y="420" /></Size>
|
||||||
|
<Anchors>
|
||||||
|
<Anchor point="TOPLEFT"><Offset><AbsDimension x="30" y="-30"/></Offset></Anchor>
|
||||||
|
</Anchors>
|
||||||
|
<FontString inherits="GameFontHighlightSmall"/>
|
||||||
|
<FontStringHeader1 inherits="GameFontNormal"/>
|
||||||
|
</SimpleHTML>
|
||||||
|
<Button name="$parentBuyButton" inherits="UIPanelButtonTemplate" text="Buy" disabled="true">
|
||||||
|
<Size><AbsDimension x="100" y="22"/> </Size>
|
||||||
|
<Anchors><Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="20" y="15"/></Offset></Anchor></Anchors>
|
||||||
|
<Scripts>
|
||||||
|
<OnClick>
|
||||||
|
Aux.buy.buyout_dialog_buy()
|
||||||
|
</OnClick>
|
||||||
|
</Scripts>
|
||||||
|
</Button>
|
||||||
|
<Button name="$parentCancelButton" inherits="UIPanelButtonTemplate" text="Cancel">
|
||||||
|
<Size><AbsDimension x="100" y="22"/> </Size>
|
||||||
|
<Anchors><Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="-20" y="15"/></Offset></Anchor></Anchors>
|
||||||
|
<Scripts>
|
||||||
|
<OnClick>
|
||||||
|
Aux.buy.buyout_dialog_cancel()
|
||||||
|
</OnClick>
|
||||||
|
</Scripts>
|
||||||
|
</Button>
|
||||||
|
</Frames>
|
||||||
|
</Frame>
|
||||||
</Frames>
|
</Frames>
|
||||||
</Frame>
|
</Frame>
|
||||||
|
|
||||||
|
|||||||
@@ -196,9 +196,8 @@ function Aux_OnAuctionHouseClosed()
|
|||||||
|
|
||||||
Aux.post.stop()
|
Aux.post.stop()
|
||||||
Aux.stack.stop()
|
Aux.stack.stop()
|
||||||
if not Aux.scan.idle() then
|
Aux.buy.exit()
|
||||||
Aux.scan.abort()
|
Aux.scan.abort()
|
||||||
end
|
|
||||||
|
|
||||||
AuxOptionsButtonPanel:Hide()
|
AuxOptionsButtonPanel:Hide()
|
||||||
AuxOptionsFrame:Hide()
|
AuxOptionsFrame:Hide()
|
||||||
@@ -218,9 +217,9 @@ function Aux_AuctionFrameTab_OnClick(index)
|
|||||||
|
|
||||||
Aux.post.stop()
|
Aux.post.stop()
|
||||||
Aux.stack.stop()
|
Aux.stack.stop()
|
||||||
if not Aux.scan.idle() then
|
Aux.buy.exit()
|
||||||
Aux.scan.abort()
|
Aux.scan.abort()
|
||||||
end
|
|
||||||
AuxSellPanel:Hide()
|
AuxSellPanel:Hide()
|
||||||
AuxBuyPanel:Hide()
|
AuxBuyPanel:Hide()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user