refactoring complete
This commit is contained in:
@@ -4,10 +4,16 @@
|
|||||||
## SavedVariablesPerCharacter: AUX_ENABLE_ALT, AUX_OPEN_FIRST, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION
|
## SavedVariablesPerCharacter: AUX_ENABLE_ALT, AUX_OPEN_FIRST, AUX_INSTANT_BUYOUT, AUX_AUCTION_DURATION
|
||||||
## SavedVariables: auxSellEntries
|
## SavedVariables: auxSellEntries
|
||||||
core.xml
|
core.xml
|
||||||
|
|
||||||
sell.xml
|
sell.xml
|
||||||
buy.xml
|
buy.xml
|
||||||
|
|
||||||
scan.xml
|
scan.xml
|
||||||
stack.xml
|
stack.xml
|
||||||
post.xml
|
post.xml
|
||||||
|
info.xml
|
||||||
|
util.lua
|
||||||
|
|
||||||
options.xml
|
options.xml
|
||||||
about.xml
|
about.xml
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
local processScanResults, createOrder, updateOrder
|
Aux.buy = {}
|
||||||
|
|
||||||
|
local record_auction, createOrder, updateOrder
|
||||||
local entries
|
local entries
|
||||||
local selectedEntries = {}
|
local selectedEntries = {}
|
||||||
local searchQuery
|
local searchQuery
|
||||||
@@ -18,14 +20,22 @@ function AuxBuySearchButton_OnClick()
|
|||||||
entries = nil
|
entries = nil
|
||||||
selectedEntries = {}
|
selectedEntries = {}
|
||||||
Aux_Buy_ScrollbarUpdate()
|
Aux_Buy_ScrollbarUpdate()
|
||||||
searchQuery = Aux_Scan_CreateQuery{
|
searchQuery = Aux.scan.create_query{
|
||||||
name = AuxBuySearchBox:GetText(),
|
name = AuxBuySearchBox:GetText(),
|
||||||
exactMatch = true
|
exactMatch = true
|
||||||
}
|
}
|
||||||
Aux_Scan_Start{
|
Aux.buy.set_message('Scanning auctions ...')
|
||||||
|
Aux.scan.start{
|
||||||
query = searchQuery,
|
query = searchQuery,
|
||||||
onComplete = function(data)
|
on_start_page = function(i)
|
||||||
processScanResults(data)
|
Aux.buy.set_message('Scanning auctions: page ' .. i .. ' ...')
|
||||||
|
end,
|
||||||
|
on_read_auction = function(i)
|
||||||
|
local auction_item = Aux.info.auction_item(i)
|
||||||
|
local stack_size = auction_item.charges and auction_item.charges or auction_item.count
|
||||||
|
record_auction(auction_item.name, stack_size, auction_item.buyout_price, auction_item.quality, auction_item.owner, auction_item.itemlink)
|
||||||
|
end,
|
||||||
|
on_complete = function()
|
||||||
Aux_Buy_ScrollbarUpdate()
|
Aux_Buy_ScrollbarUpdate()
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
@@ -49,6 +59,13 @@ end
|
|||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
|
function Aux.buy.set_message(msg)
|
||||||
|
AuxBuyMessage:SetText(msg)
|
||||||
|
AuxBuyMessage:Show()
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
function AuxBuyBuySelectedButton_OnClick()
|
function AuxBuyBuySelectedButton_OnClick()
|
||||||
|
|
||||||
AuxBuySearchButton:Disable()
|
AuxBuySearchButton:Disable()
|
||||||
@@ -63,18 +80,22 @@ function AuxBuyBuySelectedButton_OnClick()
|
|||||||
|
|
||||||
Aux_Buy_ScrollbarUpdate()
|
Aux_Buy_ScrollbarUpdate()
|
||||||
|
|
||||||
Aux_Scan_Start{
|
Aux.buy.set_message('Scanning auctions ...')
|
||||||
|
Aux.scan.start{
|
||||||
query = searchQuery,
|
query = searchQuery,
|
||||||
onReadDatum = function(datum)
|
on_start_page = function(i)
|
||||||
if datum.name and datum.count and datum.buyoutPrice then
|
Aux.buy.set_message('Scanning auctions: page ' .. i .. ' ...')
|
||||||
local key = datum.name.."_"..datum.count.."_"..datum.buyoutPrice
|
end,
|
||||||
|
on_read_auction = function(i)
|
||||||
|
local auction_item = Aux.info.auction_item(i)
|
||||||
|
|
||||||
|
if auction_item.name and auction_item.count and auction_item.buyout_price then
|
||||||
|
local key = auction_item.name.."_"..auction_item.count.."_"..auction_item.buyout_price
|
||||||
if order[key] then
|
if order[key] then
|
||||||
|
|
||||||
if GetMoney() >= datum.buyoutPrice then
|
if GetMoney() >= auction_item.buyout_price then
|
||||||
PlaceAuctionBid("list", datum.pageIndex, datum.buyoutPrice)
|
PlaceAuctionBid("list", i, auction_item.buyout_price)
|
||||||
purchasedCount = purchasedCount + 1
|
purchasedCount = purchasedCount + 1
|
||||||
else
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
if order[key] > 1 then
|
if order[key] > 1 then
|
||||||
@@ -82,20 +103,18 @@ function AuxBuyBuySelectedButton_OnClick()
|
|||||||
else
|
else
|
||||||
order[key] = nil
|
order[key] = nil
|
||||||
end
|
end
|
||||||
|
|
||||||
return false
|
|
||||||
else
|
else
|
||||||
return true
|
local stack_size = auction_item.charges and auction_item.charges or auction_item.count
|
||||||
|
record_auction(auction_item.name, stack_size, auction_item.charges, auction_item.buyout_price, auction_item.quality, auction_item.owner, auction_item.itemlink)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
onComplete = function(data)
|
on_complete = function()
|
||||||
processScanResults(data)
|
|
||||||
Aux_Buy_ScrollbarUpdate()
|
Aux_Buy_ScrollbarUpdate()
|
||||||
AuxBuySearchButton:Enable()
|
AuxBuySearchButton:Enable()
|
||||||
Aux_Buy_ShowReport(true, orderedCount, purchasedCount)
|
Aux_Buy_ShowReport(true, orderedCount, purchasedCount)
|
||||||
end,
|
end,
|
||||||
onAbort = function()
|
on_abort = function()
|
||||||
AuxBuySearchButton:Enable()
|
AuxBuySearchButton:Enable()
|
||||||
Aux_Buy_ShowReport(false, orderedCount, purchasedCount)
|
Aux_Buy_ShowReport(false, orderedCount, purchasedCount)
|
||||||
end
|
end
|
||||||
@@ -138,22 +157,18 @@ end
|
|||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function processScanResults(rawData)
|
function record_auction(name, stack_size, buyout_price, quality, owner, itemlink)
|
||||||
|
entries = entries or {}
|
||||||
|
|
||||||
entries = {}
|
if buyout_price > 0 and owner ~= UnitName("player") then
|
||||||
|
tinsert(entries, {
|
||||||
for _,rawDatum in ipairs(rawData) do
|
name = name,
|
||||||
|
stackSize = stack_size,
|
||||||
if rawDatum.buyoutPrice > 0 and rawDatum.owner ~= UnitName("player") then
|
buyoutPrice = buyout_price,
|
||||||
tinsert(entries, {
|
itemPrice = buyout_price / stack_size,
|
||||||
name = rawDatum.name,
|
quality = quality,
|
||||||
stackSize = rawDatum.count,
|
itemLink = itemlink,
|
||||||
buyoutPrice = rawDatum.buyoutPrice,
|
})
|
||||||
itemPrice = rawDatum.buyoutPrice / rawDatum.count,
|
|
||||||
quality = rawDatum.quality,
|
|
||||||
itemLink = rawDatum.itemLink,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
table.sort(entries, function(a,b) return a.itemPrice < b.itemPrice end)
|
table.sort(entries, function(a,b) return a.itemPrice < b.itemPrice end)
|
||||||
@@ -163,7 +178,7 @@ end
|
|||||||
|
|
||||||
function Aux_Buy_ScrollbarUpdate()
|
function Aux_Buy_ScrollbarUpdate()
|
||||||
if entries and getn(entries) == 0 then
|
if entries and getn(entries) == 0 then
|
||||||
Aux_SetMessage("No auctions were found")
|
Aux.sell.set_message("No auctions were found")
|
||||||
else
|
else
|
||||||
AuxBuyMessage:Hide()
|
AuxBuyMessage:Hide()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||||
|
|
||||||
<Script file="Buy.lua"/>
|
<Script file="buy.lua"/>
|
||||||
|
|
||||||
<Button name="AuxBuyEntryTemplate" virtual="true" hidden="true">
|
<Button name="AuxBuyEntryTemplate" virtual="true" hidden="true">
|
||||||
<Size><AbsDimension y="16"/></Size>
|
<Size><AbsDimension y="16"/></Size>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
AuxVersion = "1.1.2"
|
AuxVersion = "1.2.0"
|
||||||
AuxAuthors = "shirsig; Zerf; Zirco (AUX); Nimeral (AUX backport)"
|
AuxAuthors = "shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)"
|
||||||
|
|
||||||
local lastRightClickAction = GetTime()
|
local lastRightClickAction = GetTime()
|
||||||
|
|
||||||
@@ -157,7 +157,7 @@ function Aux_SetupHookFunctions()
|
|||||||
BrowseButton8:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown)
|
BrowseButton8:SetScript("OnMouseDown", Aux_BrowseButton_OnMouseDown)
|
||||||
|
|
||||||
Aux.orig.AuctionSellItemButton_OnEvent = AuctionSellItemButton_OnEvent
|
Aux.orig.AuctionSellItemButton_OnEvent = AuctionSellItemButton_OnEvent
|
||||||
AuctionSellItemButton_OnEvent = Aux_AuctionSellItemButton_OnEvent
|
AuctionSellItemButton_OnEvent = Aux.sell.AuctionSellItemButton_OnEvent
|
||||||
|
|
||||||
Aux.orig.AuctionFrameTab_OnClick = AuctionFrameTab_OnClick
|
Aux.orig.AuctionFrameTab_OnClick = AuctionFrameTab_OnClick
|
||||||
AuctionFrameTab_OnClick = Aux_AuctionFrameTab_OnClick
|
AuctionFrameTab_OnClick = Aux_AuctionFrameTab_OnClick
|
||||||
@@ -172,7 +172,7 @@ function Aux_SetupHookFunctions()
|
|||||||
AuctionFrameAuctions_Update = Aux_AuctionFrameAuctions_Update
|
AuctionFrameAuctions_Update = Aux_AuctionFrameAuctions_Update
|
||||||
|
|
||||||
Aux.orig.AuctionsCreateAuctionButton_OnClick = AuctionsCreateAuctionButton:GetScript('OnClick')
|
Aux.orig.AuctionsCreateAuctionButton_OnClick = AuctionsCreateAuctionButton:GetScript('OnClick')
|
||||||
AuctionsCreateAuctionButton:SetScript('OnClick', Aux_AuctionsCreateAuctionButton_OnClick)
|
AuctionsCreateAuctionButton:SetScript('OnClick', Aux.sell.AuctionsCreateAuctionButton_OnClick)
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
@@ -193,8 +193,8 @@ function Aux_OnAuctionHouseClosed()
|
|||||||
|
|
||||||
Aux.post.stop()
|
Aux.post.stop()
|
||||||
Aux.stack.stop()
|
Aux.stack.stop()
|
||||||
if not Aux_Scan_IsIdle() then
|
if not Aux.scan.idle() then
|
||||||
Aux_Scan_Abort()
|
Aux.scan.abort()
|
||||||
end
|
end
|
||||||
|
|
||||||
AuxOptionsButtonPanel:Hide()
|
AuxOptionsButtonPanel:Hide()
|
||||||
@@ -215,8 +215,8 @@ function Aux_AuctionFrameTab_OnClick(index)
|
|||||||
|
|
||||||
Aux.post.stop()
|
Aux.post.stop()
|
||||||
Aux.stack.stop()
|
Aux.stack.stop()
|
||||||
if not Aux_Scan_IsIdle() then
|
if not Aux.scan.idle() then
|
||||||
Aux_Scan_Abort()
|
Aux.scan.abort()
|
||||||
end
|
end
|
||||||
AuxSellPanel:Hide()
|
AuxSellPanel:Hide()
|
||||||
AuxBuyPanel:Hide()
|
AuxBuyPanel:Hide()
|
||||||
@@ -231,7 +231,7 @@ function Aux_AuctionFrameTab_OnClick(index)
|
|||||||
|
|
||||||
if index == Aux.tabs.sell.index then
|
if index == Aux.tabs.sell.index then
|
||||||
AuctionFrameTab_OnClick(3)
|
AuctionFrameTab_OnClick(3)
|
||||||
Aux_Sell_OnOpen()
|
Aux.sell.on_open()
|
||||||
|
|
||||||
PanelTemplates_SetTab(AuctionFrame, Aux.tabs.sell.index)
|
PanelTemplates_SetTab(AuctionFrame, Aux.tabs.sell.index)
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||||
|
|
||||||
<Script file="Core.lua"/>
|
<Script file="core.lua"/>
|
||||||
|
|
||||||
<!-- Frame to handle all core events -->
|
<!-- Frame to handle all core events -->
|
||||||
<Frame>
|
<Frame>
|
||||||
|
|||||||
@@ -1,107 +1,121 @@
|
|||||||
Aux.info = {}
|
Aux.info = {}
|
||||||
|
|
||||||
local link_item, id, tooltip, charges
|
local itemlink_item, item_id, item_charges
|
||||||
|
|
||||||
function Aux.info.container_item(bag, slot)
|
function Aux.info.container_item(bag, slot)
|
||||||
local link = GetContainerItemLink(bag, slot)
|
local itemlink = GetContainerItemLink(bag, slot)
|
||||||
local container_item = link_item(link)
|
local container_item = itemlink_item(itemlink)
|
||||||
|
|
||||||
local texture, itemCount, locked, quality, readable, lootable, itemLink = GetContainerItemInfo(bagID, slot)
|
local texture, count, locked, quality, readable, lootable, itemlink = GetContainerItemInfo(bag, slot)
|
||||||
container_item.texture = texture
|
container_item.texture = texture
|
||||||
container_item.count = count
|
container_item.count = count
|
||||||
|
container_item.locked = locked
|
||||||
|
container_item.readable = readable
|
||||||
|
container_item.lootable = lootable
|
||||||
|
container_item.itemlink = itemlink
|
||||||
|
|
||||||
container_item.tooltip = tooltip(GameTooltip.SetBagItem(bag, slot))
|
container_item.tooltip = Aux.info.tooltip(function(tt) tt:SetBagItem(bag, slot) end)
|
||||||
container_item.charges = charges(container_item.tooltip)
|
container_item.charges = item_charges(container_item.tooltip)
|
||||||
|
|
||||||
return container_item
|
return container_item
|
||||||
end
|
end
|
||||||
|
|
||||||
function Aux.info.auction_sell_item()
|
function Aux.info.auction_sell_item()
|
||||||
local name, texture, count, quality, canUse, price, pricePerUnit, stackCount, totalCount = GetAuctionSellItemInfo()
|
local name, texture, count, quality, usable, price, unit_price, max_stack, total_count = GetAuctionSellItemInfo()
|
||||||
auction_sell_item = {
|
auction_sell_item = {
|
||||||
name = name,
|
name = name,
|
||||||
texture = texture,
|
texture = texture,
|
||||||
count = count,
|
count = count,
|
||||||
quality = quality,
|
quality = quality,
|
||||||
can_use = canUse,
|
usable = usable,
|
||||||
price = price,
|
price = price,
|
||||||
unit_price = pricePerUnit,
|
unit_price = unit_price,
|
||||||
max_stack = stackCount,
|
max_stack = max_stack,
|
||||||
total_count = totalCount,
|
total_count = total_count,
|
||||||
}
|
}
|
||||||
|
|
||||||
auction_sell_item.tooltip = tooltip(GameTooltip.SetAuctionSellItem)
|
auction_sell_item.tooltip = Aux.info.tooltip(function(tt) tt:SetAuctionSellItem() end)
|
||||||
auction_sell_item.charges = charges(auction_sell_item.tooltip)
|
auction_sell_item.charges = item_charges(auction_sell_item.tooltip)
|
||||||
|
|
||||||
return auction_sell_item
|
return auction_sell_item
|
||||||
end
|
end
|
||||||
|
|
||||||
function Aux.info.auction_item(index)
|
function Aux.info.auction_item(index)
|
||||||
local link = GetAuctionItemLink("list", index)
|
local itemlink = GetAuctionItemLink("list", index)
|
||||||
local auction_item = item(link)
|
local auction_item = itemlink_item(itemlink)
|
||||||
|
|
||||||
|
local name, texture, count, quality, usable, level, min_bid, min_increment, buyout_price, bid_amount, high_bidder, owner, sale_status, id, has_all_info = GetAuctionItemInfo("list", index)
|
||||||
|
local duration = GetAuctionItemTimeLeft("list", index)
|
||||||
|
|
||||||
local _, texture, count, _, canUse, level, levelColHeader, minBid, minIncrement, buyoutPrice, bidAmount, highBidder, owner, saleStatus, itemId, hasAllInfo = GetAuctionItemInfo("list", index)
|
|
||||||
auction_item.texture = texture
|
auction_item.texture = texture
|
||||||
auction_item.count = count
|
auction_item.count = count
|
||||||
auction_item.min_bid = minBid
|
auction_item.min_bid = min_bid
|
||||||
auction_item.bid_amount = bidAmount
|
auction_item.min_increment = min_increment
|
||||||
auction_item.buyout = buyoutPrice
|
auction_item.buyout_price = buyout_price
|
||||||
|
auction_item.bid_amount = bid_amount
|
||||||
|
auction_item.high_bidder = high_bidder
|
||||||
|
auction_item.owner = owner
|
||||||
|
auction_item.sale_status = sale_status
|
||||||
|
auction_item.id = id
|
||||||
|
auction_item.has_all_info = has_all_info
|
||||||
|
auction_item.duration = duration
|
||||||
|
|
||||||
auction_item.tooltip = tooltip(GameTooltip.SetAuctionItem("list", index)
|
auction_item.tooltip = Aux.info.tooltip(function(tt) tt:SetAuctionItem("list", index) end)
|
||||||
auction_item.charges = charges(auction_item.tooltip)
|
auction_item.charges = item_charges(auction_item.tooltip)
|
||||||
|
|
||||||
return auction_item
|
return auction_item
|
||||||
end
|
end
|
||||||
|
|
||||||
function charges(tooltip)
|
function Aux.info.tooltip(setter)
|
||||||
|
for j = 1, 30 do
|
||||||
|
leftEntry = getglobal('AuxInfoTooltipTextLeft'..j):SetText()
|
||||||
|
rightEntry = getglobal('AuxInfoTooltipTextRight'..j):SetText()
|
||||||
|
end
|
||||||
|
|
||||||
|
AuxInfoTooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
||||||
|
setter(AuxInfoTooltip)
|
||||||
|
AuxInfoTooltip:Show()
|
||||||
|
|
||||||
|
local tooltip = {}
|
||||||
|
for j = 1, 30 do
|
||||||
|
local leftEntry = getglobal('AuxInfoTooltipTextLeft'..j):GetText()
|
||||||
|
if leftEntry then
|
||||||
|
tinsert(tooltip, leftEntry)
|
||||||
|
end
|
||||||
|
local rightEntry = getglobal('AuxInfoTooltipTextRight'..j):GetText()
|
||||||
|
if rightEntry then
|
||||||
|
tinsert(tooltip, rightEntry)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
for j = 1, 30 do
|
||||||
|
leftEntry = getglobal('AuxInfoTooltipTextLeft'..j):SetText()
|
||||||
|
rightEntry = getglobal('AuxInfoTooltipTextRight'..j):SetText()
|
||||||
|
end
|
||||||
|
|
||||||
|
return tooltip
|
||||||
|
end
|
||||||
|
|
||||||
|
function item_charges(tooltip)
|
||||||
for _, entry in ipairs(tooltip) do
|
for _, entry in ipairs(tooltip) do
|
||||||
local chargesString = gsub(entry, "(%d+) Charges", "%1")
|
local charges_string = gsub(entry, "(%d+) Charges", "%1")
|
||||||
return tonumber(chargesString)
|
local charges = tonumber(charges_string)
|
||||||
if charges then
|
if charges then
|
||||||
return charges
|
return charges
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function tooltip(setter)
|
function item_id(itemlink)
|
||||||
for j=1, 30 do
|
local id_string = string.gsub(itemlink, "^.-:(%d*).*", "%1")
|
||||||
leftEntry = getglobal('AuxScanTooltipTextLeft'..j):SetText()
|
|
||||||
rightEntry = getglobal('AuxScanTooltipTextRight'..j):SetText()
|
|
||||||
end
|
|
||||||
AuxScanTooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
|
||||||
AuxScanTooltip:setter()
|
|
||||||
AuxScanTooltip:Show()
|
|
||||||
local tooltip = Aux_Scan_ExtractTooltip()
|
|
||||||
|
|
||||||
local tooltip = {}
|
|
||||||
for j=1, 30 do
|
|
||||||
local leftEntry = getglobal('AuxScanTooltipTextLeft'..j):GetText()
|
|
||||||
if leftEntry then
|
|
||||||
tinsert(tooltip, leftEntry)
|
|
||||||
end
|
|
||||||
local rightEntry = getglobal('AuxScanTooltipTextRight'..j):GetText()
|
|
||||||
if rightEntry then
|
|
||||||
tinsert(tooltip, rightEntry)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
for j=1, 30 do
|
|
||||||
leftEntry = getglobal('AuxScanTooltipTextLeft'..j):SetText()
|
|
||||||
rightEntry = getglobal('AuxScanTooltipTextRight'..j):SetText()
|
|
||||||
end
|
|
||||||
return tooltip
|
|
||||||
end
|
|
||||||
|
|
||||||
function id(itemlink)
|
|
||||||
local id_string = string.gsub(itemLink, "^.-:(%d*).*", "%1")
|
|
||||||
return tonumber(id_string)
|
return tonumber(id_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
function link_item(link)
|
function itemlink_item(itemlink)
|
||||||
local name, link, quality, level, type, subtype, max_stack = GetItemInfo(id(link))
|
local name, link, quality, level, type, subtype, max_stack = GetItemInfo(item_id(itemlink))
|
||||||
return {
|
return {
|
||||||
name = name,
|
name = name,
|
||||||
link = link,
|
itemlink = itemlink,
|
||||||
quality = quality,
|
quality = quality,
|
||||||
level = level,
|
level = level,
|
||||||
type = type,
|
type = type,
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||||
|
|
||||||
|
<Script file="info.lua"/>
|
||||||
|
|
||||||
|
<GameTooltip name="AuxInfoTooltip" inherits="GameTooltipTemplate"/>
|
||||||
|
</Ui>
|
||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||||
|
|
||||||
<Script file="Options.lua"/>
|
<Script file="options.lua"/>
|
||||||
|
|
||||||
<Frame name="AuxOptionsButtonTemplate" virtual="true" hidden="true">
|
<Frame name="AuxOptionsButtonTemplate" virtual="true" hidden="true">
|
||||||
<Size>
|
<Size>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
Aux.scan = {}
|
||||||
|
|
||||||
local STATE_IDLE = 0
|
local STATE_IDLE = 0
|
||||||
local STATE_PREQUERY = 1
|
local STATE_PREQUERY = 1
|
||||||
local STATE_POSTQUERY = 2
|
local STATE_POSTQUERY = 2
|
||||||
@@ -9,8 +11,6 @@ local currentJob
|
|||||||
local currentPage
|
local currentPage
|
||||||
local state = STATE_IDLE
|
local state = STATE_IDLE
|
||||||
|
|
||||||
local scanData
|
|
||||||
|
|
||||||
local timeOfLastUpdate = GetTime()
|
local timeOfLastUpdate = GetTime()
|
||||||
|
|
||||||
-- forward declaration of local functions
|
-- forward declaration of local functions
|
||||||
@@ -18,58 +18,77 @@ local submitQuery, processQueryResults
|
|||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux_Scan_IsIdle()
|
function Aux.scan.on_event()
|
||||||
|
if event == "AUCTION_ITEM_LIST_UPDATE" then
|
||||||
|
if state == STATE_POSTQUERY then
|
||||||
|
state = STATE_PROCESSING
|
||||||
|
processQueryResults()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
|
function Aux.scan.on_update()
|
||||||
|
if state == STATE_PREQUERY and GetTime() - timeOfLastUpdate > 0.5 then
|
||||||
|
|
||||||
|
timeOfLastUpdate = GetTime()
|
||||||
|
|
||||||
|
if CanSendAuctionQuery() then
|
||||||
|
submitQuery()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-----------------------------------------
|
||||||
|
|
||||||
|
function Aux.scan.idle()
|
||||||
return state == STATE_IDLE
|
return state == STATE_IDLE
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux_Scan_Complete()
|
function Aux.scan.complete()
|
||||||
if state ~= STATE_IDLE then
|
if state ~= STATE_IDLE then
|
||||||
if currentJob.onComplete then
|
if currentJob.on_complete then
|
||||||
currentJob.onComplete(scanData)
|
currentJob.on_complete()
|
||||||
end
|
end
|
||||||
|
|
||||||
currentJob = nil
|
currentJob = nil
|
||||||
currentPage = nil
|
currentPage = nil
|
||||||
scanData = nil
|
|
||||||
state = STATE_IDLE
|
state = STATE_IDLE
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux_Scan_Abort()
|
function Aux.scan.abort()
|
||||||
if state ~= STATE_IDLE then
|
if state ~= STATE_IDLE then
|
||||||
if currentJob and currentJob.onAbort then
|
if currentJob and currentJob.on_abort then
|
||||||
currentJob.onAbort()
|
currentJob.on_abort()
|
||||||
end
|
end
|
||||||
|
|
||||||
currentJob = nil
|
currentJob = nil
|
||||||
currentPage = nil
|
currentPage = nil
|
||||||
scanData = nil
|
|
||||||
state = STATE_IDLE
|
state = STATE_IDLE
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux_Scan_Start(job)
|
function Aux.scan.start(job)
|
||||||
|
|
||||||
Aux_SetMessage("Scanning auctions ...")
|
|
||||||
|
|
||||||
if state ~= STATE_IDLE then
|
if state ~= STATE_IDLE then
|
||||||
Aux_Scan_Abort()
|
Aux.scan.abort()
|
||||||
end
|
end
|
||||||
|
|
||||||
currentJob = job
|
currentJob = job
|
||||||
scanData = {}
|
|
||||||
state = STATE_PREQUERY
|
state = STATE_PREQUERY
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux_Scan_CreateQuery(parameterMap)
|
function Aux.scan.create_query(parameterMap)
|
||||||
local query = {
|
local query = {
|
||||||
name = nil,
|
name = nil,
|
||||||
minLevel = "",
|
minLevel = "",
|
||||||
@@ -108,125 +127,23 @@ end
|
|||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux_Scan_ClearTooltip()
|
|
||||||
for j=1, 30 do
|
|
||||||
leftEntry = getglobal('AuxScanTooltipTextLeft'..j):SetText()
|
|
||||||
rightEntry = getglobal('AuxScanTooltipTextRight'..j):SetText()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------
|
|
||||||
|
|
||||||
function Aux_Scan_ExtractTooltip()
|
|
||||||
local tooltip = {}
|
|
||||||
for j=1, 30 do
|
|
||||||
local leftEntry = getglobal('AuxScanTooltipTextLeft'..j):GetText()
|
|
||||||
if leftEntry then
|
|
||||||
tinsert(tooltip, leftEntry)
|
|
||||||
end
|
|
||||||
local rightEntry = getglobal('AuxScanTooltipTextRight'..j):GetText()
|
|
||||||
if rightEntry then
|
|
||||||
tinsert(tooltip, rightEntry)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
return tooltip
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------
|
|
||||||
|
|
||||||
function Aux_Scan_ItemCharges(tooltip)
|
|
||||||
for _, entry in ipairs(tooltip) do
|
|
||||||
local chargesString = gsub(entry, "(%d+) Charges", "%1")
|
|
||||||
local charges = tonumber(chargesString)
|
|
||||||
if charges then
|
|
||||||
return charges
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------
|
|
||||||
|
|
||||||
function processQueryResults()
|
function processQueryResults()
|
||||||
|
|
||||||
-- SortAuctionItems("list", "buyout")
|
|
||||||
-- if IsAuctionSortReversed("list", "buyout") then
|
|
||||||
-- SortAuctionItems("list", "buyout")
|
|
||||||
-- end
|
|
||||||
|
|
||||||
local numBatchAuctions, totalAuctions = GetNumAuctionItems("list")
|
local numBatchAuctions, totalAuctions = GetNumAuctionItems("list")
|
||||||
|
|
||||||
Aux_SetMessage("Scanning auctions: page "..currentPage.." ...")
|
if currentJob.on_start_page then
|
||||||
|
currentJob.on_start_page(currentPage)
|
||||||
|
end
|
||||||
|
|
||||||
for i = 1, numBatchAuctions do
|
for i = 1, numBatchAuctions do
|
||||||
|
if currentJob.on_read_auction then
|
||||||
local name, texture, count, quality, canUse, level, minBid, minIncrement, buyoutPrice, bidAmount, highBidder, owner = GetAuctionItemInfo("list", i)
|
currentJob.on_read_auction(i)
|
||||||
local itemLink = GetAuctionItemLink("list", i)
|
|
||||||
|
|
||||||
local duration = GetAuctionItemTimeLeft("list", i)
|
|
||||||
Aux_Scan_ClearTooltip()
|
|
||||||
AuxScanTooltip:SetOwner(UIParent, "ANCHOR_NONE");
|
|
||||||
AuxScanTooltip:SetAuctionItem("list", i)
|
|
||||||
AuxScanTooltip:Show()
|
|
||||||
local tooltip = Aux_Scan_ExtractTooltip()
|
|
||||||
-- for _, x in ipairs(tooltip) do Aux_Log(x) end
|
|
||||||
count = Aux_Scan_ItemCharges(tooltip) or count
|
|
||||||
|
|
||||||
local scanDatum = {
|
|
||||||
name = name,
|
|
||||||
texture = texture,
|
|
||||||
count = count,
|
|
||||||
quality = quality,
|
|
||||||
canUse = canUse,
|
|
||||||
level = level,
|
|
||||||
minBid = minBid,
|
|
||||||
minIncrement = minIncrement,
|
|
||||||
buyoutPrice = buyoutPrice,
|
|
||||||
bidAmount = bidAmount,
|
|
||||||
highBidder = highBidder,
|
|
||||||
owner = owner,
|
|
||||||
duration = duration,
|
|
||||||
itemLink = itemLink,
|
|
||||||
page = currentPage,
|
|
||||||
pageIndex = i
|
|
||||||
}
|
|
||||||
|
|
||||||
if currentJob.onReadDatum then
|
|
||||||
local keepDatum = currentJob.onReadDatum(scanDatum)
|
|
||||||
if keepDatum then
|
|
||||||
tinsert(scanData, scanDatum)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
tinsert(scanData, scanDatum)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if numBatchAuctions == NUM_AUCTION_ITEMS_PER_PAGE then
|
if numBatchAuctions == NUM_AUCTION_ITEMS_PER_PAGE then
|
||||||
state = STATE_PREQUERY
|
state = STATE_PREQUERY
|
||||||
else
|
else
|
||||||
Aux_Scan_Complete()
|
Aux.scan.complete()
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------
|
|
||||||
|
|
||||||
function Aux_Scan_OnEvent()
|
|
||||||
if event == "AUCTION_ITEM_LIST_UPDATE" then
|
|
||||||
if state == STATE_POSTQUERY then
|
|
||||||
state = STATE_PROCESSING
|
|
||||||
processQueryResults()
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
-----------------------------------------
|
|
||||||
|
|
||||||
function Aux_Scan_OnUpdate()
|
|
||||||
if state == STATE_PREQUERY and GetTime() - timeOfLastUpdate > 0.5 then
|
|
||||||
|
|
||||||
timeOfLastUpdate = GetTime()
|
|
||||||
|
|
||||||
if CanSendAuctionQuery() then
|
|
||||||
submitQuery()
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||||
|
|
||||||
<Script file="Scan.lua"/>
|
<Script file="scan.lua"/>
|
||||||
|
|
||||||
<!-- Frame to handle all core events -->
|
<!-- Frame to handle all core events -->
|
||||||
<Frame>
|
<Frame>
|
||||||
@@ -9,12 +9,11 @@
|
|||||||
this:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
|
this:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
|
||||||
</OnLoad>
|
</OnLoad>
|
||||||
<OnEvent>
|
<OnEvent>
|
||||||
Aux_Scan_OnEvent()
|
Aux.scan.on_event()
|
||||||
</OnEvent>
|
</OnEvent>
|
||||||
<OnUpdate>
|
<OnUpdate>
|
||||||
Aux_Scan_OnUpdate()
|
Aux.scan.on_update()
|
||||||
</OnUpdate>
|
</OnUpdate>
|
||||||
</Scripts>
|
</Scripts>
|
||||||
</Frame>
|
</Frame>
|
||||||
<GameTooltip name="AuxScanTooltip" inherits="GameTooltipTemplate"/>
|
|
||||||
</Ui>
|
</Ui>
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
Aux.sell = {}
|
||||||
|
|
||||||
auxSellEntries = {} -- persisted
|
auxSellEntries = {} -- persisted
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
@@ -8,11 +10,11 @@ local currentAuction
|
|||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
local processScanResults, undercut, ItemType2AuctionClass, SubType2AuctionSubclass
|
local record_auction, undercut, ItemType2AuctionClass, SubType2AuctionSubclass
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux_Sell_OnOpen()
|
function Aux.sell.on_open()
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
@@ -62,9 +64,9 @@ end
|
|||||||
-- that we can note the auction values
|
-- that we can note the auction values
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux_AuctionsCreateAuctionButton_OnClick()
|
function Aux.sell.AuctionsCreateAuctionButton_OnClick()
|
||||||
if PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.sell.index then
|
if PanelTemplates_GetSelectedTab(AuctionFrame) == Aux.tabs.sell.index then
|
||||||
local name, stackSize, buyoutPrice = currentAuction.name, currentAuction.stackSize, MoneyInputFrame_GetCopper(BuyoutPrice)
|
local name, stack_size, buyout_price = currentAuction.name, currentAuction.stackSize, MoneyInputFrame_GetCopper(BuyoutPrice)
|
||||||
local duration
|
local duration
|
||||||
if AuctionFrameAuctions.duration == 120 then
|
if AuctionFrameAuctions.duration == 120 then
|
||||||
duration = 2
|
duration = 2
|
||||||
@@ -82,32 +84,11 @@ function Aux_AuctionsCreateAuctionButton_OnClick()
|
|||||||
MoneyInputFrame_GetCopper(BuyoutPrice),
|
MoneyInputFrame_GetCopper(BuyoutPrice),
|
||||||
currentAuction.stackCount,
|
currentAuction.stackCount,
|
||||||
function(posted)
|
function(posted)
|
||||||
if posted > 0 and buyoutPrice > 0 then
|
for i = 1, posted do
|
||||||
auxSellEntries[name] = auxSellEntries[name] or { created=GetTime() }
|
record_auction(name, stack_size, buyout_price, duration, UnitName("player"))
|
||||||
local entry
|
|
||||||
for _, existingEntry in ipairs(auxSellEntries[name]) do
|
|
||||||
if existingEntry.buyoutPrice == buyoutPrice and existingEntry.stackSize == stackSize then
|
|
||||||
existingEntry.count = existingEntry.count + posted
|
|
||||||
existingEntry.numYours = existingEntry.numYours + posted
|
|
||||||
existingEntry.maxTimeLeft = max(existingEntry.maxTimeLeft, duration)
|
|
||||||
entry = existingEntry
|
|
||||||
end
|
|
||||||
end
|
|
||||||
if not entry then
|
|
||||||
entry = {
|
|
||||||
stackSize = stackSize,
|
|
||||||
buyoutPrice = buyoutPrice,
|
|
||||||
itemPrice = buyoutPrice / stackSize,
|
|
||||||
maxTimeLeft = duration,
|
|
||||||
count = posted,
|
|
||||||
numYours = posted,
|
|
||||||
}
|
|
||||||
tinsert(auxSellEntries[name], entry)
|
|
||||||
table.sort(auxSellEntries[name], function(a,b) return a.itemPrice < b.itemPrice end)
|
|
||||||
end
|
|
||||||
auxSellEntries[name].selected = entry
|
|
||||||
Aux_UpdateRecommendation()
|
|
||||||
end
|
end
|
||||||
|
auxSellEntries[name].selected = entry
|
||||||
|
Aux_UpdateRecommendation()
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
@@ -117,19 +98,17 @@ end
|
|||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux_AuctionSellItemButton_OnEvent()
|
function Aux.sell.AuctionSellItemButton_OnEvent()
|
||||||
Aux.orig.AuctionSellItemButton_OnEvent()
|
Aux.orig.AuctionSellItemButton_OnEvent()
|
||||||
Aux_OnNewAuctionUpdate()
|
Aux_OnNewAuctionUpdate()
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function Aux_SetMessage(msg)
|
function Aux.sell.set_message(msg)
|
||||||
Aux_HideElems(Aux.tabs.sell.recommendationElements)
|
Aux_HideElems(Aux.tabs.sell.recommendationElements)
|
||||||
AuxMessage:SetText(msg)
|
AuxMessage:SetText(msg)
|
||||||
AuxMessage:Show()
|
AuxMessage:Show()
|
||||||
AuxBuyMessage:SetText(msg) -- TODO doesn't belong here
|
|
||||||
AuxBuyMessage:Show()
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
@@ -171,7 +150,7 @@ function Aux_UpdateRecommendation()
|
|||||||
|
|
||||||
Aux_Sell_SetStackSize(0)
|
Aux_Sell_SetStackSize(0)
|
||||||
Aux_Sell_SetStackCount(0)
|
Aux_Sell_SetStackCount(0)
|
||||||
Aux_SetMessage("Drag an item to the Auction Item area\n\nto see recommended pricing information")
|
Aux.sell.set_message("Drag an item to the Auction Item area\n\nto see recommended pricing information")
|
||||||
else
|
else
|
||||||
AuxSellRefreshButton:Enable()
|
AuxSellRefreshButton:Enable()
|
||||||
|
|
||||||
@@ -224,7 +203,7 @@ function Aux_UpdateRecommendation()
|
|||||||
AuxRecommendBasisText:SetText("(based on auction selected below)")
|
AuxRecommendBasisText:SetText("(based on auction selected below)")
|
||||||
end
|
end
|
||||||
elseif auxSellEntries[currentAuction.name] then
|
elseif auxSellEntries[currentAuction.name] then
|
||||||
Aux_SetMessage("No auctions were found for \n\n"..currentAuction.name)
|
Aux.sell.set_message("No auctions were found for \n\n"..currentAuction.name)
|
||||||
auxSellEntries[currentAuction.name] = nil
|
auxSellEntries[currentAuction.name] = nil
|
||||||
else
|
else
|
||||||
Aux_HideElems(Aux.tabs.sell.shownElements)
|
Aux_HideElems(Aux.tabs.sell.shownElements)
|
||||||
@@ -278,22 +257,16 @@ function Aux_OnNewAuctionUpdate()
|
|||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
if not Aux_Scan_IsIdle() then
|
if not Aux.scan.idle() then
|
||||||
Aux_Scan_Abort()
|
Aux.scan.abort()
|
||||||
end
|
end
|
||||||
|
|
||||||
local auctionItemName, auctionItemTexture, auctionItemStackSize = GetAuctionSellItemInfo()
|
local auctionItemName, auctionItemTexture, auctionItemStackSize = GetAuctionSellItemInfo()
|
||||||
|
|
||||||
Aux_Scan_ClearTooltip()
|
|
||||||
AuxScanTooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
|
||||||
AuxScanTooltip:SetAuctionSellItem()
|
|
||||||
AuxScanTooltip:Show()
|
|
||||||
local tooltip = Aux_Scan_ExtractTooltip()
|
|
||||||
|
|
||||||
currentAuction = auctionItemName and {
|
currentAuction = auctionItemName and {
|
||||||
name = auctionItemName,
|
name = auctionItemName,
|
||||||
texture = auctionItemTexture,
|
texture = auctionItemTexture,
|
||||||
stackSize = Aux_Scan_ItemCharges(tooltip) or auctionItemStackSize,
|
stackSize = Aux.info.auction_sell_item().charges or auctionItemStackSize,
|
||||||
stackCount = 1,
|
stackCount = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -316,17 +289,27 @@ function Aux_RefreshEntries()
|
|||||||
local currentAuctionClass = ItemType2AuctionClass(sType)
|
local currentAuctionClass = ItemType2AuctionClass(sType)
|
||||||
local currentAuctionSubclass = nil -- SubType2AuctionSubclass(currentAuctionClass, sSubType)
|
local currentAuctionSubclass = nil -- SubType2AuctionSubclass(currentAuctionClass, sSubType)
|
||||||
|
|
||||||
Aux_Scan_Start{
|
Aux.sell.set_message('Scanning auctions ...')
|
||||||
query = Aux_Scan_CreateQuery{
|
Aux.scan.start{
|
||||||
|
query = Aux.scan.create_query{
|
||||||
name = currentAuction.name,
|
name = currentAuction.name,
|
||||||
classIndex = currentAuctionClass,
|
classIndex = currentAuctionClass,
|
||||||
subclassIndex = currentAuctionSubclass
|
subclassIndex = currentAuctionSubclass
|
||||||
},
|
},
|
||||||
onComplete = function(data)
|
on_start_page = function(i)
|
||||||
processScanResults(data, currentAuction.name)
|
Aux.sell.set_message('Scanning auctions: page ' .. i .. ' ...')
|
||||||
|
end,
|
||||||
|
on_read_auction = function(i)
|
||||||
|
local auction_item = Aux.info.auction_item(i)
|
||||||
|
if auction_item.name == currentAuction.name then
|
||||||
|
local stack_size = auction_item.charges and auction_item.charges or auction_item.count
|
||||||
|
record_auction(auction_item.name, stack_size, auction_item.buyout_price, auction_item.duration, auction_item.owner)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
on_complete = function()
|
||||||
Aux_SelectAuxEntry()
|
Aux_SelectAuxEntry()
|
||||||
Aux_UpdateRecommendation()
|
Aux_UpdateRecommendation()
|
||||||
end
|
end,
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -424,8 +407,8 @@ end
|
|||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|
||||||
function AuxSellRefreshButton_OnClick()
|
function AuxSellRefreshButton_OnClick()
|
||||||
if not Aux_Scan_IsIdle() then
|
if not Aux.scan.idle() then
|
||||||
Aux_Scan_Abort()
|
Aux.scan.abort()
|
||||||
end
|
end
|
||||||
Aux_RefreshEntries()
|
Aux_RefreshEntries()
|
||||||
Aux_SelectAuxEntry()
|
Aux_SelectAuxEntry()
|
||||||
@@ -447,46 +430,32 @@ end
|
|||||||
|
|
||||||
--*****************************************************************]]
|
--*****************************************************************]]
|
||||||
|
|
||||||
function processScanResults(rawData, auctionItemName)
|
function record_auction(name, stack_size, buyout_price, duration, owner)
|
||||||
|
if buyout_price > 0 then
|
||||||
auxSellEntries[auctionItemName] = { created=GetTime() }
|
auxSellEntries[name] = auxSellEntries[name] or { created = GetTime() }
|
||||||
|
local entry
|
||||||
----- Condense the scan rawData into a table that has only a single entry per stacksize/price combo
|
for _, existingEntry in ipairs(auxSellEntries[name]) do
|
||||||
|
if existingEntry.buyoutPrice == buyout_price and existingEntry.stackSize == stack_size then
|
||||||
local condData = {}
|
entry = existingEntry
|
||||||
|
|
||||||
for _, rawDatum in ipairs(rawData) do
|
|
||||||
if auctionItemName == rawDatum.name and rawDatum.buyoutPrice > 0 then
|
|
||||||
local key = "_"..rawDatum.count.."_"..rawDatum.buyoutPrice
|
|
||||||
|
|
||||||
if not condData[key] then
|
|
||||||
condData[key] = {
|
|
||||||
stackSize = rawDatum.count,
|
|
||||||
buyoutPrice = rawDatum.buyoutPrice,
|
|
||||||
itemPrice = rawDatum.buyoutPrice / rawDatum.count,
|
|
||||||
maxTimeLeft = rawDatum.duration,
|
|
||||||
count = 1,
|
|
||||||
numYours = rawDatum.owner == UnitName("player") and 1 or 0
|
|
||||||
}
|
|
||||||
else
|
|
||||||
condData[key].maxTimeLeft = math.max(condData[key].maxTimeLeft, rawDatum.duration)
|
|
||||||
condData[key].count = condData[key].count + 1
|
|
||||||
if rawDatum.owner == UnitName("player") then
|
|
||||||
condData[key].numYours = condData[key].numYours + 1
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if entry then
|
||||||
|
entry.count = entry.count + 1
|
||||||
|
entry.numYours = entry.numYours + (owner == UnitName("player") and 1 or 0)
|
||||||
|
entry.maxTimeLeft = max(entry.maxTimeLeft, duration)
|
||||||
|
else
|
||||||
|
entry = {
|
||||||
|
stackSize = stack_size,
|
||||||
|
buyoutPrice = buyout_price,
|
||||||
|
itemPrice = buyout_price / stack_size,
|
||||||
|
maxTimeLeft = duration,
|
||||||
|
count = 1,
|
||||||
|
numYours = owner == UnitName("player") and 1 or 0,
|
||||||
|
}
|
||||||
|
tinsert(auxSellEntries[name], entry)
|
||||||
|
table.sort(auxSellEntries[name], function(a,b) return a.itemPrice < b.itemPrice end)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
----- create a table of these entries sorted by itemPrice
|
|
||||||
|
|
||||||
local n = 1
|
|
||||||
for _, condDatum in pairs(condData) do
|
|
||||||
auxSellEntries[auctionItemName][n] = condDatum
|
|
||||||
n = n + 1
|
|
||||||
end
|
|
||||||
|
|
||||||
table.sort(auxSellEntries[auctionItemName], function(a,b) return a.itemPrice < b.itemPrice end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-----------------------------------------
|
-----------------------------------------
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||||
|
|
||||||
<Script file="Sell.lua"/>
|
<Script file="sell.lua"/>
|
||||||
|
|
||||||
<!-- Frame to handle all core events -->
|
<!-- Frame to handle all core events -->
|
||||||
<Frame>
|
<Frame>
|
||||||
|
|||||||
@@ -98,12 +98,7 @@ function stack_size(slot)
|
|||||||
end
|
end
|
||||||
|
|
||||||
function item_charges(slot)
|
function item_charges(slot)
|
||||||
Aux_Scan_ClearTooltip()
|
return Aux.info.container_item(slot.bag, slot.bag_slot).charges
|
||||||
AuxScanTooltip:SetOwner(UIParent, "ANCHOR_NONE")
|
|
||||||
AuxScanTooltip:SetBagItem(slot.bag, slot.bag_slot)
|
|
||||||
AuxScanTooltip:Show()
|
|
||||||
local tooltip = Aux_Scan_ExtractTooltip()
|
|
||||||
return Aux_Scan_ItemCharges(tooltip)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function Aux.stack.onupdate()
|
function Aux.stack.onupdate()
|
||||||
|
|||||||
Reference in New Issue
Block a user