post changes
This commit is contained in:
+1
-1
@@ -2,7 +2,7 @@
|
||||
## Title: aux
|
||||
## Notes: Auction House replacement
|
||||
## SavedVariablesPerCharacter: aux_tooltip_value, aux_tooltip_daily, aux_tooltip_merchant_buy, aux_tooltip_merchant_sell, aux_tooltip_disenchant_value, aux_tooltip_disenchant_distribution, aux_tooltip_disenchant_source
|
||||
## SavedVariables: aux_scale, aux_datasets, aux_items, aux_item_ids, aux_auctionable_items, aux_merchant_buy, aux_merchant_sell, aux_characters, aux_recent_searches, aux_favorite_searches, aux_ignore_owner
|
||||
## SavedVariables: aux_scale, aux_datasets, aux_items, aux_item_ids, aux_auctionable_items, aux_merchant_buy, aux_merchant_sell, aux_characters, aux_recent_searches, aux_favorite_searches, aux_post_bid, aux_ignore_owner
|
||||
|
||||
libs\inspect.lua
|
||||
libs\module.lua
|
||||
|
||||
@@ -23,6 +23,9 @@ function SlashCmdList.AUX(command)
|
||||
elseif arguments[1] == 'ignore' and arguments[2] == 'owner' then
|
||||
_G.aux_ignore_owner = not aux_ignore_owner
|
||||
print('ignore owner ' .. status(aux_ignore_owner))
|
||||
elseif arguments[1] == 'post' and arguments[2] == 'bid' then
|
||||
_G.aux_post_bid = not aux_post_bid
|
||||
print('post bid ' .. status(aux_post_bid))
|
||||
elseif arguments[1] == 'tooltip' and arguments[2] == 'value' then
|
||||
_G.aux_tooltip_value = not aux_tooltip_value
|
||||
print('tooltip value ' .. status(aux_tooltip_value))
|
||||
@@ -55,6 +58,7 @@ function SlashCmdList.AUX(command)
|
||||
print('Usage:')
|
||||
print('- scale [' .. color.blue(aux_scale) .. ']')
|
||||
print('- ignore owner [' .. status(aux_ignore_owner) .. ']')
|
||||
print('- post bid [' .. status(aux_post_bid) .. ']')
|
||||
print('- tooltip value [' .. status(aux_tooltip_value) .. ']')
|
||||
print('- tooltip daily [' .. status(aux_tooltip_daily) .. ']')
|
||||
print('- tooltip vendor buy [' .. status(aux_tooltip_merchant_buy) .. ']')
|
||||
|
||||
@@ -855,7 +855,7 @@ local methods = {
|
||||
end,
|
||||
|
||||
RemoveAuctionRecord = function(self, record)
|
||||
local index = key(record, self.records)
|
||||
local index = key(self.records, record)
|
||||
if index then
|
||||
tremove(self.records, index)
|
||||
end
|
||||
@@ -863,7 +863,7 @@ local methods = {
|
||||
end,
|
||||
|
||||
ContainsRecord = function(self, record)
|
||||
if key(record, self.records) then
|
||||
if key(self.records, record) then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
+10
-25
@@ -28,7 +28,7 @@ local handlers = {
|
||||
OnLeave = function()
|
||||
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
|
||||
if not this.st.selected or this.st.selected ~= key(this.st.rowData, this.data) then
|
||||
this.highlight:Hide()
|
||||
end
|
||||
|
||||
@@ -41,7 +41,7 @@ local handlers = {
|
||||
OnClick = function()
|
||||
if not this.data then return end
|
||||
this.st:ClearSelection()
|
||||
this.st.selected = key(this.st.rowData, this.data)
|
||||
this.st.selected = not this.st.selectionDisabled and key(this.st.rowData, this.data)
|
||||
this.highlight:Show()
|
||||
|
||||
local handler = this.st.handlers.OnClick
|
||||
@@ -103,7 +103,7 @@ local methods = {
|
||||
else
|
||||
row:Show()
|
||||
while getn(row.cols) < getn(self.colInfo) do
|
||||
self:AddRowCol(i)
|
||||
self:AddCell(i)
|
||||
end
|
||||
for j, col in row.cols do
|
||||
if self.headCols[j] and self.colInfo[j] then
|
||||
@@ -132,10 +132,7 @@ local methods = {
|
||||
if not data then break end
|
||||
self.rows[i].data = data
|
||||
|
||||
if (self.selected == key(self.rowData, data) and not self.selectionDisabled)
|
||||
or (self.highlighted and self.highlighted == key(self.rowData, data))
|
||||
or self.rows[i].mouseover
|
||||
then
|
||||
if self.selected == key(self.rowData, data) or self.rows[i].mouseover then
|
||||
self.rows[i].highlight:Show()
|
||||
else
|
||||
self.rows[i].highlight:Hide()
|
||||
@@ -166,19 +163,8 @@ local methods = {
|
||||
self:Update()
|
||||
end,
|
||||
|
||||
SetSelection = function(self, predicate)
|
||||
self:ClearSelection()
|
||||
for i, rowDatum in self.rowData do
|
||||
if predicate(rowDatum) then
|
||||
self.selected = i
|
||||
self:Update()
|
||||
break
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
GetSelection = function(self)
|
||||
return self.selected
|
||||
return self.rowData[self.selected]
|
||||
end,
|
||||
|
||||
ClearSelection = function(self)
|
||||
@@ -192,7 +178,7 @@ local methods = {
|
||||
|
||||
AddColumn = function(self)
|
||||
local colNum = getn(self.headCols) + 1
|
||||
local col = CreateFrame('Frame', self:GetName() .. 'HeadCol' .. colNum, self.contentFrame)
|
||||
local col = CreateFrame('Frame', nil, self.contentFrame)
|
||||
if colNum == 1 then
|
||||
col:SetPoint('TOPLEFT', 0, 0)
|
||||
else
|
||||
@@ -214,16 +200,15 @@ local methods = {
|
||||
tex:SetAlpha(.5)
|
||||
|
||||
tinsert(self.headCols, col)
|
||||
|
||||
-- add new cells to the rows
|
||||
|
||||
for i, row in self.rows do
|
||||
while getn(row.cols) < getn(self.headCols) do
|
||||
self:AddRowCol(i)
|
||||
self:AddCell(i)
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
||||
AddRowCol = function(self, rowNum)
|
||||
AddCell = function(self, rowNum)
|
||||
local row = self.rows[rowNum]
|
||||
local colNum = getn(row.cols) + 1
|
||||
local col = CreateFrame('Frame', nil, row)
|
||||
@@ -269,7 +254,7 @@ local methods = {
|
||||
row.cols = T
|
||||
self.rows[rowNum] = row
|
||||
for _ = 1, getn(self.colInfo) do
|
||||
self:AddRowCol(rowNum)
|
||||
self:AddCell(rowNum)
|
||||
end
|
||||
end,
|
||||
|
||||
|
||||
+40
-7
@@ -17,12 +17,12 @@ local al = require 'aux.gui.auction_listing'
|
||||
TAB 'Post'
|
||||
|
||||
local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
|
||||
local settings_schema = {'tuple', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
|
||||
local settings_schema = {'tuple', '#', {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
|
||||
|
||||
local scan_id, inventory_records, bid_records, buyout_records = 0, T, T, T
|
||||
|
||||
function get_default_settings()
|
||||
return O('duration', DURATION_8 , 'stack_size', 1, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
|
||||
return O('duration', DURATION_8, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
|
||||
end
|
||||
|
||||
do
|
||||
@@ -81,8 +81,8 @@ function USE_ITEM(item_info)
|
||||
end
|
||||
|
||||
function get_unit_start_price()
|
||||
local money_text = unit_start_price_input:GetText()
|
||||
return money.from_string(money_text) or 0
|
||||
local money_text = unit_start_price_input:GetText()
|
||||
return money.from_string(money_text) or 0
|
||||
end
|
||||
|
||||
function set_unit_start_price(amount)
|
||||
@@ -195,9 +195,21 @@ function price_update()
|
||||
|
||||
local historical_value = history.value(selected_item.key)
|
||||
|
||||
if aux_post_bid then
|
||||
if bid_listing:GetSelection() then
|
||||
unit_start_price = undercut(bid_listing:GetSelection().record, stack_size_slider:GetValue())
|
||||
end
|
||||
else
|
||||
if buyout_listing:GetSelection() then
|
||||
unit_start_price = undercut(buyout_listing:GetSelection().record, stack_size_slider:GetValue())
|
||||
end
|
||||
end
|
||||
settings.start_price = unit_start_price
|
||||
start_price_percentage:SetText(historical_value and al.percentage_historical(round(unit_start_price / historical_value * 100)) or '---')
|
||||
|
||||
if buyout_listing:GetSelection() then
|
||||
unit_buyout_price = undercut(buyout_listing:GetSelection().record, stack_size_slider:GetValue())
|
||||
end
|
||||
settings.buyout_price = unit_buyout_price
|
||||
buyout_price_percentage:SetText(historical_value and al.percentage_historical(round(unit_buyout_price / historical_value * 100)) or '---')
|
||||
|
||||
@@ -236,13 +248,18 @@ function post_auctions()
|
||||
record_auction(key, stack_size, unit_start_price, unit_buyout_price, duration_code, UnitName'player')
|
||||
end
|
||||
update_inventory_records()
|
||||
selected_item = nil
|
||||
local same
|
||||
for _, record in inventory_records do
|
||||
if record.key == key then
|
||||
update_item(record)
|
||||
same = record
|
||||
break
|
||||
end
|
||||
end
|
||||
if same then
|
||||
update_item(same)
|
||||
else
|
||||
selected_item = nil
|
||||
end
|
||||
refresh = true
|
||||
end
|
||||
)
|
||||
@@ -373,6 +390,11 @@ function update_item(item)
|
||||
|
||||
scan.abort(scan_id)
|
||||
|
||||
if not selected_item or item.key ~= selected_item.key then
|
||||
bid_listing:ClearSelection()
|
||||
buyout_listing:ClearSelection()
|
||||
end
|
||||
|
||||
selected_item = item
|
||||
|
||||
UIDropDownMenu_Initialize(duration_dropdown, initialize_duration_dropdown)
|
||||
@@ -381,7 +403,17 @@ function update_item(item)
|
||||
hide_checkbox:SetChecked(settings.hidden)
|
||||
|
||||
stack_size_slider:SetMinMaxValues(1, selected_item.max_charges or selected_item.max_stack)
|
||||
stack_size_slider:SetValue(settings.stack_size)
|
||||
if selected_item.max_charges then
|
||||
for i = selected_item.max_charges, 1, -1 do
|
||||
if selected_item.availability[i] > 0 then
|
||||
stack_size_slider:SetMinMaxValues(1, i)
|
||||
break
|
||||
end
|
||||
end
|
||||
else
|
||||
stack_size_slider:SetMinMaxValues(1, min(selected_item.max_stack, selected_item.aux_quantity))
|
||||
end
|
||||
stack_size_slider:SetValue(huge)
|
||||
quantity_update(true)
|
||||
|
||||
unit_start_price_input:SetText(money.to_string(settings.start_price, true, nil, 3, nil, true))
|
||||
@@ -392,6 +424,7 @@ function update_item(item)
|
||||
end
|
||||
|
||||
write_settings(settings, item.key)
|
||||
|
||||
refresh = true
|
||||
end
|
||||
|
||||
|
||||
+20
-7
@@ -80,13 +80,12 @@ bid_listing:SetColInfo{
|
||||
{name='Auction Bid\n(per item)', width=.4, align='RIGHT'},
|
||||
{name='% Hist.\nValue', width=.21, align='CENTER'},
|
||||
}
|
||||
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')
|
||||
refresh = true
|
||||
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())
|
||||
refresh = true
|
||||
end)
|
||||
|
||||
buyout_listing = listing.new(frame.buyout_listing)
|
||||
@@ -97,13 +96,12 @@ buyout_listing:SetColInfo{
|
||||
{name='Auction Buyout\n(per item)', width=.4, align='RIGHT'},
|
||||
{name='% Hist.\nValue', width=.20, align='CENTER'},
|
||||
}
|
||||
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')
|
||||
refresh = true
|
||||
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())
|
||||
refresh = true
|
||||
end)
|
||||
|
||||
do
|
||||
@@ -153,7 +151,6 @@ do
|
||||
quantity_update(true)
|
||||
if selected_item then
|
||||
local settings = read_settings()
|
||||
settings.stack_size = this:GetNumber()
|
||||
write_settings(settings)
|
||||
end
|
||||
end
|
||||
@@ -237,6 +234,7 @@ do
|
||||
end
|
||||
end)
|
||||
editbox.formatter = function() return money.to_string(unit_start_price, true, nil, 3) end
|
||||
editbox.char = function() bid_listing:ClearSelection() end
|
||||
editbox.change = function() refresh = true end
|
||||
editbox.enter = function() this:ClearFocus() end
|
||||
editbox.focus_loss = function()
|
||||
@@ -272,6 +270,7 @@ do
|
||||
end
|
||||
end)
|
||||
editbox.formatter = function() return money.to_string(get_unit_buyout_price(), true, nil, 3) end
|
||||
editbox.char = function() buyout_listing:ClearSelection() end
|
||||
editbox.change = function() refresh = true end
|
||||
editbox.enter = function() this:ClearFocus() end
|
||||
editbox.focus_loss = function()
|
||||
@@ -295,4 +294,18 @@ do
|
||||
local label = gui.label(frame.parameters, gui.font_size.medium)
|
||||
label:SetPoint('TOPLEFT', unit_buyout_price_input, 'BOTTOMLEFT', 0, -24)
|
||||
deposit = label
|
||||
end
|
||||
|
||||
function LOAD()
|
||||
if not aux_post_bid then
|
||||
frame.bid_listing:Hide()
|
||||
frame.buyout_listing:SetPoint('BOTTOMLEFT', frame.inventory, 'BOTTOMRIGHT', 2.5, 0)
|
||||
buyout_listing:SetColInfo{
|
||||
{name='Auctions', width=.15, align='CENTER'},
|
||||
{name='Time Left', width=.15, align='CENTER'},
|
||||
{name='Stack Size', width=.15, align='CENTER'},
|
||||
{name='Auction Buyout (per item)', width=.4, align='RIGHT'},
|
||||
{name='% Hist. Value', width=.15, align='CENTER'},
|
||||
}
|
||||
end
|
||||
end
|
||||
@@ -54,7 +54,7 @@ function M.size(t)
|
||||
return size
|
||||
end
|
||||
|
||||
function M.key(value, t)
|
||||
function M.key(t, value)
|
||||
for k, v in t do if v == value then return k end end
|
||||
end
|
||||
|
||||
|
||||
+1
-1
@@ -254,7 +254,7 @@ function parse_parameter(input_type, str)
|
||||
elseif input_type == 'string' then
|
||||
return str ~= '' and str or nil
|
||||
elseif type(input_type) == 'table' then
|
||||
return key(str, input_type)
|
||||
return key(input_type, str)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user