perfected the buying mechanism

This commit is contained in:
Manuel Simon Hirsig
2016-02-01 19:25:17 +01:00
parent c5130a6d97
commit 3eb28c4281
12 changed files with 331 additions and 428 deletions
+5 -5
View File
@@ -1,7 +1,7 @@
## Interface: 11200
## Title: Aux
## Notes: A lightweight addon designed to help manage auctions
## SavedVariablesPerCharacter: aux_recent_searches, aux_favorite_searches, AUX_AUCTION_DURATION
## SavedVariablesPerCharacter: aux_recent_searches, aux_favorite_searches, aux_auction_duration, aux_scale
## SavedVariables: aux_database, aux_auctionable_items
slash.lua
@@ -11,7 +11,6 @@ control.xml
persistence.lua
util.lua
money.lua
groups.lua
scan.lua
scan_util.lua
@@ -25,12 +24,13 @@ history.lua
info.xml
completion.xml
item_search_frame.xml
filter_search_frame.xml
search_frame.xml
post_frame.xml
auctions_frame.xml
bids_frame.xml
scan_frame.xml
static.xml
test.lua
+77 -67
View File
@@ -119,7 +119,19 @@ local methods = {
OnCellClick = function()
local button = arg1
if this.rt.disabled then return end
this.rt:SetSelectedRecord(this.row.data.record)
if IsControlKeyDown() then
DressUpItemLink(this.row.data.record.hyperlink)
elseif IsShiftKeyDown() then
if ChatFrameEditBox:IsVisible() then
ChatFrameEditBox:Insert(this.row.data.record.hyperlink)
end
elseif IsAltKeyDown() then
if this.rt.handlers.OnCellAltClick then
this.rt.handlers.OnCellAltClick(this, button)
end
else
this.rt:SetSelectedRecord(this.row.data.record)
end
end,
OnCellDoubleClick = function()
@@ -152,10 +164,10 @@ local methods = {
end,
GetRecordPercent = function(rt, record)
GetRecordPercent = function(self, record)
if not record then return end
-- cache the market value on the record
-- record.market_value = record.market_value or rt.GetMarketValue(record.item_key) or 0
-- record.market_value = record.market_value or self.GetMarketValue(record.item_key) or 0
-- if record.marketValue > 0 then
-- if record.itemBuyout > 0 then
-- return Aux.round(100 * record.itemBuyout / record.marketValue, 1)
@@ -172,15 +184,15 @@ local methods = {
end
end,
UpdateRowInfo = function(rt)
Aux.util.wipe(rt.rowInfo)
rt.rowInfo.numDisplayRows = 0
rt.sortInfo.isSorted = nil
rt:SetSelectedRecord(nil, true)
UpdateRowInfo = function(self)
Aux.util.wipe(self.rowInfo)
self.rowInfo.numDisplayRows = 0
self.sortInfo.isSorted = nil
self:SetSelectedRecord(nil, true)
sort(rt.records, function(a,b) return a.search_signature < b.search_signature end)
sort(self.records, function(a,b) return a.search_signature < b.search_signature end)
local records = rt.records
local records = self.records
if getn(records) == 0 then return end
-- Populate the row info from the database by combining identical auctions and auctions
@@ -190,21 +202,21 @@ local methods = {
local prevRecord = records[i-1]
if prevRecord and record.search_signature == prevRecord.search_signature then
-- it's an identical auction to the previous row so increment the number of auctions
rt.rowInfo[getn(rt.rowInfo)].children[getn(rt.rowInfo[getn(rt.rowInfo)].children)].numAuctions = rt.rowInfo[getn(rt.rowInfo)].children[getn(rt.rowInfo[getn(rt.rowInfo)].children)].numAuctions + 1
self.rowInfo[getn(self.rowInfo)].children[getn(self.rowInfo[getn(self.rowInfo)].children)].numAuctions = self.rowInfo[getn(self.rowInfo)].children[getn(self.rowInfo[getn(self.rowInfo)].children)].numAuctions + 1
elseif prevRecord and record.item_key == prevRecord.item_key then
-- it's the same base item as the previous row so insert a new auction
tinsert(rt.rowInfo[getn(rt.rowInfo)].children, {numAuctions=1, record=record})
if rt.expanded[rt.rowInfo[getn(rt.rowInfo)].expandKey] then
rt.rowInfo.numDisplayRows = rt.rowInfo.numDisplayRows + 1
tinsert(self.rowInfo[getn(self.rowInfo)].children, {numAuctions=1, record=record})
if self.expanded[self.rowInfo[getn(self.rowInfo)].expandKey] then
self.rowInfo.numDisplayRows = self.rowInfo.numDisplayRows + 1
end
else
-- it's a different base item from the previous row
tinsert(rt.rowInfo, {item_key=record.item_key, expandKey=record.item_key, children={{numAuctions=1, record=record}}})
rt.rowInfo.numDisplayRows = rt.rowInfo.numDisplayRows + 1
tinsert(self.rowInfo, {item_key=record.item_key, expandKey=record.item_key, children={{numAuctions=1, record=record}}})
self.rowInfo.numDisplayRows = self.rowInfo.numDisplayRows + 1
end
end
for _, info in ipairs(rt.rowInfo) do
for _, info in ipairs(self.rowInfo) do
local totalAuctions, totalPlayerAuctions = 0, 0
for _, childInfo in ipairs(info.children) do
totalAuctions = totalAuctions + childInfo.numAuctions
@@ -217,36 +229,36 @@ local methods = {
end
end,
UpdateRows = function(rt)
UpdateRows = function(self)
-- hide all the rows
for _, row in ipairs(rt.rows) do row:Hide() end
for _, row in ipairs(self.rows) do row:Hide() end
-- update sorting highlights
for _, cell in ipairs(rt.headCells) do
for _, cell in ipairs(self.headCells) do
local tex = cell:GetNormalTexture()
tex:SetTexture([[Interface\AddOns\Aux-AddOn\WorldStateFinalScore-Highlight]])
tex:SetTexCoord(0.017, 1, 0.083, 0.909)
tex:SetAlpha(0.5)
end
if rt.sortInfo.descending then
rt.headCells[rt.sortInfo.columnIndex]:GetNormalTexture():SetTexture(0.8, 0.6, 1, 0.8)
if self.sortInfo.descending then
self.headCells[self.sortInfo.columnIndex]:GetNormalTexture():SetTexture(0.8, 0.6, 1, 0.8)
else
rt.headCells[rt.sortInfo.columnIndex]:GetNormalTexture():SetTexture(0.6, 0.8, 1, 0.8)
self.headCells[self.sortInfo.columnIndex]:GetNormalTexture():SetTexture(0.6, 0.8, 1, 0.8)
end
-- update the scroll frame
FauxScrollFrame_Update(rt.scrollFrame, rt.rowInfo.numDisplayRows, getn(rt.rows), rt.ROW_HEIGHT)
FauxScrollFrame_Update(self.scrollFrame, self.rowInfo.numDisplayRows, getn(self.rows), self.ROW_HEIGHT)
-- make sure the offset is not too high
local maxOffset = max(rt.rowInfo.numDisplayRows - getn(rt.rows), 0)
if FauxScrollFrame_GetOffset(rt.scrollFrame) > maxOffset then
FauxScrollFrame_SetOffset(rt.scrollFrame, maxOffset)
local maxOffset = max(self.rowInfo.numDisplayRows - getn(self.rows), 0)
if FauxScrollFrame_GetOffset(self.scrollFrame) > maxOffset then
FauxScrollFrame_SetOffset(self.scrollFrame, maxOffset)
end
if not rt.sortInfo.isSorted then
if not self.sortInfo.isSorted then
local function SortHelperFunc(a, b, sortKey)
local hadSortKey = sortKey and true or false
sortKey = sortKey or rt.sortInfo.sortKey
sortKey = sortKey or self.sortInfo.sortKey
local aVal, bVal
if a.children then
aVal = a.children[1].record
@@ -261,17 +273,17 @@ local methods = {
return false
end
if sortKey == "percent" then
aVal = rt:GetRecordPercent(aVal)
bVal = rt:GetRecordPercent(bVal)
aVal = self:GetRecordPercent(aVal)
bVal = self:GetRecordPercent(bVal)
elseif sortKey == "numAuctions" then
aVal = a.totalAuctions
bVal = b.totalAuctions
elseif sortKey == "itemDisplayedBid" or sortKey == "displayedBid" then
aVal = rt.GetRowPrices(aVal, sortKey == "itemDisplayedBid")
bVal = rt.GetRowPrices(bVal, sortKey == "itemDisplayedBid")
aVal = self.GetRowPrices(aVal, sortKey == "itemDisplayedBid")
bVal = self.GetRowPrices(bVal, sortKey == "itemDisplayedBid")
elseif sortKey == "itemBuyout" or sortKey == "buyout" then
aVal = ({ rt.GetRowPrices(aVal, sortKey == "itemBuyout") })[2]
bVal = ({ rt.GetRowPrices(bVal, sortKey == "itemBuyout") })[2]
aVal = ({ self.GetRowPrices(aVal, sortKey == "itemBuyout") })[2]
bVal = ({ self.GetRowPrices(bVal, sortKey == "itemBuyout") })[2]
else
aVal = aVal[sortKey]
bVal = bVal[sortKey]
@@ -279,15 +291,15 @@ local methods = {
if sortKey == 'buyout' or sortKey == 'itemBuyout' then
-- for buyout, put bid-only auctions at the bottom
if not aVal or aVal == 0 then
aVal = (rt.sortInfo.descending and -1 or 1) * Aux.huge
aVal = (self.sortInfo.descending and -1 or 1) * Aux.huge
end
if not bVal or bVal == 0 then
bVal = (rt.sortInfo.descending and -1 or 1) * Aux.huge
bVal = (self.sortInfo.descending and -1 or 1) * Aux.huge
end
elseif sortKey == "percent" then
-- for percent, put bid-only auctions at the bottom
aVal = aVal or ((rt.sortInfo.descending and -1 or 1) * Aux.huge)
bVal = bVal or ((rt.sortInfo.descending and -1 or 1) * Aux.huge)
aVal = aVal or ((self.sortInfo.descending and -1 or 1) * Aux.huge)
bVal = bVal or ((self.sortInfo.descending and -1 or 1) * Aux.huge)
end
if type(aVal) == "string" or type(bVal) == "string" then
aVal = aVal or ""
@@ -321,43 +333,43 @@ local methods = {
-- sort arbitrarily, but make sure the sort is stable
return tostring(a) < tostring(b)
end
if rt.sortInfo.descending then
if self.sortInfo.descending then
return aVal > bVal
else
return aVal < bVal
end
end
-- sort the row info
for i, info in ipairs(rt.rowInfo) do
for i, info in ipairs(self.rowInfo) do
sort(info.children, SortHelperFunc)
end
sort(rt.rowInfo, SortHelperFunc)
rt.sortInfo.isSorted = true
sort(self.rowInfo, SortHelperFunc)
self.sortInfo.isSorted = true
end
-- update all the rows
local rowIndex = 1 - FauxScrollFrame_GetOffset(rt.scrollFrame)
for i, info in ipairs(rt.rowInfo) do
if rt.expanded[info.expandKey] then
local rowIndex = 1 - FauxScrollFrame_GetOffset(self.scrollFrame)
for i, info in ipairs(self.rowInfo) do
if self.expanded[info.expandKey] then
-- show each of the rows for this base item since it's expanded
for j, childInfo in ipairs(info.children) do
rt:SetRowInfo(rowIndex, childInfo.record, childInfo.numAuctions, 0, j > 1, false, info.expandKey, childInfo.numAuctions)
self:SetRowInfo(rowIndex, childInfo.record, childInfo.numAuctions, 0, j > 1, false, info.expandKey, childInfo.numAuctions)
rowIndex = rowIndex + 1
end
else
-- just show one row for this base item since it's not expanded
rt:SetRowInfo(rowIndex, info.children[1].record, info.totalAuctions, getn(info.children) > 1 and info.totalPlayerAuctions or 0, false, getn(info.children) > 1, info.expandKey, info.children[1].numAuctions)
self:SetRowInfo(rowIndex, info.children[1].record, info.totalAuctions, getn(info.children) > 1 and info.totalPlayerAuctions or 0, false, getn(info.children) > 1, info.expandKey, info.children[1].numAuctions)
rowIndex = rowIndex + 1
end
end
end,
SetRowInfo = function(rt, rowIndex, record, displayNumAuctions, numPlayerAuctions, indented, expandable, expandKey, numAuctions)
if rowIndex <= 0 or rowIndex > getn(rt.rows) then return end
local row = rt.rows[rowIndex]
SetRowInfo = function(self, rowIndex, record, displayNumAuctions, numPlayerAuctions, indented, expandable, expandKey, numAuctions)
if rowIndex <= 0 or rowIndex > getn(self.rows) then return end
local row = self.rows[rowIndex]
-- show this row
row:Show()
if rt.selected and record.search_signature == rt.selected.search_signature then
if self.selected and record.search_signature == self.selected.search_signature then
row.highlight:Show()
else
row.highlight:Hide()
@@ -394,10 +406,10 @@ local methods = {
row.cells[4]:SetText(record.aux_quantity)
row.cells[5]:SetText(TIME_LEFT_STRINGS[record.duration or 0] or "---")
row.cells[6]:SetText(Aux.is_player(record.owner) and ("|cffffff00"..record.owner.."|r") or record.owner)
local bid, buyout, colorBid, colorBuyout = rt.GetRowPrices(record, aux_price_per_unit)
local bid, buyout, colorBid, colorBuyout = self.GetRowPrices(record, aux_price_per_unit)
row.cells[7]:SetText(bid > 0 and Aux.money.to_string(bid, true, false, colorBid) or "---")
row.cells[8]:SetText(buyout > 0 and Aux.money.to_string(buyout, true, false, colorBuyout) or "---")
local pct, bidPct = rt:GetRecordPercent(record)
local pct, bidPct = self:GetRecordPercent(record)
local pctColor = '|cffffffff'
if pct then
for i=1, getn(AUCTION_PCT_COLORS) do
@@ -417,25 +429,25 @@ local methods = {
end
end,
SetSelectedRecord = function(rt, record, silent)
if rt.disabled then return end
SetSelectedRecord = function(self, record, silent)
if self.disabled then return end
-- make sure the selected record still exists and get the data for the callback
rt.selected = record
local selectedData = rt:GetSelection()
rt.selected = selectedData and rt.selected or nil
self.selected = record
local selectedData = self:GetSelection()
self.selected = selectedData and self.selected or nil
-- show / hide highlight accordingly
for _, row in ipairs(rt.rows) do
if rt.selected and row.data and row.data.record.search_signature == rt.selected.search_signature then
for _, row in ipairs(self.rows) do
if self.selected and row.data and row.data.record.search_signature == self.selected.search_signature then
row.highlight:Show()
else
row.highlight:Hide()
end
end
if not silent and rt.handlers.OnSelectionChanged and not rt.scrollDisabled then
rt.handlers.OnSelectionChanged(rt, selectedData or nil)
if not silent and self.handlers.OnSelectionChanged and not self.scrollDisabled then
self.handlers.OnSelectionChanged(self, selectedData or nil)
end
end,
@@ -463,7 +475,7 @@ local methods = {
-- rt.dbView:SetFilter(filterFunc, filterHash) -- TODO
-- get index of selected row
local prevSelectedIndex = nil
local prevSelectedIndex
if rt.selected then
for index, row in ipairs(rt.rows) do
if row:IsVisible() and row.data and row.data.record == rt.selected then
@@ -494,7 +506,6 @@ local methods = {
end,
RemoveSelectedRecord = function(rt, count)
-- TSMAPI:Assert(rt.selected)
count = count or 1
for i=1, count do
local index = Aux.util.index_of(rt.selected, rt.records)
@@ -537,7 +548,6 @@ local methods = {
end,
SetHandler = function(rt, event, handler)
-- TSMAPI:Assert(event == "OnSelectionChanged")
rt.handlers[event] = handler
end,
@@ -718,7 +728,7 @@ function CreateAuctionResultsTable(parent)
local text = cell:CreateFontString()
text:SetFont(Aux.gui.config.content_font, min(14, rt.ROW_HEIGHT))
text:SetJustifyH(colInfo[j].align or 'LEFT')
text:SetJustifyV('MIDDLE')
text:SetJustifyV('CENTER')
text:SetPoint('TOPLEFT', 1, -1)
text:SetPoint('BOTTOMRIGHT', -1, 1)
cell:SetFontString(text)
+19 -95
View File
@@ -1,15 +1,13 @@
AuxVersion = '2.4.0'
AuxAuthors = 'shirsig; Zerf; Zirco (Auctionator); Nimeral (Auctionator backport)'
local lastRightClickAction = GetTime()
Aux = {
blizzard_ui_shown = false,
loaded = false,
orig = {},
}
function Aux_OnLoad()
function Aux.on_load()
Aux.log('Aux v'..AuxVersion..' loaded.')
Aux.loaded = true
tinsert(UISpecialFrames, 'AuxFrame')
@@ -88,22 +86,21 @@ function Aux_OnLoad()
-- AuxFrameContent:SetBackdropColor(unpack(Aux.gui.config.content_color))
-- AuxFrameContent:SetBackdropBorderColor(unpack(Aux.gui.config.content_border_color))
-- Aux.item_search_frame.on_load()
Aux.filter_search_frame.on_load()
Aux.search_frame.on_load()
Aux.post_frame.on_load()
Aux.auctions_frame.on_load()
Aux.bids_frame.on_load()
end
function Aux_OnEvent()
function Aux.on_event()
if event == 'VARIABLES_LOADED' then
Aux_OnLoad()
Aux.on_load()
elseif event == 'ADDON_LOADED' then
Aux_OnAddonLoaded()
Aux.on_addon_loaded()
elseif event == 'AUCTION_HOUSE_SHOW' then
Aux_OnAuctionHouseShow()
Aux.on_auction_house_show()
elseif event == 'AUCTION_HOUSE_CLOSED' then
Aux_OnAuctionHouseClosed()
Aux.on_auction_house_closed()
Aux.bids_loaded = false
Aux.current_owner_page = nil
elseif event == 'AUCTION_BIDDER_LIST_UPDATE' then
@@ -113,12 +110,9 @@ function Aux_OnEvent()
end
end
function Aux_OnAddonLoaded()
if string.lower(arg1) == "blizzard_auctionui" then
Aux_SetupHookFunctions()
end
if string.lower(arg1) == "EnhTooltip" then
function Aux.on_addon_loaded()
if string.lower(arg1) == 'blizzard_auctionui' then
Aux.setup_hooks()
end
end
@@ -146,53 +140,11 @@ do
end
end
function Aux.log_frame_load()
this:SetFading(false)
this:EnableMouseWheel()
-- this.flashTimer = 0 TODO remove
end
function Aux.log_frame_update(elapsedSec)
if not this:IsVisible() then
return
end
local flash = getglobal(this:GetName()..'BottomButtonFlash')
if not flash then
return
end
if this:AtBottom() then
if flash:IsVisible() then
flash:Hide()
end
return
end
local flashTimer = this.flashTimer + elapsedSec
if flashTimer < CHAT_BUTTON_FLASH_TIME then
this.flashTimer = flashTimer
return
end
while flashTimer >= CHAT_BUTTON_FLASH_TIME do
flashTimer = flashTimer - CHAT_BUTTON_FLASH_TIME
end
this.flashTimer = flashTimer
if flash:IsVisible() then
flash:Hide()
else
flash:Show()
end
end
function Aux.log(msg)
DEFAULT_CHAT_FRAME:AddMessage(msg, 1, 1, 0)
end
function Aux_SetupHookFunctions()
function Aux.setup_hooks()
local blizzard_ui_on_hide = function()
Aux.blizzard_ui_shown = false
@@ -216,7 +168,7 @@ function Aux_SetupHookFunctions()
PickupContainerItem = Aux.PickupContainerItem
Aux.orig.ContainerFrameItemButton_OnClick = ContainerFrameItemButton_OnClick
ContainerFrameItemButton_OnClick = Aux_ContainerFrameItemButton_OnClick
ContainerFrameItemButton_OnClick = Aux.ContainerFrameItemButton_OnClick
Aux.orig.AuctionFrameAuctions_OnEvent = AuctionFrameAuctions_OnEvent
AuctionFrameAuctions_OnEvent = Aux.AuctionFrameAuctions_OnEvent
@@ -237,23 +189,21 @@ function Aux.AuctionFrameAuctions_OnEvent()
end
end
function Aux_OnAuctionHouseShow()
function Aux.on_auction_house_show()
AuxFrame:Show()
Aux.tab_group:set_tab(1)
end
function Aux_OnAuctionHouseClosed()
function Aux.on_auction_house_closed()
Aux.post.stop()
Aux.stack.stop()
Aux.scan.abort()
-- Aux.item_search_frame.on_close()
Aux.filter_search_frame.on_close()
Aux.search_frame.on_close()
Aux.post_frame.on_close()
Aux.auctions_frame.on_close()
Aux.bids_frame.on_close()
Aux.history_frame.on_close()
AuxFrame:Hide()
end
@@ -261,23 +211,19 @@ function Aux.on_tab_click(index)
Aux.post.stop()
Aux.stack.stop()
Aux.scan.abort(function()
-- Aux.item_search_frame.on_close()
Aux.filter_search_frame.on_close()
Aux.search_frame.on_close()
Aux.post_frame.on_close()
Aux.auctions_frame.on_close()
Aux.bids_frame.on_close()
Aux.history_frame.on_close()
-- AuxItemSearchFrame:Hide()
AuxFilterSearchFrame:Hide()
AuxPostFrame:Hide()
AuxAuctionsFrame:Hide()
AuxBidsFrame:Hide()
AuxHistoryFrame:Hide()
if index == 1 then
AuxFilterSearchFrame:Show()
Aux.filter_search_frame.on_open()
Aux.search_frame.on_open()
elseif index == 2 then
AuxPostFrame:Show()
Aux.post_frame.on_open()
@@ -287,9 +233,6 @@ function Aux.on_tab_click(index)
elseif index == 4 then
AuxBidsFrame:Show()
Aux.bids_frame.on_open()
-- elseif index == 5 then
-- AuxItemSearchFrame:Show()
-- Aux.item_search_frame.on_open()
end
Aux.active_panel = index
@@ -314,25 +257,6 @@ function Aux.price_level_color(pct)
end
end
function Aux_AuctionsButton_OnClick(button)
if arg1 == "LeftButton" then -- because we additionally registered right clicks we only let left ones pass here
Aux.orig.BrowseButton_OnClick(button)
end
end
function Aux_AuctionsButton_OnMouseDown()
if arg1 == "RightButton" and GetTime() - lastRightClickAction > 0.5 then
local index = this:GetID() + FauxScrollFrame_GetOffset(AuctionsScrollFrame)
SetSelectedAuctionItem("owner", index)
CancelAuction(index)
AuctionFrameAuctions_Update()
lastRightClickAction = GetTime()
end
end
do
local last_picked_up
function Aux.PickupContainerItem(bag, slot)
@@ -346,7 +270,7 @@ do
end
end
function Aux_ContainerFrameItemButton_OnClick(button)
function Aux.ContainerFrameItemButton_OnClick(button)
local bag, slot = this:GetParent():GetID(), this:GetID()
local item_info = Aux.info.container_item(bag, slot)
+1 -1
View File
@@ -13,7 +13,7 @@
this:RegisterEvent('AUCTION_OWNED_LIST_UPDATE')
</OnLoad>
<OnEvent>
Aux_OnEvent()
Aux.on_event()
</OnEvent>
</Scripts>
</Frame>
+1 -1
View File
@@ -1,6 +1,6 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="item_search_frame.lua"/>
<Script file="search_frame.lua"/>
<Frame>
<Scripts>
+4 -5
View File
@@ -206,7 +206,6 @@ local methods = {
st.sizes.headHeight = 0
end
st.sizes.numRows = max(floor((st:GetParent():GetHeight() - st.sizes.headHeight - ST_HEAD_SPACE) / ST_ROW_HEIGHT), 0)
snipe.log(st.sizes.numRows)
-- update the frame
st.scrollBar:ClearAllPoints()
@@ -347,11 +346,11 @@ local methods = {
row:SetHeight(ST_ROW_HEIGHT)
local rowNum = getn(st.rows) + 1
if rowNum == 1 then
row:SetPoint('TOPLEFT', 0, -(st.sizes.headHeight+ST_HEAD_SPACE))
row:SetPoint('TOPRIGHT', 0, -(st.sizes.headHeight+ST_HEAD_SPACE))
row:SetPoint('TOPLEFT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE))
row:SetPoint('TOPRIGHT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE))
else
row:SetPoint('TOPLEFT', st.rows[rowNum-1], 'BOTTOMLEFT')
row:SetPoint('TOPRIGHT', st.rows[rowNum-1], 'BOTTOMRIGHT')
row:SetPoint('TOPLEFT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE + (rowNum - 1) * ST_ROW_HEIGHT))
row:SetPoint('TOPRIGHT', 0, -(st.sizes.headHeight + ST_HEAD_SPACE + (rowNum - 1) * ST_ROW_HEIGHT))
end
local highlight = row:CreateTexture()
highlight:SetAllPoints()
+4 -4
View File
@@ -344,7 +344,7 @@ function public.on_open()
AuxSellAuctions:SetWidth(AuxSellAuctionsListing:GetWidth() + 40)
-- UIDropDownMenu_SetSelectedValue(AuxSellParametersStrategyDropDown, LIVE)
private.set_auction_duration(AUX_AUCTION_DURATION)
private.set_auction_duration(aux_auction_duration)
-- so that it's initialized with zeroes, not sometimes zero, sometimes empty
private.start_price:SetText(Aux.money.to_string(0))
@@ -370,15 +370,15 @@ function public.duration_radio_button_on_click(index)
if index == 1 then
AuxSellParametersShortDurationRadio:SetChecked(true)
AuctionFrameAuctions.duration = 120
AUX_AUCTION_DURATION = 'short'
aux_auction_duration = 'short'
elseif index == 2 then
AuxSellParametersMediumDurationRadio:SetChecked(true)
AuctionFrameAuctions.duration = 480
AUX_AUCTION_DURATION = 'medium'
aux_auction_duration = 'medium'
else
AuxSellParametersLongDurationRadio:SetChecked(true)
AuctionFrameAuctions.duration = 1440
AUX_AUCTION_DURATION = 'long'
aux_auction_duration = 'long'
end
private.update_recommendation()
end
+1 -1
View File
@@ -232,7 +232,7 @@ function m.validator(filter)
if filter.discard then
return
end
if filter.exact and strupper(record.name) ~= strupper(filter.name) then
if filter.exact and strupper(Aux.static.item_info(record.item_id).name) ~= strupper(filter.name) then
return
end
if filter.min_level and record.level < filter.min_level then
+180 -195
View File
@@ -1,11 +1,34 @@
local private, public = {}, {}
Aux.filter_search_frame = public
Aux.search_frame = public
aux_favorite_searches = {}
aux_recent_searches = {}
local tooltip_patterns = {}
local selected_auction
private.popup_info = {
rename = {}
}
StaticPopupDialogs['AUX_SEARCH_SAVED_RENAME'] = {
text = 'Enter a new name for this search.',
button1 = 'Accept',
button2 = 'Cancel',
hasEditBox = 1,
OnShow = function()
local rename_info = private.popup_info.rename
local edit_box = getglobal(this:GetName()..'EditBox')
edit_box:SetText(rename_info.name or '')
edit_box:HighlightText()
edit_box:SetFocus()
edit_box:SetScript('OnEscapePressed', function() StaticPopup_Hide('AUX_SEARCH_SAVED_RENAME') end)
edit_box:SetScript('OnEnterPressed', function() this.button1:Click() end)
end,
OnAccept = function()
private.popup_info.rename.name = getglobal(this:GetParent():GetName()..'EditBox'):GetText()
private.update_search_listings()
end,
timeout = 0,
hideOnEscape = 1,
}
local RESULTS, SAVED, FILTER = {}, {}, {}
@@ -18,7 +41,7 @@ private.elements = {
function private.update_search_listings()
local favorite_search_rows = {}
for i, favorite_search in ipairs(aux_favorite_searches) do
local name = Aux.test.prettify_search(favorite_search)
local name = favorite_search.name or Aux.test.prettify_search(favorite_search.filter_string)
tinsert(favorite_search_rows, {
cols = {{value=name}},
search = favorite_search,
@@ -30,7 +53,7 @@ function private.update_search_listings()
local recent_search_rows = {}
for i, recent_search in ipairs(aux_recent_searches) do
local name = Aux.test.prettify_search(recent_search)
local name = recent_search.name or Aux.test.prettify_search(recent_search.filter_string)
tinsert(recent_search_rows, {
cols = {{value=name}},
search = recent_search,
@@ -93,24 +116,11 @@ function private.get_form_filter()
}
end
function private.select_auction(entry)
selected_auction = entry
RESULTS.buyout_button:Disable()
private.bid_button:Disable()
end
function private.clear_selection(entry)
selected_auction = nil
RESULTS.buyout_button:Disable()
private.bid_button:Disable()
function public.on_open()
private.update_search_listings()
end
function public.on_close()
private.clear_selection()
end
function public.on_open()
private.update_search_listings()
end
function public.on_load()
@@ -125,7 +135,7 @@ function public.on_load()
btn:SetWidth(60)
btn:SetHeight(25)
btn:SetText('Search')
btn:SetScript('OnClick', Aux.filter_search_frame.start_search)
btn:SetScript('OnClick', Aux.search_frame.start_search)
private.search_button = btn
end
do
@@ -134,7 +144,7 @@ function public.on_load()
btn:SetWidth(60)
btn:SetHeight(25)
btn:SetText('Stop')
btn:SetScript('OnClick', Aux.filter_search_frame.stop_search)
btn:SetScript('OnClick', Aux.search_frame.stop_search)
btn:Hide()
private.stop_button = btn
end
@@ -392,14 +402,14 @@ function public.on_load()
-- Tooltip 1
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox1')
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip1InputBox1')
editbox:SetPoint('TOPLEFT', 300, -20)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip1InputBox2'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -414,14 +424,14 @@ function public.on_load()
label:SetText('Tooltip')
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox2')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox1 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip1InputBox2')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip1InputBox1 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox1'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip1InputBox1'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip1InputBox3'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -433,14 +443,14 @@ function public.on_load()
end)
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox3')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox2 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip1InputBox3')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip1InputBox2 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip1InputBox2'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox4'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip1InputBox4'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -452,12 +462,12 @@ function public.on_load()
end)
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox4')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox3 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip1InputBox4')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip1InputBox3 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip1InputBox3'):SetFocus()
else
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
end
@@ -473,14 +483,14 @@ function public.on_load()
-- Tooltip 2
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox1')
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip2InputBox1')
editbox:SetPoint('TOPLEFT', 300, -200)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip2InputBox2'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -495,14 +505,14 @@ function public.on_load()
label:SetText('Tooltip')
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox2')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox1 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip2InputBox2')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip2InputBox1 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox1'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip2InputBox1'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip2InputBox3'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -514,14 +524,14 @@ function public.on_load()
end)
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox3')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox2 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip2InputBox3')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip2InputBox2 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip2InputBox2'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox4'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip2InputBox4'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -533,12 +543,12 @@ function public.on_load()
end)
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox4')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox3 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip2InputBox4')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip2InputBox3 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip2InputBox3'):SetFocus()
else
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
end
@@ -554,14 +564,14 @@ function public.on_load()
-- Tooltip 3
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox1')
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip3InputBox1')
editbox:SetPoint('TOPLEFT', 600, -20)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip3InputBox2'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -576,14 +586,14 @@ function public.on_load()
label:SetText('Tooltip')
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox2')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox1 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip3InputBox2')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip3InputBox1 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox1'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip3InputBox1'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip3InputBox3'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -595,14 +605,14 @@ function public.on_load()
end)
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox3')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox2 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip3InputBox3')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip3InputBox2 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip3InputBox2'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox4'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip3InputBox4'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -614,12 +624,12 @@ function public.on_load()
end)
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox4')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox3 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip3InputBox4')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip3InputBox3 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip3InputBox3'):SetFocus()
else
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
end
@@ -635,14 +645,14 @@ function public.on_load()
-- Tooltip 4
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox1')
editbox:SetPoint('TOPLEFT', 300, -300)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip4InputBox1')
editbox:SetPoint('TOPLEFT', 600, -200)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'MaxLevel'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip4InputBox2'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -657,14 +667,14 @@ function public.on_load()
label:SetText('Tooltip')
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox2')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox1 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip4InputBox2')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip4InputBox1 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox1'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip4InputBox1'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip4InputBox3'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -676,14 +686,14 @@ function public.on_load()
end)
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox3')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox2 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip4InputBox3')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip4InputBox2 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox2'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip4InputBox2'):SetFocus()
else
getglobal(this:GetParent():GetName()..'TooltipInputBox4'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip4InputBox4'):SetFocus()
end
end)
editbox:SetScript('OnEnterPressed', function()
@@ -695,12 +705,12 @@ function public.on_load()
end)
end
do
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltipInputBox4')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltipInputBox3 , 'BOTTOMLEFT', 0, -3)
local editbox = Aux.gui.editbox(private.elements[FILTER].filters, '$parentTooltip4InputBox4')
editbox:SetPoint('TOPLEFT', AuxFilterSearchFrameFilterTooltip4InputBox3 , 'BOTTOMLEFT', 0, -3)
editbox:SetWidth(250)
editbox:SetScript('OnTabPressed', function()
if IsShiftKeyDown() then
getglobal(this:GetParent():GetName()..'TooltipInputBox3'):SetFocus()
getglobal(this:GetParent():GetName()..'Tooltip4InputBox3'):SetFocus()
else
getglobal(this:GetParent():GetName()..'NameInputBox'):SetFocus()
end
@@ -714,32 +724,41 @@ function public.on_load()
end)
end
private.testlisting = CreateAuctionResultsTable(AuxFilterSearchFrameResults)
private.testlisting:Show()
private.testlisting:SetSort(9)
private.testlisting:Clear()
private.testlisting:SetHandler('OnSelectionChanged', private.on_selection_changed)
private.results_listing = CreateAuctionResultsTable(AuxFilterSearchFrameResults)
private.results_listing:Show()
private.results_listing:SetSort(9)
private.results_listing:Clear()
private.results_listing:SetHandler('OnCellAltClick', function(cell, button)
private.find_auction(cell.row.data.record, true, button == 'LeftButton')
end)
private.results_listing:SetHandler('OnSelectionChanged', function(rt, datum)
if not datum then return end
private.find_auction(datum.record)
end)
local handlers = {
OnClick = function(st, data, _, button)
if not data then return end
if button == 'LeftButton' then
if IsShiftKeyDown() then
-- private.popupInfo.export = data.search
private.search_box:SetText(data.search.filter_string)
-- private.popupInfo.export = data.search
-- TSMAPI.Util:ShowStaticPopupDialog('TSM_SHOPPING_SAVED_EXPORT_POPUP')
elseif IsControlKeyDown() then
-- private.popupInfo.renameInfo = data.searchInfo
-- TSMAPI.Util:ShowStaticPopupDialog('TSM_SHOPPING_SAVED_RENAME_POPUP')
else
private.search_box:SetText(data.search)
private.search_box:SetText(data.search.filter_string)
public.start_search()
end
elseif button == 'RightButton' then
if st == private.recent_searches_listing then
if IsShiftKeyDown() then
private.popup_info.rename = data.search
StaticPopup_Show('AUX_SEARCH_SAVED_RENAME')
elseif st == private.recent_searches_listing then
if IsShiftKeyDown() then
tremove(TSM.db.global.savedSearches, data.index)
-- tremove(TSM.db.global.savedSearches, data.index)
-- TSM:Printf('Removed '%s' from your recent searches.', data.searchInfo.name)
private.UpdateSTData()
-- private.UpdateSTData()
else
tinsert(aux_favorite_searches, data.search)
-- data.searchInfo.isFavorite = true
@@ -757,7 +776,7 @@ function public.on_load()
OnEnter = function(st, data, self)
if not data then return end
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:AddLine(gsub(data.name, ';', '\n'), 255/255, 254/255, 250/255)
GameTooltip:AddLine(gsub(Aux.test.prettify_search(data.search.filter_string), ';', '\n'), 255/255, 254/255, 250/255)
GameTooltip:Show()
-- GameTooltip:SetOwner(self, 'ANCHOR_RIGHT')
-- GameTooltip:AddLine(data.search, 1, 1, 1, true)
@@ -787,6 +806,7 @@ function public.on_load()
private.recent_searches_listing:SetColInfo({{name='Recent Searches', width=1}})
private.recent_searches_listing:SetHandler('OnClick', handlers.OnClick)
private.recent_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
private.recent_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
Aux.gui.vertical_line(AuxFilterSearchFrameSaved, 379)
@@ -794,6 +814,7 @@ function public.on_load()
private.favorite_searches_listing:SetColInfo({{name='Favorite Searches', width=1}})
private.favorite_searches_listing:SetHandler('OnClick', handlers.OnClick)
private.favorite_searches_listing:SetHandler('OnEnter', handlers.OnEnter)
private.favorite_searches_listing:SetHandler('OnLeave', handlers.OnLeave)
private.update_tab(SAVED)
@@ -831,13 +852,12 @@ function public.start_search()
return
end
tinsert(aux_recent_searches, 1, private.search_box:GetText())
tinsert(aux_recent_searches, 1, { filter_string = private.search_box:GetText() })
while getn(aux_recent_searches) > 50 do
tremove(aux_recent_searches)
end
private.update_search_listings()
private.clear_selection()
private.search_button:Hide()
private.stop_button:Show()
@@ -847,7 +867,7 @@ function public.start_search()
private.status_bar:set_text('Scanning auctions...')
local scanned_records = {}
private.testlisting:SetDatabase(scanned_records)
private.results_listing:SetDatabase(scanned_records)
Aux.scan.start{
queries = queries,
@@ -856,7 +876,7 @@ function public.start_search()
private.status_bar:set_text(format('Scanning (Page %d / %d)', page + 1, total_pages))
end,
on_page_complete = function()
private.testlisting:SetDatabase()
private.results_listing:SetDatabase()
end,
on_start_query = function(query_index)
private.status_bar:update_status(0, 100 * (query_index - 1) / getn(queries)) -- TODO
@@ -867,7 +887,7 @@ function public.start_search()
tinsert(scanned_records, auction_info)
end,
on_complete = function()
private.testlisting:SetDatabase()
private.results_listing:SetDatabase()
private.status_bar:update_status(100, 100)
private.status_bar:set_text('Done Scanning')
@@ -875,7 +895,7 @@ function public.start_search()
private.search_button:Show()
end,
on_abort = function()
private.testlisting:SetDatabase()
private.results_listing:SetDatabase()
private.status_bar:update_status(100, 100)
private.status_bar:set_text('Done Scanning')
private.stop_button:Hide()
@@ -885,84 +905,80 @@ function public.start_search()
end)
end
function private.process_request(entry, express_mode, buyout_mode)
do
local found_index
if entry.gone or (buyout_mode and not entry.buyout_price) or (express_mode and not buyout_mode and entry.high_bidder) or entry.owner == UnitName('player') then
return
end
function private.find_auction(entry, express_mode, buyout_mode)
PlaySound('igMainMenuOptionCheckBoxOn')
local function test(index)
local auction_record = Aux.info.auction(index)
return auction_record.signature == entry.signature and auction_record.bid_price == entry.bid_price and auction_record.duration == entry.duration and auction_record.owner ~= UnitName('player')
end
local function remove_entry()
entry.gone = true
private.clear_selection()
end
if express_mode then
Aux.scan_util.find(test, entry.query, entry.page, private.status_bar, remove_entry, function(index)
if not entry.gone then
Aux.place_bid('list', index, buyout_mode and entry.buyout_price or entry.bid_price, remove_entry)
end
end)
else
private.select_auction(entry)
Aux.scan_util.find(test, entry.query, entry.page, private.status_bar, remove_entry, function(index)
if not entry.high_bidder then
private.bid_button:SetScript('OnClick', function()
if test(index) and not entry.gone then
Aux.place_bid('list', index, entry.bid_price, remove_entry)
end
private.clear_selection()
end)
private.bid_button:Enable()
end
if entry.buyout_price then
RESULTS.buyout_button:SetScript('OnClick', function()
if test(index) and not entry.gone then
Aux.place_bid('list', index, entry.buyout_price, remove_entry)
end
private.clear_selection()
end)
RESULTS.buyout_button:Enable()
end
end)
end
end
function private.on_selection_changed(rt, datum)
if not datum then
return
end
local entry = datum.record
if IsControlKeyDown() then
DressUpItemLink(entry.hyperlink)
elseif IsShiftKeyDown() then
if ChatFrameEditBox:IsVisible() then
ChatFrameEditBox:Insert(entry.hyperlink)
if entry.gone or (buyout_mode and not entry.buyout_price) or (express_mode and not buyout_mode and entry.high_bidder) or entry.owner == UnitName('player') then
return
end
local function test(index)
return Aux.info.auction(index).search_signature == entry.search_signature
end
local function remove_entry()
private.results_listing:RemoveSelectedRecord()
entry.gone = true
end
if express_mode then
Aux.scan_util.find(test, entry.query, entry.page, private.status_bar, remove_entry, function(index)
if not entry.gone then
Aux.place_bid('list', index, buyout_mode and entry.buyout_price or entry.bid_price, remove_entry)
end
end)
else
found_index = nil
Aux.scan_util.find(test, entry.query, entry.page, private.status_bar, remove_entry, function(index)
found_index = index
if not entry.high_bidder then
private.bid_button:SetScript('OnClick', function()
if test(index) and not entry.gone then
Aux.place_bid('list', index, entry.bid_price, remove_entry)
end
end)
private.bid_button:Enable()
end
if entry.buyout_price > 0 then
RESULTS.buyout_button:SetScript('OnClick', function()
if test(index) and not entry.gone then
Aux.place_bid('list', index, entry.buyout_price, remove_entry)
end
end)
RESULTS.buyout_button:Enable()
end
end)
end
end
function public.on_update()
-- if not (RESULTS.buyout_button:IsEnabled() or private.bid_button:IsEnabled()) then
-- return
-- end
local selection = private.results_listing:GetSelection()
if not selection then
RESULTS.buyout_button:Disable()
private.bid_button:Disable()
return
end
if found_index and selection.record.search_signature ~= Aux.info.auction(found_index).search_signature then
RESULTS.buyout_button:Disable()
private.bid_button:Disable()
private.find_auction(selection.record)
end
else
local express_mode = IsAltKeyDown()
local buyout_mode = express_mode and arg1 == 'LeftButton'
private.process_request(entry, express_mode, buyout_mode)
end
end
--function private.create_auction_record(auction_info)
--
-- local buyout_price = auction_info.buyout_price > 0 and auction_info.buyout_price or nil
-- local unit_buyout_price = buyout_price and auction_info.buyout_price / auction_info.aux_quantity
-- local status
-- if auction_info.current_bid == 0 then
-- status = 'No Bid'
-- elseif auction_info.high_bidder then
@@ -971,37 +987,6 @@ end
-- status = 'Other Bidder'
-- end
--
-- return {
-- query = auction_info.query,
-- page = auction_info.page,
--
-- item_id = auction_info.item_id,
-- suffix_id = auction_info.suffix_id,
-- unique_id = auction_info.unique_id,
-- enchant_id = auction_info.enchant_id,
--
-- item_key = auction_info.item_key,
-- signature = auction_info.signature,
--
-- name = auction_info.name,
-- level = auction_info.level,
-- tooltip = auction_info.tooltip,
-- aux_quantity = auction_info.aux_quantity,
-- buyout_price = buyout_price,
-- unit_buyout_price = unit_buyout_price,
-- quality = auction_info.quality,
-- hyperlink = auction_info.hyperlink,
-- itemstring = auction_info.itemstring,
-- bid_price = auction_info.bid_price,
-- unit_bid_price = auction_info.bid_price / auction_info.aux_quantity,
-- owner = auction_info.owner,
-- duration = auction_info.duration,
-- usable = auction_info.usable,
-- high_bidder = auction_info.high_bidder,
-- status = status,
--
-- EnhTooltip_info = auction_info.EnhTooltip_info,
-- }
--end
function private.initialize_class_dropdown()
+12 -5
View File
@@ -1,6 +1,14 @@
<Ui xsi:schemaLocation="http://www.blizzard.com/wow/ui/">
<Script file="filter_search_frame.lua"/>
<Script file="search_frame.lua"/>
<Frame name="AuxControlFrame">
<Scripts>
<OnUpdate>
Aux.search_frame.on_update()
</OnUpdate>
</Scripts>
</Frame>
<Frame name="AuxFilterSearchFrame" hidden="true" parent="AuxFrame" setAllPoints="true">
<Frames>
@@ -28,27 +36,26 @@
<Frame name="$parentListing" hidden="true">
<Anchors>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="-8" y="5"/></Offset></Anchor>
<Anchor point="BOTTOM"><Offset><AbsDimension x="-8" y="-15"/></Offset></Anchor>
<!--<Anchor point="BOTTOM"><Offset><AbsDimension x="-8" y="-15"/></Offset></Anchor>-->
</Anchors>
</Frame>
</Frames>
</Frame>
<Frame name="$parentSaved" inherits="AuxFrameBoxTemplate">
<Size><AbsDimension x="985" y="278"/></Size>
<Anchors>
<Anchor point="TOPLEFT" relativeTo="AuxFrameContent"></Anchor>
<Anchor point="BOTTOMRIGHT" relativeTo="AuxFrameContent"></Anchor>
</Anchors>
<Frames>
<Frame name="$parentFavorite" inherits="AuxFrameBoxTemplate">
<Size><AbsDimension x="373" y="270"/></Size>
<Size><AbsDimension x="373"/></Size>
<Anchors>
<Anchor point="TOPLEFT"><Offset><AbsDimension x="4" y="-4"/></Offset></Anchor>
<Anchor point="BOTTOMLEFT"><Offset><AbsDimension x="4" y="4"/></Offset></Anchor>
</Anchors>
</Frame>
<Frame name="$parentRecent" inherits="AuxFrameBoxTemplate">
<Size><AbsDimension x="373" y="270"/></Size>
<Size><AbsDimension x="373"/></Size>
<Anchors>
<Anchor point="TOPRIGHT"><Offset><AbsDimension x="-4" y="-4"/></Offset></Anchor>
<Anchor point="BOTTOMRIGHT"><Offset><AbsDimension x="-4" y="4"/></Offset></Anchor>
+1 -3
View File
@@ -1,8 +1,6 @@
SLASH_AUX1 = '/aux'
function SlashCmdList.AUX(parameter)
if parameter == 'scan' then
Aux.history_frame.start_scan()
elseif parameter == 'clear snapshot' then
if parameter == 'clear snapshot' then
Aux.persistence.load_dataset().snapshot = {}
Aux.log('Snapshot cleared.')
elseif parameter == 'clear history' then
+26 -46
View File
@@ -22,7 +22,7 @@ function m:complete()
local filter_string = this:GetText()
local completed_filter_string = ({strfind(filter_string, '([^;]*)/[^/]*$')})[3]
local completed_filter_string = ({strfind(filter_string, '([^;]*)/[^/;]*$')})[3]
local current_filter = completed_filter_string and Aux.scan_util.filter_from_string(completed_filter_string)
local options = {}
@@ -39,6 +39,7 @@ function m:complete()
and not current_filter.slot
and not current_filter.quality
and not current_filter.usable
and not current_filter.exact
then
tinsert(options, 'exact')
end
@@ -83,14 +84,14 @@ function m:complete()
-- item names
if not completed_filter_string then
local item_names = {}
local item_filters = {}
for key, value in Aux.static.auctionable_items do
if type(key) == 'number' then
tinsert(item_names, value.name)
tinsert(item_filters, value.name..'/exact')
end
end
sort(item_names)
for _, item_name in ipairs(item_names) do
sort(item_filters)
for _, item_name in ipairs(item_filters) do
tinsert(options, item_name)
end
end
@@ -99,7 +100,7 @@ function m:complete()
current_modifier = current_modifier or ''
for _, option in ipairs(options) do
if strfind(strupper(option), '^'..strupper(current_modifier)) then
if string.sub(strupper(option), 1, strlen(current_modifier)) == strupper(current_modifier) then
this:SetText(string.sub(filter_string, 1, start_index - 1)..option)
this:HighlightText(strlen(filter_string), -1)
return
@@ -108,27 +109,27 @@ function m:complete()
end
end
--StaticPopupDialogs["TSM_SHOPPING_SAVED_RENAME_POPUP"] = {
-- text = L["Type in the new name for this saved search and hit the 'Save' button."],
-- button1 = SAVE,
-- OnShow = function(self)
-- local renameInfo = private.popupInfo.renameInfo
-- self.editBox:SetText(renameInfo.name)
-- self.editBox:HighlightText()
-- self.editBox:SetFocus()
-- self.editBox:SetWidth(self.editBox:GetWidth() * 2)
-- self.editBox:SetScript("OnEscapePressed", function() StaticPopup_Hide("TSM_SHOPPING_SAVED_RENAME_POPUP") end)
-- self.editBox:SetScript("OnEnterPressed", function() self.button1:Click() end)
--StaticPopupDialogs["CANCEL_AUCTION"] = {
-- text = TEXT(CANCEL_AUCTION_CONFIRMATION),
-- button1 = TEXT(ACCEPT),
-- button2 = TEXT(CANCEL),
-- OnAccept = function()
-- CancelAuction(GetSelectedAuctionItem("owner"));
-- end,
-- OnAccept = function(self)
-- private.popupInfo.renameInfo.name = self.editBox:GetText()
-- private.UpdateSTData()
-- OnShow = function()
-- MoneyFrame_Update(this:GetName().."MoneyFrame", AuctionFrameAuctions.cancelPrice);
-- if ( AuctionFrameAuctions.cancelPrice > 0 ) then
-- getglobal(this:GetName().."Text"):SetText(CANCEL_AUCTION_CONFIRMATION_MONEY);
-- else
-- getglobal(this:GetName().."Text"):SetText(CANCEL_AUCTION_CONFIRMATION);
-- end
--
-- end,
-- hasEditBox = true,
-- hasMoneyFrame = 1,
-- showAlert = 1,
-- timeout = 0,
-- hideOnEscape = true,
-- preferredIndex = 3,
--}
--};
--StaticPopupDialogs["TSM_SHOPPING_SAVED_EXPORT_POPUP"] = {
-- text = L["Press Ctrl-C to copy this saved search."],
-- button1 = OKAY,
@@ -179,25 +180,4 @@ end
-- timeout = 0,
-- hideOnEscape = true,
-- preferredIndex = 3,
--}
--StaticPopupDialogs["CANCEL_AUCTION"] = {
-- text = TEXT(CANCEL_AUCTION_CONFIRMATION),
-- button1 = TEXT(ACCEPT),
-- button2 = TEXT(CANCEL),
-- OnAccept = function()
-- CancelAuction(GetSelectedAuctionItem("owner"));
-- end,
-- OnShow = function()
-- MoneyFrame_Update(this:GetName().."MoneyFrame", AuctionFrameAuctions.cancelPrice);
-- if ( AuctionFrameAuctions.cancelPrice > 0 ) then
-- getglobal(this:GetName().."Text"):SetText(CANCEL_AUCTION_CONFIRMATION_MONEY);
-- else
-- getglobal(this:GetName().."Text"):SetText(CANCEL_AUCTION_CONFIRMATION);
-- end
--
-- end,
-- hasMoneyFrame = 1,
-- showAlert = 1,
-- timeout = 0,
--};
--}