refactoring

This commit is contained in:
Manuel Simon Hirsig
2016-08-23 23:42:47 +02:00
parent c9cf64dd8d
commit 9fb468c84e
11 changed files with 137 additions and 127 deletions
+73 -51
View File
@@ -52,65 +52,87 @@ do
function public.modifier(f)
local function apply(_, value) return f(value) end
return setmetatable(t, {
__index=apply, __call=apply, __add=apply, __sub=apply, __mul=apply, __div=apply, __pow=apply, __concat=apply,
__newindex=function(_, _, value) return f(value) end, __unm=function(self) return self end,
__call=apply, __sub=apply, __newindex=function(_, _, value) return f(value) end,
})
end
local temp, perm = modifier(function(t) transient[t] = true; return setmetatable(t, nil) end), modifier(function(t) transient[t] = nil; return t end)
public.temp() -- TODO or 'auto' 'free' 'deprecate' 'release'?
function accessor() return temp end
function mutator(t) return temp(t) end
public.perm()
function accessor() return perm end
function mutator(t) return perm(t) end
local temp, perm = modifier(function(t) transient[t] = true end), modifier(function(t) transient[t] = nil; return t end)
function public.accessor.temp() return temp end; function mutator(t) return temp(t) end
function public.accessor.perm() return perm end; function mutator(t) return perm(t) end
function public.collector_mt(f) -- TODO somehow use an existing table
return {
__unm=function(self)
return setmetatable(self, nil)
end,
__index=function(self, key)
f(self, key)
return self
end,
__call=function(self, arg1, arg2)
f(self, arg2 or arg1)
return self
end,
}
function keys(t,k1,k2,k3,k4,k5,k6,k7,k8,k9,k10,k11,k12,k13,k14,k15,k16,k17,k18,k19,k20)
if not t then return end
if k1 ~= nil then t[k1] = true end
if k2 ~= nil then t[k2] = true end
if k3 ~= nil then t[k3] = true end
if k4 ~= nil then t[k4] = true end
if k5 ~= nil then t[k5] = true end
if k6 ~= nil then t[k6] = true end
if k7 ~= nil then t[k7] = true end
if k8 ~= nil then t[k8] = true end
if k9 ~= nil then t[k9] = true end
if k10 ~= nil then t[k10] = true end
if k11 ~= nil then t[k11] = true end
if k12 ~= nil then t[k12] = true end
if k13 ~= nil then t[k13] = true end
if k14 ~= nil then t[k14] = true end
if k15 ~= nil then t[k15] = true end
if k16 ~= nil then t[k16] = true end
if k17 ~= nil then t[k17] = true end
if k18 ~= nil then t[k18] = true end
if k19 ~= nil then t[k19] = true end
if k20 ~= nil then t[k20] = true end
return t
end
do
local mt = collector_mt(tinsert)
function public.accessor.list()
return setmetatable(t, mt)
end
function values(t,v1,v2,v3,v4,v5,v6,v7,v8,v9,v10,v11,v12,v13,v14,v15,v16,v17,v18,v19,v20)
if not t then return end
if v1 ~= nil then tinsert(t, v1) end
if v2 ~= nil then tinsert(t, v2) end
if v3 ~= nil then tinsert(t, v3) end
if v4 ~= nil then tinsert(t, v4) end
if v5 ~= nil then tinsert(t, v5) end
if v6 ~= nil then tinsert(t, v6) end
if v7 ~= nil then tinsert(t, v7) end
if v8 ~= nil then tinsert(t, v8) end
if v9 ~= nil then tinsert(t, v9) end
if v10 ~= nil then tinsert(t, v10) end
if v11 ~= nil then tinsert(t, v11) end
if v12 ~= nil then tinsert(t, v12) end
if v13 ~= nil then tinsert(t, v13) end
if v14 ~= nil then tinsert(t, v14) end
if v15 ~= nil then tinsert(t, v15) end
if v16 ~= nil then tinsert(t, v16) end
if v17 ~= nil then tinsert(t, v17) end
if v18 ~= nil then tinsert(t, v18) end
if v19 ~= nil then tinsert(t, v19) end
if v20 ~= nil then tinsert(t, v20) end
return t
end
do
local mt = collector_mt(function(self, value)
self[value] = true
end)
function public.accessor.set()
return setmetatable(t, mt)
end
function pairs(t,k1,v1,k2,v2,k3,v3,k4,v4,k5,v5,k6,v6,k7,v7,k8,v8,k9,v9,k10,v10)
if not t then return end
if k1 ~= nil then t[k1] = v1 end
if k2 ~= nil then t[k2] = v2 end
if k3 ~= nil then t[k3] = v3 end
if k4 ~= nil then t[k4] = v4 end
if k5 ~= nil then t[k5] = v5 end
if k6 ~= nil then t[k6] = v6 end
if k7 ~= nil then t[k7] = v7 end
if k8 ~= nil then t[k8] = v8 end
if k9 ~= nil then t[k9] = v9 end
if k10 ~= nil then t[k10] = v10 end
return t
end
do
local key
local mt = collector_mt(function(self, value)
if key ~= nil then
self[key] = value
key = nil
else
key = value
end
end)
function public.accessor.object()
return setmetatable(t, mt)
end
function public.collector_mt(f)
return {__call=f, __unm=function(self) return setmetatable(self, nil) end}
end
local set_mt, list_mt, object_mt = collector_mt(keys), collector_mt(values), collector_mt(pairs)
public.accessor()
set, list, object = function() return setmetatable(t, set_mt) end, function() return setmetatable(t, list_mt) end, function() return setmetatable(t, object_mt) end
private()
-- TODO or 'auto' 'free' 'deprecate' 'release' 'transient'?
end
local event_frame = CreateFrame 'Frame'
for event in temp-set 'ADDON_LOADED' 'VARIABLES_LOADED' 'PLAYER_LOGIN' 'AUCTION_HOUSE_SHOW' 'AUCTION_HOUSE_CLOSED' 'AUCTION_BIDDER_LIST_UPDATE' 'AUCTION_OWNED_LIST_UPDATE' do
for event in temp-set('ADDON_LOADED', 'VARIABLES_LOADED', 'PLAYER_LOGIN', 'AUCTION_HOUSE_SHOW', 'AUCTION_HOUSE_CLOSED', 'AUCTION_BIDDER_LIST_UPDATE', 'AUCTION_OWNED_LIST_UPDATE') do
event_frame:RegisterEvent(event)
end
@@ -143,9 +165,9 @@ end
tab_info = t
do
local data = temp-list :search_tab 'Search' :post_tab 'Post' :auctions_tab 'Auctions' :bids_tab 'Bids'
local data = temp-list('search_tab', 'Search', 'post_tab', 'Post', 'auctions_tab', 'Auctions', 'bids_tab', 'Bids')
for i=1,7,2 do
local tab = -object :name(data[i + 1]);
local tab = -object('name', data[i + 1])
local env = (function() module(data[i]) return _m end)()
function env.mutator.OPEN(f) tab.OPEN = f end
function env.mutator.CLOSE(f) tab.CLOSE = f end
+1 -1
View File
@@ -175,7 +175,7 @@ function scan_wdb(item_id)
max_stack = max_stack,
texture = texture,
})
local tooltip = info.tooltip(function(tt) tt:SetHyperlink(itemstring) end)
local tooltip = info.tooltip(function(tooltip) tooltip:SetHyperlink(itemstring) end)
if info.auctionable(tooltip, quality) then
tinsert(_g.aux_auctionable_items, strlower(name))
end
+7 -4
View File
@@ -35,7 +35,7 @@ do
end
function accessor.new_record()
return -object :next_push(next_push) :data_points(t)
return -object('next_push', next_push, 'data_points', t)
end
function read_record(item_key)
@@ -84,7 +84,7 @@ function public.value(item_key)
for _, data_point in item_record.data_points do
local weight = .99 ^ round((item_record.data_points[1].time - data_point.time) / (60 * 60 * 24))
total_weight = total_weight + weight
tinsert(weighted_values, -object :value(data_point.market_value) :weight(weight))
tinsert(weighted_values, -object('value', data_point.market_value, 'weight', weight))
end
for _, weighted_value in weighted_values do
weighted_value.weight = weighted_value.weight / total_weight
@@ -93,8 +93,11 @@ function public.value(item_key)
else
value = calculate_market_value(item_record)
end
value_cache[item_key] = -object :value(value) :next_push(item_record.next_push)
value_cache[item_key] = -object('value', value, 'next_push', tem_record.next_push)
end
if type(value_cache[item_key].value) == 'table' then
for k, v in value_cache[item_key].value.value do log(k, v) end
end
log (value_cache[item_key].value)
return value_cache[item_key].value
end
@@ -120,7 +123,7 @@ end
function push_record(item_record)
for market_value in present(calculate_market_value(item_record)) do
tinsert(item_record.data_points, 1, -object :market_value(market_value) :time(item_record.next_push))
tinsert(item_record.data_points, 1, -object('market_value', market_value, 'time', item_record.next_push))
while getn(item_record.data_points) > 11 do
tremove(item_record.data_points)
end
+1 -1
View File
@@ -90,7 +90,7 @@ function extend_tooltip(tooltip, link, quantity)
end
end
local color = {r=1, g=1, b=.6}
local auctionable = not item_info or info.auctionable(info.tooltip(function(tt) tt:SetHyperlink(item_info.itemstring) end), item_info.quality)
local auctionable = not item_info or info.auctionable(info.tooltip(function(tooltip) tooltip:SetHyperlink(item_info.itemstring) end), item_info.quality)
local item_key = (item_id or 0)..':'..(suffix_id or 0)
local value = history.value(item_key)
if auctionable then
+13 -25
View File
@@ -4,12 +4,7 @@ local DURATION_4, DURATION_8, DURATION_24 = 120, 480, 1440
local settings_schema = {'record', '#', {stack_size='number'}, {duration='number'}, {start_price='number'}, {buyout_price='number'}, {hidden='boolean'}}
function accessor.default_settings()
return -object
:duration(DURATION_8)
:stack_size(1)
:start_price(0)
:buyout_price(0)
:hidden(false)
return -object('duration', DURATION_8 , 'stack_size', 1, 'start_price', 0, 'buyout_price', 0, 'hidden', false)
end
do
@@ -400,18 +395,17 @@ function update_inventory_records()
availability[i] = 0
end
availability[charge_class] = item_info.count
auctionable_map[item_info.item_key] = -object
:item_id (item_info.item_id)
:suffix_id (item_info.suffix_id)
:key (item_info.item_key)
:itemstring (item_info.itemstring)
:name (item_info.name)
:texture (item_info.texture)
:quality (item_info.quality)
:aux_quantity (item_info.charges or item_info.count)
:max_stack (item_info.max_stack)
:max_charges (item_info.max_charges)
:availability (availability)
auctionable_map[item_info.item_key] = -object ('item_id', item_info.item_id, 'suffix_id', item_info.suffix_id, 'key', item_info.item_key)
:itemstring(item_info.itemstring)
:name(item_info.name)
:texture(item_info.texture)
:quality(item_info.quality)
:aux_quantity(item_info.charges or item_info.count)
:max_stack(item_info.max_stack)
:max_charges(item_info.max_charges)
:availability(availability)
-- for k, v in auctionable_map[item_info.item_key].max_charges do log(k, v) end
else
local auctionable = auctionable_map[item_info.item_key]
auctionable.availability[charge_class] = (auctionable.availability[charge_class] or 0) + item_info.count
@@ -482,13 +476,7 @@ function record_auction(key, aux_quantity, unit_blizzard_bid, unit_buyout_price,
end
end
if not entry then
entry = -object
:stack_size (aux_quantity)
:unit_blizzard_bid (unit_blizzard_bid)
:unit_buyout_price (unit_buyout_price)
:duration (duration)
:own (is_player(owner))
:count (0)
entry = -object('stack_size', aux_quantity 'unit_blizzard_bid', unit_blizzard_bid 'unit_buyout_price', unit_buyout_price 'duration', duration 'own', is_player(owner) 'count', 0)
tinsert(existing_auctions[key], entry)
end
entry.count = entry.count + 1
+14 -14
View File
@@ -1,4 +1,4 @@
module 'post_tab' import [''] 'core' 'gui' 'listing' 'item_listing' 'money'
module 'post_tab' import [''] 'core' 'gui' 'listing' 'item_listing' 'money' 'search_tab'
function create_frames()
frame = CreateFrame('Frame', nil, aux_frame)
@@ -34,7 +34,7 @@ function create_frames()
end)
local label = gui.label(checkbox, gui.font_size.small)
label:SetPoint('LEFT', checkbox, 'RIGHT', 4, 1)
label:SetText('Show hidden items')
label:SetText 'Show hidden items'
show_hidden_checkbox = checkbox
end
@@ -57,15 +57,15 @@ function create_frames()
)
auction_listing = listing.CreateScrollingTable(frame.auctions)
auction_listing:SetColInfo({
{ name='Auctions', width=.12, align='CENTER' },
{ name='Left', width=.1, align='CENTER' },
{ name='Qty', width=.08, align='CENTER' },
{ name='Bid/ea', width=.22, align='RIGHT' },
{ name='Bid Pct', width=.13, align='CENTER' },
{ name='Buy/ea', width=.22, align='RIGHT' },
{ name='Buy Pct', width=.13, align='CENTER' }
})
auction_listing:SetColInfo{
{name='Auctions', width=.12, align='CENTER'},
{name='Left', width=.1, align='CENTER'},
{name='Qty', width=.08, align='CENTER'},
{name='Bid/ea', width=.22, align='RIGHT'},
{name='Bid Pct', width=.13, align='CENTER'},
{name='Buy/ea', width=.22, align='RIGHT'},
{name='Buy Pct', width=.13, align='CENTER'}
}
auction_listing:EnableSorting(false)
auction_listing:DisableSelection(true)
auction_listing:SetHandler('OnClick', function(table, row_data, column, button)
@@ -86,14 +86,14 @@ function create_frames()
status_bar:SetHeight(25)
status_bar:SetPoint('TOPLEFT', aux_frame.content, 'BOTTOMLEFT', 0, -6)
status_bar:update_status(100, 100)
status_bar:set_text('')
status_bar:set_text ''
end
do
local btn = gui.button(frame.parameters, 16)
btn:SetPoint('TOPLEFT', status_bar, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Post')
btn:SetText 'Post'
btn:SetScript('OnClick', post_auctions)
post_button = btn
end
@@ -102,7 +102,7 @@ function create_frames()
btn:SetPoint('TOPLEFT', post_button, 'TOPRIGHT', 5, 0)
btn:SetWidth(80)
btn:SetHeight(24)
btn:SetText('Refresh')
btn:SetText 'Refresh'
btn:SetScript('OnClick', function()
scan.abort(scan_id)
refresh_entries()
+9 -9
View File
@@ -72,14 +72,14 @@ function update_form()
end
if blizzard_query.exact then
for key in temp-set 'class' 'subclass' 'slot' 'quality' do
for key in temp-set('class', 'subclass', 'slot', 'quality') do
_m[key..'_dropdown'].button:Disable()
end
else
class_dropdown.button:Enable()
quality_dropdown.button:Enable()
end
for key in temp-set 'min_level' 'max_level' do
for key in temp-set('min_level', 'max_level') do
if blizzard_query.exact then
_m[key..'_input']:Disable()
else
@@ -92,7 +92,7 @@ function update_form()
usable_checkbox:Enable()
end
if any(temp-list 'min_level' 'max_level' 'usable' 'class' 'subclass' 'slot' 'quality', function(key) return blizzard_query[key] end) then
if any(values('min_level', 'max_level', 'usable', 'class', 'subclass', 'slot', 'quality'), function(key) return blizzard_query[key] end) then
exact_checkbox:Disable()
else
exact_checkbox:Enable()
@@ -134,7 +134,7 @@ function get_filter_builder_query()
add(strlower(_g['ITEM_QUALITY'..quality..'_DESC']))
end
local post_filter_string = filter_util.query_string(temp-object :blizzard(tt) :post(post_filter))
local post_filter_string = filter_util.query_string(temp-object('blizzard', tt, 'post', post_filter))
add(post_filter_string ~= '' and post_filter_string)
return query_string or ''
@@ -231,7 +231,7 @@ function data_link(id, str)
end
post_filter = t
filter_builder_state = -object :selected(0)
filter_builder_state = -object('selected', 0)
function data_link_click()
local button = arg3
@@ -313,8 +313,8 @@ function set_filter_display_offset(x_offset, y_offset)
end
function initialize_filter_dropdown()
for _, filter in temp-list 'and' 'or' 'not' 'min-unit-bid' 'min-unit-buy' 'max-unit-bid' 'max-unit-buy' 'bid-profit' 'buy-profit' 'bid-vend-profit' 'buy-vend-profit' 'bid-dis-profit' 'buy-dis-profit' 'bid-pct' 'buy-pct' 'item' 'tooltip' 'min-lvl' 'max-lvl' 'rarity' 'left' 'utilizable' 'discard' do
UIDropDownMenu_AddButton(-object :text(filter) :value(filter) :func(function()
for _, filter in temp-list('and', 'or', 'not', 'min-unit-bid', 'min-unit-buy', 'max-unit-bid', 'max-unit-buy', 'bid-profit', 'buy-profit', 'bid-vend-profit', 'buy-vend-profit', 'bid-dis-profit', 'buy-dis-profit', 'bid-pct', 'buy-pct', 'item', 'tooltip', 'min-lvl', 'max-lvl', 'rarity', 'left', 'utilizable', 'discard') do
UIDropDownMenu_AddButton(-object('text', filter, 'value', filter, 'func', function()
filter_input:SetText(this.value)
if index(filter_util.filters[this.value], 'input_type') == '' or this.value == 'not' then
add_post_filter()
@@ -323,8 +323,8 @@ function initialize_filter_dropdown()
filter_parameter_input:SetFocus()
else
filter_input:SetFocus()
end
end))
end)
end)
end
end
+1 -1
View File
@@ -42,7 +42,7 @@ do
while getn(searches) > search_index do
tremove(searches)
end
local search = -object :filter_string(filter_string) :records(t)
local search = -object('filter_string', filter_string, 'records', t)
tinsert(searches, search)
if getn(searches) > 5 then
tremove(searches, 1)
+4 -4
View File
@@ -208,7 +208,7 @@ public.filters = {
function operator(str)
local operator = str == 'not' and {'operator', 'not', 1}
for name in -set 'and', 'or' do
for name in -set('and', 'or') do
for arity in present(select(3, strfind(str, '^'..name..'(%d*)$'))) do
arity = tonumber(arity)
operator = not (arity and arity < 2) and {'operator', name, arity}
@@ -319,7 +319,7 @@ function public.parse_query_string(str)
i = i + 1
end
return -object :blizzard(blizzard_filter_parser()) :post(post_filter)
return -object('blizzard', blizzard_filter_parser(), 'post', post_filter)
end
function public.query(query_string)
@@ -496,7 +496,7 @@ end
function blizzard_query(components)
local filters = components.blizzard
local query = -object :name(filters.name and filters.name[2])
local query = -object('name', filters.name and filters.name[2])
local item_info, class_index, subclass_index, slot_index
local item_id = cache.item_id(filters.name[2])
@@ -517,7 +517,7 @@ function blizzard_query(components)
query.slot = slot_index
query.quality = item_info.quality
else
for key in temp-set 'min_level' 'max_level' 'class' 'subclass' 'slot' 'usable' 'quality' do
for key in temp-set('min_level', 'max_level', 'class', 'subclass', 'slot', 'usable', 'quality') do
query[key] = index(filters[key], 2)
end
end
+11 -12
View File
@@ -44,11 +44,10 @@ function public.container_item(bag, slot)
local item_info = item(item_id, suffix_id, unique_id, enchant_id)
local texture, count, locked, quality, readable, lootable = GetContainerItemInfo(bag, slot) -- quality not working?
local tooltip, tooltip_money = tooltip(function(tt) tt:SetBagItem(bag, slot) end)
local tooltip, tooltip_money = tooltip(function(tooltip) tooltip:SetBagItem(bag, slot) end)
local max_charges = max_item_charges(item_id)
local charges = max_charges and item_charges(tooltip)
local aux_quantity = charges or count
return {
item_id = item_id,
suffix_id = suffix_id,
@@ -105,7 +104,7 @@ function public.auction(index, query_type)
local name, texture, count, quality, usable, level, start_price, min_increment, buyout_price, high_bid, high_bidder, owner, sale_status = GetAuctionItemInfo(query_type, index)
local duration = GetAuctionItemTimeLeft(query_type, index)
local tooltip, tooltip_money = tooltip(function(tt) tt:SetAuctionItem(query_type, index) end)
local tooltip, tooltip_money = tooltip(function(tooltip) tooltip:SetAuctionItem(query_type, index) end)
local max_charges = max_item_charges(item_id)
local charges = max_charges and item_charges(tooltip)
local aux_quantity = charges or count
@@ -121,8 +120,8 @@ function public.auction(index, query_type)
link = link,
itemstring = item_info.itemstring,
item_key = item_id..':'..suffix_id,
search_signature = join({item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), _g.aux_ignore_owner and (is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
sniping_signature = join({item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, _g.aux_ignore_owner and (is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
search_signature = join(temp-{item_id, suffix_id, enchant_id, start_price, buyout_price, bid_price, aux_quantity, duration, query_type == 'owner' and high_bidder or (high_bidder and 1 or 0), _g.aux_ignore_owner and (is_player(owner) and 0 or 1) or (owner or '?')}, ':'),
sniping_signature = join(temp-{item_id, suffix_id, enchant_id, start_price, buyout_price, aux_quantity, _g.aux_ignore_owner and (is_player(owner, true) and 0 or 1) or (owner or '?')}, ':'),
name = name,
texture = texture,
@@ -166,7 +165,7 @@ function public.bid_update(auction_record)
auction_record.unit_blizzard_bid = auction_record.blizzard_bid / auction_record.aux_quantity
auction_record.unit_bid_price = auction_record.bid_price / auction_record.aux_quantity
auction_record.high_bidder = 1
auction_record.search_signature = join({auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, _g.aux_ignore_owner and (is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
auction_record.search_signature = join(temp-{auction_record.item_id, auction_record.suffix_id, auction_record.enchant_id, auction_record.start_price, auction_record.buyout_price, auction_record.bid_price, auction_record.aux_quantity, auction_record.duration, 1, _g.aux_ignore_owner and (is_player(auction_record.owner) and 0 or 1) or (auction_record.owner or '?')}, ':')
end
function public.set_tooltip(itemstring, owner, anchor)
@@ -178,20 +177,20 @@ function public.set_shopping_tooltip(slot)
local index1, index2 = inventory_index(slot)
local tooltips = tt
if index1 then
local tooltip = tooltip(function(tt) tt:SetInventoryItem('player', index1) end)
local tooltip = tooltip(function(tooltip) tooltip:SetInventoryItem('player', index1) end)
if getn(tooltip) > 0 then
tinsert(tooltips, tooltip)
end
end
if index2 then
local tooltip = tooltip(function(tt) tt:SetInventoryItem('player', index2) end)
local tooltip = tooltip(function(tooltip) tooltip:SetInventoryItem('player', index2) end)
if getn(tooltip) > 0 then
tinsert(tooltips, tooltip)
end
end
if tooltips[1] then
tinsert(tooltips[1], 1, temp-object :left_text 'Currently Equipped' :left_color(temp-{.5, .5, .5}))
tinsert(tooltips[1], 1, temp-object('left_text', 'Currently Equipped', 'left_color', temp-list(.5, .5, .5)))
ShoppingTooltip1:SetOwner(GameTooltip, 'ANCHOR_BOTTOMRIGHT')
load_tooltip(ShoppingTooltip1, tooltips[1])
ShoppingTooltip1:Show()
@@ -199,7 +198,7 @@ function public.set_shopping_tooltip(slot)
end
if tooltips[2] then
tinsert(tooltips[2], 1, temp-object :left_text 'Currently Equipped' :left_color(temp-{.5, .5, .5}))
tinsert(tooltips[2], 1, temp-object('left_text', 'Currently Equipped', 'left_color', temp-list(.5, .5, .5)))
ShoppingTooltip2:SetOwner(ShoppingTooltip1, 'ANCHOR_BOTTOMRIGHT')
load_tooltip(ShoppingTooltip2, tooltips[2])
ShoppingTooltip2:Show()
@@ -267,10 +266,10 @@ function public.auctionable(tooltip, quality, lootable)
and not (durability and durability < max_durability)
end
function public.tooltip(mutator)
function public.tooltip(setter)
AuxTooltip:SetOwner(UIParent, 'ANCHOR_NONE')
AuxTooltip.money = 0
mutator(AuxTooltip)
setter(AuxTooltip)
AuxTooltip:Show()
local tooltip = t
+3 -5
View File
@@ -19,13 +19,13 @@ function public.find(auction_record, status_bar, on_abort, on_failure, on_succes
local blizzard_query1 = copy(auction_record.blizzard_query)
blizzard_query1.first_page = auction_record.page
blizzard_query1.last_page = auction_record.page
tinsert(queries, -object :blizzard_query(blizzard_query1))
tinsert(queries, -object('blizzard_query', blizzard_query1))
if auction_record.page > 0 then
local blizzard_query2 = copy(auction_record.blizzard_query)
blizzard_query2.first_page = auction_record.page - 1
blizzard_query2.last_page = auction_record.page - 1
tinsert(queries, -object :blizzard_query(blizzard_query2))
tinsert(queries, -object('blizzard_query', blizzard_query2))
end
local item_query = item_query(auction_record.item_id, 1, 1)
@@ -78,8 +78,6 @@ function public.item_query(item_id, first_page, last_page)
local query = filter_util.query(item_info.name..'/exact')
query.blizzard_query.first_page = first_page
query.blizzard_query.last_page = last_page
return -object
:validator(query.validator)
:blizzard_query(query.blizzard_query)
return -object('validator', query.validator, 'blizzard_query', query.blizzard_query)
end
end