imported the util core module

This commit is contained in:
Manuel Simon Hirsig
2016-08-19 17:18:04 +02:00
parent e334a444df
commit 95250002a5
24 changed files with 93 additions and 93 deletions
+1 -1
View File
@@ -147,7 +147,7 @@ function merchant_buy_scan()
end
function merchant_sell_scan()
for slot in aux.util.inventory() do
for slot in inventory() do
local item_info = aux.info.container_item(unpack(slot))
if item_info then
g.aux_merchant_sell[item_info.item_id] = item_info.tooltip_money / item_info.aux_quantity
+2 -2
View File
@@ -41,7 +41,7 @@ do
end
function m.LOAD()
armor = aux.util.set(
armor = set(
'INVTYPE_HEAD',
'INVTYPE_NECK',
'INVTYPE_SHOULDER',
@@ -59,7 +59,7 @@ function m.LOAD()
'INVTYPE_HOLDABLE'
)
weapon = aux.util.set(
weapon = set(
'INVTYPE_2HWEAPON' ,
'INVTYPE_WEAPONMAINHAND',
'INVTYPE_WEAPON',
+1 -1
View File
@@ -72,7 +72,7 @@ function public.value(item_key)
local weighted_values = {}
local total_weight = 0
for _, data_point in item_record.data_points do
local weight = 0.99^aux.util.round((item_record.data_points[1].time - data_point.time) / (60*60*24))
local weight = 0.99^round((item_record.data_points[1].time - data_point.time) / (60*60*24))
total_weight = total_weight + weight
tinsert(weighted_values, {value = data_point.market_value, weight = weight})
end
+3 -3
View File
@@ -7,7 +7,7 @@ function process()
local stacking_complete
local send_signal, signal_received = aux.util.signal()
local send_signal, signal_received = signal()
aux.control.when(signal_received, function()
local slot = signal_received()[1]
if slot then
@@ -34,9 +34,9 @@ function post_auction(slot, k)
ClickAuctionSellItemButton()
ClearCursor()
StartAuction(max(1, aux.util.round(m.state.unit_start_price * item_info.aux_quantity)), aux.util.round(m.state.unit_buyout_price * item_info.aux_quantity), m.state.duration)
StartAuction(max(1, round(m.state.unit_start_price * item_info.aux_quantity)), round(m.state.unit_buyout_price * item_info.aux_quantity), m.state.duration)
local send_signal, signal_received = aux.util.signal()
local send_signal, signal_received = signal()
aux.control.when(signal_received, function()
m.state.posted = m.state.posted + 1
return k()
+6 -6
View File
@@ -38,7 +38,7 @@ do
end
function accessor.state()
local _, state = next(aux.util.filter(scan_states, function(state) return state.id == aux.control.thread_id end))
local _, state = next(filter(scan_states, function(state) return state.id == aux.control.thread_id end))
return state
end
end
@@ -48,7 +48,7 @@ function accessor.query()
end
function wait_for_callback(...)
local send_signal, signal_received = aux.util.signal()
local send_signal, signal_received = signal()
local suspended
local ret
@@ -154,10 +154,10 @@ function scan_page(i)
aux.history.process_auction(auction_info)
if aux.call(state.params.auto_buy_validator, auction_info) then
local send_signal, signal_received = aux.util.signal()
local send_signal, signal_received = signal()
aux.control.when(signal_received, recurse)
aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, aux.C(send_signal, true))
return aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux.C(send_signal, false))
return aux.control.thread(aux.control.when, later(GetTime(), 10), aux.C(send_signal, false))
elseif not query.validator or query.validator(auction_info) then
return wait_for_callback(state.params.on_auction, auction_info, function(removed)
if removed then
@@ -173,8 +173,8 @@ function scan_page(i)
end
function wait_for_results()
local timeout = aux.util.later(state.last_query_time, 10)
local send_signal, signal_received = aux.util.signal()
local timeout = later(state.last_query_time, 10)
local send_signal, signal_received = signal()
aux.control.when(signal_received, function()
if timeout() then
return submit_query()
+1 -1
View File
@@ -1,7 +1,7 @@
SLASH_AUX1 = '/aux'
function SlashCmdList.AUX(command)
if not command then return end
local arguments = aux.util.tokenize(command)
local arguments = tokenize(command)
if arguments[1] == 'clear' and arguments[2] == 'history' then
aux.persistence.load_dataset().history = nil
aux.log 'History cleared.'
+4 -4
View File
@@ -23,8 +23,8 @@ function locked(slot)
end
function find_item_slot(partial)
for slot in aux.util.inventory() do
if m.matching_item(slot, partial) and not aux.util.eq(slot, m.state.target_slot) then
for slot in inventory() do
if m.matching_item(slot, partial) and not eq(slot, m.state.target_slot) then
return slot
end
end
@@ -36,7 +36,7 @@ function matching_item(slot, partial)
end
function find_empty_slot()
for slot, type in aux.util.inventory() do
for slot, type in inventory() do
if type == 1 and not GetContainerItemInfo(unpack(slot)) then
return slot
end
@@ -44,7 +44,7 @@ function find_empty_slot()
end
function find_charge_item_slot()
for slot in aux.util.inventory() do
for slot in inventory() do
if m.matching_item(slot) and m.charges(slot) == m.state.target_size then
return slot
end
+2 -2
View File
@@ -117,7 +117,7 @@ function extend_tooltip(tooltip, link, quantity)
end
if g.aux_tooltip_daily then
local market_value = aux.history.market_value(item_key)
tooltip:AddLine('Today: '..(market_value and aux.money.to_string2(market_value * quantity)..' ('..aux.auction_listing.percentage_historical(aux.util.round(market_value / value * 100))..')' or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
tooltip:AddLine('Today: '..(market_value and aux.money.to_string2(market_value * quantity)..' ('..aux.auction_listing.percentage_historical(round(market_value / value * 100))..')' or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
end
end
@@ -241,7 +241,7 @@ end
function m.game_tooltip_hooks:SetAuctionSellItem()
local name, _, quantity, _, _, _ = GetAuctionSellItemInfo()
if name then
for slot in aux.util.inventory() do
for slot in inventory() do
local link = GetContainerItemLink(unpack(slot))
if link and ({aux.info.parse_link(link)})[5] == name then
m.extend_tooltip(GameTooltip, link, quantity)