post price listing bugfix and click changes

This commit is contained in:
Manuel Simon Hirsig
2016-12-11 10:12:35 +01:00
parent 20c6b7b37e
commit e1b87d71cb
8 changed files with 103 additions and 100 deletions
+3 -2
View File
@@ -95,8 +95,9 @@ The filters on the left side are Blizzard filters which may reduce the number of
- Price values can contain decimals. (e.g., 1.5g = 1g50s)
- Right-clicking an item in the inventory listing will start a search.
- Right-clicking a bag item will select it in the listing.
- In the listing of existing auctions a red price is undercutting both the unit and the stack price you have selected, an orange one only the unit and a yellow one only the stack price.
- Clicking an entry in the in the listings of bids/buyouts of existing auctions will undercut with your bid/buyout. Left click will undercut the unit and right-click the stack price.
- In the listing of bids/buyouts a red price is undercutting both the unit and the stack price you have selected, an orange one only the unit and a yellow one only the stack price.
- Clicking an entry in the in the listings of bids/buyouts of existing auctions will undercut with your bid/buyout. Left-click will undercut the unit and right-click the stack price.
- Double-click in the bids/buyouts listings will also match the stack size.
### Auctions
![Alt text](http://i.imgur.com/6HjaIo2.png)
-2
View File
@@ -11,8 +11,6 @@ local post = require 'aux.core.post'
local scan = require 'aux.core.scan'
_G.aux_characters = T
--aux_account_settings = {} -- TODO clean up the mess of savedvariables
--aux_character_settings = {}
function M.set_p(v)
inspect(nil, v)
+36 -42
View File
@@ -586,70 +586,65 @@ local methods = {
if rowData and rowData.record then
info.set_tooltip(rowData.record.itemstring, this, 'ANCHOR_RIGHT')
info.set_shopping_tooltip(rowData.record.slot)
rt.isShowingItemTooltip = true
end
end,
OnIconLeave = function()
GameTooltip:Hide()
this:GetParent().row.rt.isShowingItemTooltip = nil
end,
OnCellEnter = function()
OnEnter = function()
local rt = this.rt
local row = this.row
if this ~= row.cells[1] or not rt.isShowingItemTooltip then
if rt.expanded[row.data.expandKey] then
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:AddLine('Double-click to collapse this item and show only the cheapest auction.', 1, 1, 1, true)
GameTooltip:Show()
elseif row.data.expandable then
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:AddLine('Double-click to expand this item and show all the auctions.', 1, 1, 1, true)
GameTooltip:Show()
end
if rt.expanded[this.data.expandKey] then
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:AddLine('Double-click to collapse this item and show only the cheapest auction.', 1, 1, 1, true)
GameTooltip:Show()
elseif this.data.expandable then
GameTooltip_SetDefaultAnchor(GameTooltip, UIParent)
GameTooltip:AddLine('Double-click to expand this item and show all the auctions.', 1, 1, 1, true)
GameTooltip:Show()
end
this.row.highlight:Show()
this.highlight:Show()
end,
OnCellLeave = function()
OnLeave = function()
GameTooltip:Hide()
if not this.rt.selected or this.rt.selected.search_signature ~= this.row.data.record.search_signature then
this.row.highlight:Hide()
if not this.rt.selected or this.rt.selected.search_signature ~= this.data.record.search_signature then
this.highlight:Hide()
end
end,
OnCellClick = function()
OnClick = function()
local button = arg1
if IsControlKeyDown() then
DressUpItemLink(this.row.data.record.link)
DressUpItemLink(this.data.record.link)
elseif IsShiftKeyDown() and ChatFrameEditBox:IsVisible() then
ChatFrameEditBox:Insert(this.row.data.record.link)
ChatFrameEditBox:Insert(this.data.record.link)
elseif not modified and button == 'RightButton' then -- TODO not when alt (how?)
tab = 1
search_tab.set_filter(strlower(info.item(this.row.data.record.item_id).name) .. '/exact')
search_tab.set_filter(strlower(info.item(this.data.record.item_id).name) .. '/exact')
search_tab.execute(nil, false)
else
local selection = this.rt:GetSelection()
if not selection or selection.record ~= this.row.data.record then
this.rt:SetSelectedRecord(this.row.data.record)
if not selection or selection.record ~= this.data.record then
this.rt:SetSelectedRecord(this.data.record)
elseif this.rt.handlers.OnCellClick then
this.rt.handlers.OnCellClick(this, button)
end
end
end,
OnCellDoubleClick = function()
OnDoubleClick = function()
local rt = this.rt
local rowData = this.row.data
local rowData = this.data
local expand = not rt.expanded[rowData.expandKey]
rt.expanded[rowData.expandKey] = expand
rt:UpdateRowInfo()
rt:UpdateRows()
if not rowData.indented then
rt:SetSelectedRecord(this.row.data.record)
rt:SetSelectedRecord(this.data.record)
end
end,
@@ -912,10 +907,10 @@ function M.new(parent, rows, config)
local rt = CreateFrame('Frame', nil, parent)
rt.config = config
rt.ROW_HEIGHT = (parent:GetHeight() - HEAD_HEIGHT - HEAD_SPACE) / rows
rt.expanded = T
rt.handlers = T
rt.sorts = T
rt.records = T
rt.expanded = {}
rt.handlers = {}
rt.sorts = {}
rt.records = {}
rt.rowInfo = {numDisplayRows=0}
for name, func in methods do
@@ -956,7 +951,7 @@ function M.new(parent, rows, config)
_G[scrollBar:GetName() .. 'ScrollUpButton']:Hide()
_G[scrollBar:GetName() .. 'ScrollDownButton']:Hide()
rt.headCells = T
rt.headCells = {}
for i = 1, getn(rt.config) do
local column_config = rt.config[i]
local cell = CreateFrame('Button', nil, rt.contentFrame)
@@ -998,10 +993,15 @@ function M.new(parent, rows, config)
tinsert(rt.headCells, cell)
end
rt.rows = T
rt.rows = {}
for i = 1, rows do
local row = CreateFrame('Frame', nil, rt.contentFrame)
local row = CreateFrame('Button', nil, rt.contentFrame)
row:SetHeight(rt.ROW_HEIGHT)
row:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
row:SetScript('OnEnter', rt.OnEnter)
row:SetScript('OnLeave', rt.OnLeave)
row:SetScript('OnClick', rt.OnClick)
row:SetScript('OnDoubleClick', rt.OnDoubleClick)
if i == 1 then
row:SetPoint('TOPLEFT', 0, -(HEAD_HEIGHT + HEAD_SPACE))
row:SetPoint('TOPRIGHT', 0, -(HEAD_HEIGHT + HEAD_SPACE))
@@ -1016,9 +1016,9 @@ function M.new(parent, rows, config)
row.highlight = highlight
row.rt = rt
row.cells = T
row.cells = {}
for j = 1, getn(rt.config) do
local cell = CreateFrame('Button', nil, row)
local cell = CreateFrame('Frame', nil, row)
local text = cell:CreateFontString()
cell.text = text
text:SetFont(gui.font, min(14, rt.ROW_HEIGHT))
@@ -1027,11 +1027,6 @@ function M.new(parent, rows, config)
text:SetPoint('TOPLEFT', 1, -1)
text:SetPoint('BOTTOMRIGHT', -1, 1)
cell:SetHeight(rt.ROW_HEIGHT)
cell:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
cell:SetScript('OnEnter', rt.OnCellEnter)
cell:SetScript('OnLeave', rt.OnCellLeave)
cell:SetScript('OnClick', rt.OnCellClick)
cell:SetScript('OnDoubleClick', rt.OnCellDoubleClick)
cell.rt = rt
cell.row = row
@@ -1045,7 +1040,6 @@ function M.new(parent, rows, config)
local tex = cell:CreateTexture()
tex:SetAllPoints()
tex:SetTexture(.3, .3, .3, .2)
cell:SetNormalTexture(tex)
end
if rt.config[j].init then
+1 -1
View File
@@ -81,7 +81,7 @@ function M.new(parent, on_click, selected)
row:SetPoint('TOPLEFT', content_frame, 0, -((row_index - 1) * ROW_HEIGHT))
row:SetPoint('TOPRIGHT', content_frame, 0, -((row_index - 1) * ROW_HEIGHT))
row:EnableMouse(true)
row:SetScript('OnMouseDown', on_click)
row:SetScript('OnMouseUp', on_click)
row:SetScript('OnEnter', function()
row.mouseover = true
row.highlight:Show()
+28 -20
View File
@@ -13,42 +13,51 @@ local DEFAULT_COL_INFO = {{width=1}}
local handlers = {
OnEnter = function()
this.row.mouseover = true
if not this.row.data then return end
this.mouseover = true
if not this.data then return end
if not this.st.highlightDisabled then
this.row.highlight:Show()
this.highlight:Show()
end
local handler = this.st.handlers.OnEnter
if handler then
handler(this.st, this.row.data, this)
handler(this.st, this.data, this)
end
end,
OnLeave = function()
this.row.mouseover = false
if not this.row.data then return end
if this.st.selectionDisabled or not this.st.selected or this.st.selected ~= key(this.st.rowData, this.row.data) then
this.row.highlight:Hide()
this.mouseover = false
if not this.data then return end
if this.st.selectionDisabled or not this.st.selected or this.st.selected ~= key(this.st.rowData, this.data) then
this.highlight:Hide()
end
local handler = this.st.handlers.OnLeave
if handler then
handler(this.st, this.row.data, this)
handler(this.st, this.data, this)
end
end,
OnMouseDown = function()
if not this.row.data then return end
OnClick = function()
if not this.data then return end
this.st:ClearSelection()
this.st.selected = key(this.st.rowData, this.row.data)
this.row.highlight:Show()
this.st.selected = key(this.st.rowData, this.data)
this.highlight:Show()
local handler = this.st.handlers.OnClick
if handler then
handler(this.st, this.row.data, this, arg1)
handler(this.st, this.data, this, arg1)
end
end,
OnDoubleClick = function()
if not this.data then return end
local handler = this.st.handlers.OnDoubleClick
if handler then
handler(this.st, this.data, this, arg1)
end
end,
}
local methods = {
@@ -225,12 +234,7 @@ local methods = {
text:SetPoint('TOPLEFT', 1, -1)
text:SetPoint('BOTTOMRIGHT', -1, 1)
col:SetHeight(ROW_HEIGHT)
col:EnableMouse(true)
for name, func in handlers do
col:SetScript(name, func)
end
col.st = self
col.row = row
if colNum == 1 then
col:SetPoint('TOPLEFT', 0, 0)
@@ -241,8 +245,12 @@ local methods = {
end,
AddRow = function(self)
local row = CreateFrame('Frame', nil, self.contentFrame)
local row = CreateFrame('Button', nil, self.contentFrame)
row:SetHeight(ROW_HEIGHT)
row:RegisterForClicks('LeftButtonUp', 'RightButtonUp')
for name, func in handlers do
row:SetScript(name, func)
end
local rowNum = getn(self.rows) + 1
if rowNum == 1 then
row:SetPoint('TOPLEFT', 0, -(self.headHeight + HEAD_SPACE))
+17 -13
View File
@@ -127,6 +127,7 @@ function update_auction_listing(listing, records, reference)
local rows = T
if selected_item then
local historical_value = history.value(selected_item.key)
local stack_size = stack_size_slider:GetValue()
for i = 1, getn(records[selected_item.key] or empty) do
local record = records[selected_item.key][i]
tinsert(rows, O(
@@ -134,17 +135,32 @@ function update_auction_listing(listing, records, reference)
O('value', record.own and color.yellow(record.count) or record.count),
O('value', al.time_left(record.duration)),
O('value', record.stack_size == stack_size and color.yellow(record.stack_size) or record.stack_size),
O('value', money.to_string(record.unit_price, true, nil, 3, price_color(record, reference, stack_size_slider:GetValue()))),
O('value', money.to_string(record.unit_price, true, nil, 3, price_color(record, reference, stack_size))),
O('value', historical_value and al.percentage_historical(round(record.unit_price / historical_value * 100)) or '---')
),
'record', record
))
end
if historical_value then
tinsert(rows, O(
'cols', A(
O('value', '---'),
O('value', '---'),
O('value', '---'),
O('value', money.to_string(historical_value, true, nil, 3, color.green)),
O('value', historical_value and al.percentage_historical(100) or '---')
),
'record', O('historical_value', true, 'stack_size', stack_size, 'unit_price', historical_value, 'own', true)
))
end
sort(rows, function(a, b)
return sort_util.multi_lt(
a.record.unit_price,
b.record.unit_price,
a.record.historical_value and 1 or 0,
b.record.historical_value and 1 or 0,
a.record.stack_size,
b.record.stack_size,
@@ -268,7 +284,6 @@ function update_item_configuration()
stack_count_slider:Hide()
deposit:Hide()
duration_dropdown:Hide()
historical_value_button:Hide()
hide_checkbox:Hide()
else
unit_start_price_input:Show()
@@ -277,7 +292,6 @@ function update_item_configuration()
stack_count_slider:Show()
deposit:Show()
duration_dropdown:Show()
historical_value_button:Show()
hide_checkbox:Show()
item.texture:SetTexture(selected_item.texture)
@@ -346,14 +360,6 @@ function unit_vendor_price(item_key)
end
end
function update_historical_value_button()
if selected_item then
local historical_value = history.value(selected_item.key)
historical_value_button.amount = historical_value
historical_value_button:SetText(historical_value and money.to_string(historical_value, true, nil, 3) or '---')
end
end
function update_item(item)
local settings = read_settings(item.key)
@@ -460,7 +466,6 @@ function refresh_entries()
end,
on_abort = function()
bid_records[item_key], buyout_records[item_key]= nil, nil
update_historical_value_button()
status_bar:update_status(1, 1)
status_bar:set_text('Scan aborted')
end,
@@ -510,7 +515,6 @@ function on_update()
if refresh then
refresh = false
price_update()
update_historical_value_button()
update_item_configuration()
update_inventory_listing()
update_auction_listings()
+11 -20
View File
@@ -84,6 +84,10 @@ bid_listing:DisableSelection(true)
bid_listing:SetHandler('OnClick', function(table, row_data, column, button)
unit_start_price = undercut(row_data.record, stack_size_slider:GetValue(), button == 'RightButton')
end)
bid_listing:SetHandler('OnDoubleClick', function(table, row_data, column, button)
stack_size_slider:SetValue(row_data.record.stack_size)
unit_start_price = undercut(row_data.record, stack_size_slider:GetValue())
end)
buyout_listing = listing.new(frame.buyout_listing)
buyout_listing:SetColInfo{
@@ -97,6 +101,10 @@ buyout_listing:DisableSelection(true)
buyout_listing:SetHandler('OnClick', function(table, row_data, column, button)
unit_buyout_price = undercut(row_data.record, stack_size_slider:GetValue(), button == 'RightButton')
end)
buyout_listing:SetHandler('OnDoubleClick', function(table, row_data, column, button)
stack_size_slider:SetValue(row_data.record.stack_size)
unit_buyout_price = undercut(row_data.record, stack_size_slider:GetValue())
end)
do
status_bar = gui.status_bar(frame)
@@ -199,11 +207,6 @@ do
end)
duration_dropdown = dropdown
end
do
local label = gui.label(frame.parameters, gui.font_size.medium)
label:SetPoint('LEFT', duration_dropdown, 'RIGHT', 25, 0)
deposit = label
end
do
local checkbox = gui.checkbox(frame.parameters)
checkbox:SetPoint('TOPRIGHT', -83, -6)
@@ -289,19 +292,7 @@ do
unit_buyout_price_input = editbox
end
do
local btn = gui.button(frame.parameters, 14)
btn:SetPoint('TOPRIGHT', -10, -146)
gui.set_size(btn, 150, 20)
btn:GetFontString():SetJustifyH('RIGHT')
btn:GetFontString():SetPoint('RIGHT', -2, 0)
btn:SetScript('OnClick', function()
if this.amount then
unit_start_price = this.amount
unit_buyout_price = this.amount
end
end)
local label = gui.label(btn, gui.font_size.small)
label:SetPoint('BOTTOMLEFT', btn, 'TOPLEFT', -2, 1)
label:SetText('Historical Value')
historical_value_button = btn
local label = gui.label(frame.parameters, gui.font_size.medium)
label:SetPoint('TOPLEFT', unit_buyout_price_input, 'BOTTOMLEFT', 0, -24)
deposit = label
end
+7
View File
@@ -3,6 +3,13 @@ module 'aux.util.persistence'
include 'T'
include 'aux'
-- TODO clean up the mess of savedvariables
--aux_account_db = {
--datasets
-- }
--aux_character_db = {}
-- _G.aux_faction_db = {}
_G.aux_datasets = T
do