some refactoring
This commit is contained in:
+23
-209
@@ -31,9 +31,6 @@ local Auctionator_Orig_ContainerFrameItemButton_OnClick
|
||||
local Auctionator_Orig_AuctionFrameAuctions_Update
|
||||
local Auctionator_Orig_AuctionsCreateAuctionButton_OnClick
|
||||
|
||||
local forceRefresh = false
|
||||
|
||||
-- local searchResults = {}
|
||||
local selectedAuctionatorEntry
|
||||
|
||||
local currentAuctionItemName = nil
|
||||
@@ -282,12 +279,6 @@ end
|
||||
|
||||
function Auctionator_SetupHookFunctions()
|
||||
|
||||
-- Auctionator_Orig_AuctionFrameBrowse_Update = AuctionFrameBrowse_Update
|
||||
-- AuctionFrameBrowse_Update = Auctionator_AuctionFrameBrowse_Update
|
||||
|
||||
-- Auctionator_Orig_AuctionFrameBrowse_Scan = AuctionFrameBrowse_Scan
|
||||
-- AuctionFrameBrowse_Scan = Auctionator_AuctionFrameBrowse_Scan
|
||||
|
||||
Auctionator_Orig_BrowseButton_OnClick = BrowseButton_OnClick
|
||||
BrowseButton_OnClick = Auctionator_BrowseButton_OnClick
|
||||
|
||||
@@ -516,28 +507,8 @@ function Auctionator_OnNewAuctionUpdate()
|
||||
|
||||
currentAuctionItemName, currentAuctionItemTexture, currentAuctionItemStackSize = GetAuctionSellItemInfo()
|
||||
|
||||
if currentAuctionItemName and (forceRefresh or not auctionatorEntries[currentAuctionItemName]) then
|
||||
|
||||
forceRefresh = false
|
||||
|
||||
auctionatorEntries[currentAuctionItemName] = nil
|
||||
selectedAuctionatorEntry = nil
|
||||
|
||||
local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(currentAuctionItemName)
|
||||
|
||||
local currentAuctionClass = ItemType2AuctionClass(sType)
|
||||
local currentAuctionSubclass = nil -- SubType2AuctionSubclass(currentAuctionClass, sSubType)
|
||||
|
||||
Auctionator_Scan_Start(Auctionator_Scan_CreateQuery{
|
||||
name = currentAuctionItemName,
|
||||
exactMatch = true,
|
||||
classIndex = currentAuctionClass,
|
||||
subclassIndex = currentAuctionSubclass,
|
||||
onComplete = function(data)
|
||||
processScanResults(data, currentAuctionItemName)
|
||||
Auctionator_SelectAuctionatorEntry()
|
||||
end
|
||||
})
|
||||
if currentAuctionItemName and not auctionatorEntries[currentAuctionItemName] then
|
||||
Auctionator_Refresh()
|
||||
end
|
||||
|
||||
Auctionator_SelectAuctionatorEntry()
|
||||
@@ -545,15 +516,25 @@ end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
function Auctionator_OnUpdate()
|
||||
function Auctionator_Refresh()
|
||||
auctionatorEntries[currentAuctionItemName] = nil
|
||||
selectedAuctionatorEntry = nil
|
||||
|
||||
if not AuctionatorMessage then
|
||||
return
|
||||
end
|
||||
local sName, sLink, iRarity, iLevel, iMinLevel, sType, sSubType, iStackCount = GetItemInfo(currentAuctionItemName)
|
||||
|
||||
local currentAuctionClass = ItemType2AuctionClass(sType)
|
||||
local currentAuctionSubclass = nil -- SubType2AuctionSubclass(currentAuctionClass, sSubType)
|
||||
|
||||
if forceRefresh then
|
||||
Auctionator_OnNewAuctionUpdate()
|
||||
end
|
||||
Auctionator_Scan_Start(Auctionator_Scan_CreateQuery{
|
||||
name = currentAuctionItemName,
|
||||
exactMatch = true,
|
||||
classIndex = currentAuctionClass,
|
||||
subclassIndex = currentAuctionSubclass,
|
||||
onComplete = function(data)
|
||||
processScanResults(data, currentAuctionItemName)
|
||||
Auctionator_SelectAuctionatorEntry()
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
@@ -642,7 +623,9 @@ function Auctionator_EntryOnClick()
|
||||
end
|
||||
|
||||
function Auctionator_RefreshButtonOnClick()
|
||||
forceRefresh = true
|
||||
Auctionator_Scan_Abort()
|
||||
Auctionator_Refresh()
|
||||
Auctionator_SelectAuctionatorEntry()
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
@@ -811,173 +794,4 @@ function SubType2AuctionSubclass(auctionClass, itemSubtype)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
-- These functions were meant to be used for a search sorted by buyout price but that actually seems impossible to implement nicely with the vanilla interface
|
||||
|
||||
-- function Auctionator_AuctionFrameBrowse_Update()
|
||||
-- local numBatchAuctions = getn(searchResults)
|
||||
-- local totalAuctions = numBatchAuctions
|
||||
-- local button, buttonName, iconTexture, itemName, color, itemCount, moneyFrame, buyoutMoneyFrame, buyoutText, buttonHighlight
|
||||
-- local offset = FauxScrollFrame_GetOffset(BrowseScrollFrame)
|
||||
-- local index
|
||||
-- local isLastSlotEmpty
|
||||
-- local name, texture, count, quality, canUse, minBid, minIncrement, buyoutPrice, duration, bidAmount, highBidder
|
||||
-- BrowseBidButton:Disable()
|
||||
-- BrowseBuyoutButton:Disable()
|
||||
-- -- Update sort arrows
|
||||
-- SortButton_UpdateArrow(BrowseQualitySort, "list", "quality")
|
||||
-- SortButton_UpdateArrow(BrowseLevelSort, "list", "level")
|
||||
-- SortButton_UpdateArrow(BrowseDurationSort, "list", "duration")
|
||||
-- SortButton_UpdateArrow(BrowseHighBidderSort, "list", "status")
|
||||
-- SortButton_UpdateArrow(BrowseCurrentBidSort, "list", "bid")
|
||||
|
||||
-- -- Show the no results text if no items found
|
||||
-- if numBatchAuctions == 0 then
|
||||
-- BrowseNoResultsText:Show()
|
||||
-- else
|
||||
-- BrowseNoResultsText:Hide()
|
||||
-- end
|
||||
|
||||
-- for i=1, NUM_BROWSE_TO_DISPLAY do
|
||||
-- index = offset + i
|
||||
-- button = getglobal("BrowseButton"..i)
|
||||
-- -- Show or hide auction buttons
|
||||
-- if index > numBatchAuctions then
|
||||
-- button:Hide()
|
||||
-- -- If the last button is empty then set isLastSlotEmpty var
|
||||
-- if i == NUM_BROWSE_TO_DISPLAY then
|
||||
-- isLastSlotEmpty = 1
|
||||
-- end
|
||||
-- else
|
||||
-- button:Show()
|
||||
|
||||
-- buttonName = "BrowseButton"..i
|
||||
-- local name, texture, count, quality, canUse, level, minBid, minIncrement, buyoutPrice, bidAmount, highBidder = GetAuctionItemInfo("list", index);
|
||||
-- -- duration = GetAuctionItemTimeLeft("list", offset + i)
|
||||
-- -- Resize button if there isn't a scrollbar
|
||||
-- buttonHighlight = getglobal("BrowseButton"..i.."Highlight")
|
||||
-- if numBatchAuctions < NUM_BROWSE_TO_DISPLAY then
|
||||
-- button:SetWidth(557)
|
||||
-- buttonHighlight:SetWidth(523)
|
||||
-- BrowseCurrentBidSort:SetWidth(173)
|
||||
-- else
|
||||
-- button:SetWidth(532)
|
||||
-- buttonHighlight:SetWidth(502)
|
||||
-- BrowseCurrentBidSort:SetWidth(157)
|
||||
-- end
|
||||
-- -- Set name and quality color
|
||||
-- color = ITEM_QUALITY_COLORS[searchResults[i].quality]
|
||||
-- itemName = getglobal(buttonName.."Name")
|
||||
-- itemName:SetText(searchResults[i].name)
|
||||
-- itemName:SetVertexColor(color.r, color.g, color.b)
|
||||
-- -- Set level
|
||||
-- if searchResults[i].level > UnitLevel("player") then
|
||||
-- getglobal(buttonName.."Level"):SetText(RED_FONT_COLOR_CODE..level..FONT_COLOR_CODE_CLOSE)
|
||||
-- else
|
||||
-- getglobal(buttonName.."Level"):SetText(searchResults[i].level)
|
||||
-- end
|
||||
-- -- Set high bidder
|
||||
-- getglobal(buttonName.."HighBidder"):SetText(searchResults[i].highBidder)
|
||||
-- -- Set closing time
|
||||
-- getglobal(buttonName.."ClosingTimeText"):SetText(AuctionFrame_GetTimeLeftText(searchResults[i].duration))
|
||||
-- getglobal(buttonName.."ClosingTime").tooltip = AuctionFrame_GetTimeLeftTooltipText(searchResults[i].duration)
|
||||
-- -- Set item texture, count, and usability
|
||||
-- iconTexture = getglobal(buttonName.."ItemIconTexture")
|
||||
-- iconTexture:SetTexture(searchResults[i].texture)
|
||||
-- if not searchResults[i].canUse then
|
||||
-- iconTexture:SetVertexColor(1.0, 0.1, 0.1)
|
||||
-- else
|
||||
-- iconTexture:SetVertexColor(1.0, 1.0, 1.0)
|
||||
-- end
|
||||
-- itemCount = getglobal(buttonName.."ItemCount")
|
||||
-- if searchResults[i].stackSize > 1 then
|
||||
-- itemCount:SetText(searchResults[i].stackSize)
|
||||
-- itemCount:Show()
|
||||
-- else
|
||||
-- itemCount:Hide()
|
||||
-- end
|
||||
-- -- Set high bid
|
||||
-- moneyFrame = getglobal(buttonName.."MoneyFrame")
|
||||
-- buyoutMoneyFrame = getglobal(buttonName.."BuyoutMoneyFrame")
|
||||
-- buyoutText = getglobal(buttonName.."BuyoutText")
|
||||
-- -- If not bidAmount set the bid amount to the min bid
|
||||
-- if searchResults[i].bidAmount == 0 then
|
||||
-- MoneyFrame_Update(moneyFrame:GetName(), searchResults[i].minBid)
|
||||
-- else
|
||||
-- MoneyFrame_Update(moneyFrame:GetName(), searchResults[i].bidAmount)
|
||||
-- end
|
||||
|
||||
-- if searchResults[i].buyoutPrice > 0 then
|
||||
-- moneyFrame:SetPoint("RIGHT", buttonName, "RIGHT", 10, 10)
|
||||
-- MoneyFrame_Update(buyoutMoneyFrame:GetName(), searchResults[i].buyoutPrice)
|
||||
-- buyoutMoneyFrame:Show()
|
||||
-- buyoutText:Show()
|
||||
-- else
|
||||
-- moneyFrame:SetPoint("RIGHT", buttonName, "RIGHT", 10, 3)
|
||||
-- buyoutMoneyFrame:Hide()
|
||||
-- buyoutText:Hide()
|
||||
-- end
|
||||
-- -- Set high bidder
|
||||
-- local highBidder = searchResults[i].highBidder
|
||||
-- if not highBidder then
|
||||
-- highBidder = RED_FONT_COLOR_CODE..NO_BIDS..FONT_COLOR_CODE_CLOSE
|
||||
-- end
|
||||
-- getglobal(buttonName.."HighBidder"):SetText(highBidder)
|
||||
-- -- Set highlight
|
||||
-- if GetSelectedAuctionItem("list") and (offset + i) == GetSelectedAuctionItem("list") then
|
||||
-- button:LockHighlight()
|
||||
-- if highBidder ~= UnitName("player") then
|
||||
-- BrowseBidButton:Enable()
|
||||
-- end
|
||||
|
||||
-- if searchResults[i].buyoutPrice > 0 and searchResults[i].buyoutPrice >= searchResults[i].minBid then
|
||||
-- BrowseBuyoutButton:Enable()
|
||||
-- AuctionFrame.buyoutPrice = searchResults[i].buyoutPrice
|
||||
-- else
|
||||
-- AuctionFrame.buyoutPrice = nil
|
||||
-- end
|
||||
-- -- Set bid
|
||||
-- local bidAmount = searchResults[i].bidAmount
|
||||
-- if bidAmount > 0 then
|
||||
-- bidAmount = bidAmount + searchResults[i].minIncrement
|
||||
-- MoneyInputFrame_SetCopper(BrowseBidPrice, bidAmount)
|
||||
-- else
|
||||
-- MoneyInputFrame_SetCopper(BrowseBidPrice, searchResults[i].minBid)
|
||||
-- end
|
||||
|
||||
-- else
|
||||
-- button:UnlockHighlight()
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- BrowsePrevPageButton:Hide()
|
||||
-- BrowseNextPageButton:Hide()
|
||||
-- BrowseScanCountText:Hide()
|
||||
-- FauxScrollFrame_Update(BrowseScrollFrame, numBatchAuctions, NUM_BROWSE_TO_DISPLAY, AUCTIONS_BUTTON_HEIGHT)
|
||||
-- end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
-- function Auctionator_AuctionFrameBrowse_Scan()
|
||||
|
||||
-- Auctionator_Scan_Start(Auctionator_Scan_CreateQuery{
|
||||
-- name = BrowseName:GetText(),
|
||||
-- exactMatch = false,
|
||||
-- minLevel = BrowseMinLevel:GetText(),
|
||||
-- maxLevel = BrowseMaxLevel:GetText(),
|
||||
-- invTypeIndex = AuctionFrameBrowse.selectedInvtypeIndex,
|
||||
-- classIndex = AuctionFrameBrowse.selectedClassIndex,
|
||||
-- subclassIndex = AuctionFrameBrowse.selectedSubclassIndex,
|
||||
-- isUsable = IsUsableCheckButton:GetChecked(),
|
||||
-- qualityIndex = UIDropDownMenu_GetSelectedValue(BrowseDropDown),
|
||||
-- onComplete = function(data)
|
||||
-- table.sort(data, function(a,b) return a.buyoutPrice < b.buyoutPrice end)
|
||||
-- scanData = data
|
||||
-- end
|
||||
-- })
|
||||
|
||||
-- end
|
||||
end
|
||||
@@ -5,5 +5,6 @@
|
||||
## SavedVariables: auctionatorEntries
|
||||
Scan.lua
|
||||
Auctionator.xml
|
||||
Buy.xml
|
||||
Options.xml
|
||||
About.xml
|
||||
|
||||
@@ -12,9 +12,6 @@
|
||||
this:RegisterEvent("AUCTION_HOUSE_SHOW")
|
||||
this:RegisterEvent("AUCTION_HOUSE_CLOSED")
|
||||
</OnLoad>
|
||||
<OnUpdate>
|
||||
Auctionator_OnUpdate()
|
||||
</OnUpdate>
|
||||
<OnEvent>
|
||||
Auctionator_EventHandler()
|
||||
</OnEvent>
|
||||
@@ -305,93 +302,4 @@
|
||||
<Button name="AuctionatorEntry15" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="AuctionatorEntry14" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
</Frames>
|
||||
</Frame>
|
||||
<Frame name="Auctionator_Buy_Template" virtual="true" hidden="true">
|
||||
<Size>
|
||||
<AbsDimension x="550" y="447"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="210" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
|
||||
<FontString inherits="GameFontNormal" text="Advanced Search">
|
||||
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="-100" y="-18"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
|
||||
<FontString name="Auctionator_Buy_SearchBox_Label" inherits="GameFontNormalSmall" text="Search For">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="40" y="-50"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
|
||||
</Layer>
|
||||
|
||||
</Layers>
|
||||
|
||||
<Frames>
|
||||
|
||||
<EditBox name="Auctionator_Buy_SearchBox" autoFocus="false" inherits="InputBoxTemplate">
|
||||
<Size><AbsDimension x="240" y="20"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_SearchBox_Label" relativePoint="BOTTOMLEFT"><Offset><AbsDimension x="2" y="-4"/></Offset></Anchor></Anchors>
|
||||
</EditBox>
|
||||
|
||||
<Button name="Auctionator_Buy_SearchButton" inherits="UIPanelButtonTemplate" text="Search">
|
||||
<Size><AbsDimension x="80" y="22"/></Size>
|
||||
<Anchors><Anchor point="RIGHT" relativeTo="Auctionator_Buy_SearchBox" relativePoint="RIGHT"><Offset><AbsDimension x="90" y="3" /></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
|
||||
|
||||
<Button name="Auctionator_Buy_RefreshButton" inherits="UIPanelButtonTemplate" text="Refresh">
|
||||
<Size><AbsDimension x="126" y="22"/> </Size>
|
||||
<Anchors><Anchor point="RIGHT"><Offset><AbsDimension x="-14" y="-199"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
<!-- Auctionator_RefreshButtonOnClick() -->
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<ScrollFrame name="Auctionator_Buy_ScrollFrame" inherits="FauxScrollFrameTemplate">
|
||||
<Size><AbsDimension x="588" y="194"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="-213"/></Offset></Anchor></Anchors>
|
||||
|
||||
<Scripts>
|
||||
<OnVerticalScroll>
|
||||
<!--FauxScrollFrame_OnVerticalScroll(16, Auctionator_ScrollbarUpdate)-->
|
||||
</OnVerticalScroll>
|
||||
<OnShow>
|
||||
<!--Auctionator_ScrollbarUpdate();-->
|
||||
</OnShow>
|
||||
</Scripts>
|
||||
</ScrollFrame>
|
||||
|
||||
<Button name="Auctionator_Buy_Entry1" inherits="AuctionatorEntryTemplate">
|
||||
<Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_ScrollFrame" relativePoint="TOPLEFT"><Offset><AbsDimension x="8" y="0"/></Offset></Anchor></Anchors>
|
||||
</Button>
|
||||
<Button name="Auctionator_Buy_Entry2" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry1" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry3" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry2" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry4" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry3" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry5" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry4" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry6" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry5" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry7" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry6" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry8" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry7" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry9" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry8" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry10" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry9" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry11" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry10" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry12" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry11" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry13" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry12" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry14" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry13" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry15" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry14" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Ui>
|
||||
|
||||
@@ -0,0 +1,209 @@
|
||||
local processScanResults
|
||||
local processedData;
|
||||
|
||||
function AuctionatorBuySearchButton_OnClick()
|
||||
|
||||
Auctionator_Scan_Start(Auctionator_Scan_CreateQuery{
|
||||
name = AuctionatorBuySearchBox:GetText(),
|
||||
exactMatch = true,
|
||||
onComplete = function(data)
|
||||
table.sort(data, function(a,b) return a.buyoutPrice < b.buyoutPrice end)
|
||||
scanData = data
|
||||
end
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
function processScanResults(rawData, auctionItemName)
|
||||
|
||||
processedData = {}
|
||||
|
||||
----- Condense the scan rawData into a table that has only a single entry per stacksize/price combo
|
||||
|
||||
local condData = {}
|
||||
|
||||
for _,rawDatum in ipairs(rawData) do
|
||||
|
||||
local key = "_"..rawDatum.stackSize.."_"..rawDatum.buyoutPrice
|
||||
|
||||
if condData[key] then
|
||||
condData[key].count = condData[key].count + 1
|
||||
else
|
||||
condData[key] = {
|
||||
stackSize = rawDatum.stackSize,
|
||||
buyoutPrice = rawDatum.buyoutPrice,
|
||||
itemPrice = rawDatum.buyoutPrice / rawDatum.stackSize,
|
||||
count = 1,
|
||||
numYours = rawDatum.owner == UnitName("player") and 1 or 0
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
----- create a table of these entries sorted by itemPrice
|
||||
|
||||
local n = 1
|
||||
for _,condDatum in pairs(condData) do
|
||||
processedData[n] = condDatum
|
||||
n = n + 1
|
||||
end
|
||||
|
||||
table.sort(processedData, function(a,b) return a.itemPrice < b.itemPrice end)
|
||||
end
|
||||
|
||||
-----------------------------------------
|
||||
|
||||
-- These functions were meant to be used for a search sorted by buyout price but that actually seems impossible to implement nicely with the vanilla interface
|
||||
|
||||
-- function Auctionator_AuctionFrameBrowse_Update()
|
||||
-- local numBatchAuctions = getn(searchResults)
|
||||
-- local totalAuctions = numBatchAuctions
|
||||
-- local button, buttonName, iconTexture, itemName, color, itemCount, moneyFrame, buyoutMoneyFrame, buyoutText, buttonHighlight
|
||||
-- local offset = FauxScrollFrame_GetOffset(BrowseScrollFrame)
|
||||
-- local index
|
||||
-- local isLastSlotEmpty
|
||||
-- local name, texture, count, quality, canUse, minBid, minIncrement, buyoutPrice, duration, bidAmount, highBidder
|
||||
-- BrowseBidButton:Disable()
|
||||
-- BrowseBuyoutButton:Disable()
|
||||
-- -- Update sort arrows
|
||||
-- SortButton_UpdateArrow(BrowseQualitySort, "list", "quality")
|
||||
-- SortButton_UpdateArrow(BrowseLevelSort, "list", "level")
|
||||
-- SortButton_UpdateArrow(BrowseDurationSort, "list", "duration")
|
||||
-- SortButton_UpdateArrow(BrowseHighBidderSort, "list", "status")
|
||||
-- SortButton_UpdateArrow(BrowseCurrentBidSort, "list", "bid")
|
||||
|
||||
-- -- Show the no results text if no items found
|
||||
-- if numBatchAuctions == 0 then
|
||||
-- BrowseNoResultsText:Show()
|
||||
-- else
|
||||
-- BrowseNoResultsText:Hide()
|
||||
-- end
|
||||
|
||||
-- for i=1, NUM_BROWSE_TO_DISPLAY do
|
||||
-- index = offset + i
|
||||
-- button = getglobal("BrowseButton"..i)
|
||||
-- -- Show or hide auction buttons
|
||||
-- if index > numBatchAuctions then
|
||||
-- button:Hide()
|
||||
-- -- If the last button is empty then set isLastSlotEmpty var
|
||||
-- if i == NUM_BROWSE_TO_DISPLAY then
|
||||
-- isLastSlotEmpty = 1
|
||||
-- end
|
||||
-- else
|
||||
-- button:Show()
|
||||
|
||||
-- buttonName = "BrowseButton"..i
|
||||
-- local name, texture, count, quality, canUse, level, minBid, minIncrement, buyoutPrice, bidAmount, highBidder = GetAuctionItemInfo("list", index);
|
||||
-- -- duration = GetAuctionItemTimeLeft("list", offset + i)
|
||||
-- -- Resize button if there isn't a scrollbar
|
||||
-- buttonHighlight = getglobal("BrowseButton"..i.."Highlight")
|
||||
-- if numBatchAuctions < NUM_BROWSE_TO_DISPLAY then
|
||||
-- button:SetWidth(557)
|
||||
-- buttonHighlight:SetWidth(523)
|
||||
-- BrowseCurrentBidSort:SetWidth(173)
|
||||
-- else
|
||||
-- button:SetWidth(532)
|
||||
-- buttonHighlight:SetWidth(502)
|
||||
-- BrowseCurrentBidSort:SetWidth(157)
|
||||
-- end
|
||||
-- -- Set name and quality color
|
||||
-- color = ITEM_QUALITY_COLORS[searchResults[i].quality]
|
||||
-- itemName = getglobal(buttonName.."Name")
|
||||
-- itemName:SetText(searchResults[i].name)
|
||||
-- itemName:SetVertexColor(color.r, color.g, color.b)
|
||||
-- -- Set level
|
||||
-- if searchResults[i].level > UnitLevel("player") then
|
||||
-- getglobal(buttonName.."Level"):SetText(RED_FONT_COLOR_CODE..level..FONT_COLOR_CODE_CLOSE)
|
||||
-- else
|
||||
-- getglobal(buttonName.."Level"):SetText(searchResults[i].level)
|
||||
-- end
|
||||
-- -- Set high bidder
|
||||
-- getglobal(buttonName.."HighBidder"):SetText(searchResults[i].highBidder)
|
||||
-- -- Set closing time
|
||||
-- getglobal(buttonName.."ClosingTimeText"):SetText(AuctionFrame_GetTimeLeftText(searchResults[i].duration))
|
||||
-- getglobal(buttonName.."ClosingTime").tooltip = AuctionFrame_GetTimeLeftTooltipText(searchResults[i].duration)
|
||||
-- -- Set item texture, count, and usability
|
||||
-- iconTexture = getglobal(buttonName.."ItemIconTexture")
|
||||
-- iconTexture:SetTexture(searchResults[i].texture)
|
||||
-- if not searchResults[i].canUse then
|
||||
-- iconTexture:SetVertexColor(1.0, 0.1, 0.1)
|
||||
-- else
|
||||
-- iconTexture:SetVertexColor(1.0, 1.0, 1.0)
|
||||
-- end
|
||||
-- itemCount = getglobal(buttonName.."ItemCount")
|
||||
-- if searchResults[i].stackSize > 1 then
|
||||
-- itemCount:SetText(searchResults[i].stackSize)
|
||||
-- itemCount:Show()
|
||||
-- else
|
||||
-- itemCount:Hide()
|
||||
-- end
|
||||
-- -- Set high bid
|
||||
-- moneyFrame = getglobal(buttonName.."MoneyFrame")
|
||||
-- buyoutMoneyFrame = getglobal(buttonName.."BuyoutMoneyFrame")
|
||||
-- buyoutText = getglobal(buttonName.."BuyoutText")
|
||||
-- -- If not bidAmount set the bid amount to the min bid
|
||||
-- if searchResults[i].bidAmount == 0 then
|
||||
-- MoneyFrame_Update(moneyFrame:GetName(), searchResults[i].minBid)
|
||||
-- else
|
||||
-- MoneyFrame_Update(moneyFrame:GetName(), searchResults[i].bidAmount)
|
||||
-- end
|
||||
|
||||
-- if searchResults[i].buyoutPrice > 0 then
|
||||
-- moneyFrame:SetPoint("RIGHT", buttonName, "RIGHT", 10, 10)
|
||||
-- MoneyFrame_Update(buyoutMoneyFrame:GetName(), searchResults[i].buyoutPrice)
|
||||
-- buyoutMoneyFrame:Show()
|
||||
-- buyoutText:Show()
|
||||
-- else
|
||||
-- moneyFrame:SetPoint("RIGHT", buttonName, "RIGHT", 10, 3)
|
||||
-- buyoutMoneyFrame:Hide()
|
||||
-- buyoutText:Hide()
|
||||
-- end
|
||||
-- -- Set high bidder
|
||||
-- local highBidder = searchResults[i].highBidder
|
||||
-- if not highBidder then
|
||||
-- highBidder = RED_FONT_COLOR_CODE..NO_BIDS..FONT_COLOR_CODE_CLOSE
|
||||
-- end
|
||||
-- getglobal(buttonName.."HighBidder"):SetText(highBidder)
|
||||
-- -- Set highlight
|
||||
-- if GetSelectedAuctionItem("list") and (offset + i) == GetSelectedAuctionItem("list") then
|
||||
-- button:LockHighlight()
|
||||
-- if highBidder ~= UnitName("player") then
|
||||
-- BrowseBidButton:Enable()
|
||||
-- end
|
||||
|
||||
-- if searchResults[i].buyoutPrice > 0 and searchResults[i].buyoutPrice >= searchResults[i].minBid then
|
||||
-- BrowseBuyoutButton:Enable()
|
||||
-- AuctionFrame.buyoutPrice = searchResults[i].buyoutPrice
|
||||
-- else
|
||||
-- AuctionFrame.buyoutPrice = nil
|
||||
-- end
|
||||
-- -- Set bid
|
||||
-- local bidAmount = searchResults[i].bidAmount
|
||||
-- if bidAmount > 0 then
|
||||
-- bidAmount = bidAmount + searchResults[i].minIncrement
|
||||
-- MoneyInputFrame_SetCopper(BrowseBidPrice, bidAmount)
|
||||
-- else
|
||||
-- MoneyInputFrame_SetCopper(BrowseBidPrice, searchResults[i].minBid)
|
||||
-- end
|
||||
|
||||
-- else
|
||||
-- button:UnlockHighlight()
|
||||
-- end
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- BrowsePrevPageButton:Hide()
|
||||
-- BrowseNextPageButton:Hide()
|
||||
-- BrowseScanCountText:Hide()
|
||||
-- FauxScrollFrame_Update(BrowseScrollFrame, numBatchAuctions, NUM_BROWSE_TO_DISPLAY, AUCTIONS_BUTTON_HEIGHT)
|
||||
-- end
|
||||
|
||||
local eventFrame = CreateFrame("Frame")
|
||||
eventFrame:SetScript("OnUpdate", function()
|
||||
|
||||
end)
|
||||
-- eventFrame:RegisterEvent("AUCTION_ITEM_LIST_UPDATE")
|
||||
-- eventFrame:SetScript("OnEvent", function(event)
|
||||
-- if state == STATE_POSTQUERY then
|
||||
-- processQueryResults()
|
||||
-- end
|
||||
-- end)
|
||||
@@ -0,0 +1,94 @@
|
||||
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
|
||||
|
||||
<Script file="Buy.lua"/>
|
||||
|
||||
<Frame name="Auctionator_Buy_Template" virtual="true" hidden="true">
|
||||
<Size>
|
||||
<AbsDimension x="550" y="447"/>
|
||||
</Size>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="210" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
|
||||
<FontString inherits="GameFontNormal" text="Advanced Search">
|
||||
<Anchors><Anchor point="TOP"><Offset><AbsDimension x="-100" y="-18"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
|
||||
<FontString name="Auctionator_Buy_SearchBox_Label" inherits="GameFontNormalSmall" text="Search For">
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="40" y="-50"/></Offset></Anchor></Anchors>
|
||||
</FontString>
|
||||
|
||||
</Layer>
|
||||
|
||||
</Layers>
|
||||
|
||||
<Frames>
|
||||
|
||||
<EditBox name="AuctionatorBuySearchBox" autoFocus="false" inherits="InputBoxTemplate">
|
||||
<Size><AbsDimension x="240" y="20"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_SearchBox_Label" relativePoint="BOTTOMLEFT"><Offset><AbsDimension x="2" y="-4"/></Offset></Anchor></Anchors>
|
||||
</EditBox>
|
||||
|
||||
<Button name="AuctionatorBuySearchButton" inherits="UIPanelButtonTemplate" text="Search">
|
||||
<Size><AbsDimension x="80" y="22"/></Size>
|
||||
<Anchors><Anchor point="RIGHT" relativeTo="Auctionator_Buy_SearchBox" relativePoint="RIGHT"><Offset><AbsDimension x="90" y="3" /></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
AuctionatorBuySearchButton_Onclick()
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
|
||||
|
||||
<Button name="Auctionator_Buy_RefreshButton" inherits="UIPanelButtonTemplate" text="Refresh">
|
||||
<Size><AbsDimension x="126" y="22"/> </Size>
|
||||
<Anchors><Anchor point="RIGHT"><Offset><AbsDimension x="-14" y="-199"/></Offset></Anchor></Anchors>
|
||||
<Scripts>
|
||||
<OnClick>
|
||||
<!-- Auctionator_RefreshButtonOnClick() -->
|
||||
</OnClick>
|
||||
</Scripts>
|
||||
</Button>
|
||||
|
||||
<ScrollFrame name="Auctionator_Buy_ScrollFrame" inherits="FauxScrollFrameTemplate">
|
||||
<Size><AbsDimension x="588" y="194"/></Size>
|
||||
<Anchors><Anchor point="TOPLEFT"><Offset><AbsDimension x="0" y="-213"/></Offset></Anchor></Anchors>
|
||||
|
||||
<Scripts>
|
||||
<OnVerticalScroll>
|
||||
<!--FauxScrollFrame_OnVerticalScroll(16, Auctionator_ScrollbarUpdate)-->
|
||||
</OnVerticalScroll>
|
||||
<OnShow>
|
||||
<!--Auctionator_ScrollbarUpdate();-->
|
||||
</OnShow>
|
||||
</Scripts>
|
||||
</ScrollFrame>
|
||||
|
||||
<Button name="Auctionator_Buy_Entry1" inherits="AuctionatorEntryTemplate">
|
||||
<Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_ScrollFrame" relativePoint="TOPLEFT"><Offset><AbsDimension x="8" y="0"/></Offset></Anchor></Anchors>
|
||||
</Button>
|
||||
<Button name="Auctionator_Buy_Entry2" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry1" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry3" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry2" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry4" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry3" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry5" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry4" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry6" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry5" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry7" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry6" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry8" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry7" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry9" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry8" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry10" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry9" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry11" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry10" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry12" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry11" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry13" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry12" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry14" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry13" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
<Button name="Auctionator_Buy_Entry15" inherits="AuctionatorEntryTemplate"><Anchors><Anchor point="TOPLEFT" relativeTo="Auctionator_Buy_Entry14" relativePoint="BOTTOMLEFT"/></Anchors></Button>
|
||||
</Frames>
|
||||
</Frame>
|
||||
</Ui>
|
||||
Reference in New Issue
Block a user