refactoring
This commit is contained in:
+1
-1
@@ -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
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user