big module refactoring
This commit is contained in:
@@ -114,7 +114,7 @@ function private.merchant_buy_scan()
|
||||
local _, _, price, count, stock = GetMerchantItemInfo(i)
|
||||
local link = GetMerchantItemLink(i)
|
||||
if link then
|
||||
local item_id = aux.info.parse_hyperlink(link)
|
||||
local item_id = aux.info.parse_link(link)
|
||||
local new_unit_price, new_limited = price / count, stock >= 0
|
||||
if _G.aux_merchant_buy[item_id] then
|
||||
local buy_info = aux.persistence.read(m.merchant_buy_schema, _G.aux_merchant_buy[item_id])
|
||||
|
||||
+3
-3
@@ -9,7 +9,7 @@ do
|
||||
for _, old_state in {scan_states[params.type]} do
|
||||
m.abort(old_state.id)
|
||||
end
|
||||
local thread_id = aux.control.thread(aux._(m.wait_for_callback, params.on_scan_start, m.scan))
|
||||
local thread_id = aux.control.thread(aux.C(m.wait_for_callback, params.on_scan_start, m.scan))
|
||||
scan_states[params.type] = {
|
||||
id = thread_id,
|
||||
params = params,
|
||||
@@ -156,8 +156,8 @@ function private.scan_page(i)
|
||||
if aux.call(m.state.params.auto_buy_validator, auction_info) then
|
||||
local send_signal, signal_received = aux.util.signal()
|
||||
aux.control.when(signal_received, recurse)
|
||||
aux.place_bid(auction_info.query_type, auction_info.index, auction_info.buyout_price, aux._(send_signal, true))
|
||||
return aux.control.thread(aux.control.when, aux.util.later(GetTime(), 10), aux._(send_signal, false))
|
||||
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))
|
||||
elseif not m.query.validator or m.query.validator(auction_info) then
|
||||
return m.wait_for_callback(m.state.params.on_auction, auction_info, function(removed)
|
||||
if removed then
|
||||
|
||||
@@ -43,8 +43,8 @@ function m.LOAD()
|
||||
end)
|
||||
end
|
||||
|
||||
function private.extend_tooltip(tooltip, hyperlink, quantity)
|
||||
local item_id, suffix_id = aux.info.parse_hyperlink(hyperlink)
|
||||
function private.extend_tooltip(tooltip, link, quantity)
|
||||
local item_id, suffix_id = aux.info.parse_link(link)
|
||||
quantity = IsShiftKeyDown() and quantity or 1
|
||||
|
||||
if _G.aux_tooltip_disenchant_source then
|
||||
@@ -83,7 +83,7 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
||||
local color = {r=0.1, g=0.6, b=0.6}
|
||||
|
||||
local disenchant_value = aux.disenchant.value(item_info.slot, item_info.quality, item_info.level)
|
||||
tooltip:AddLine('Disenchant Value: '..(disenchant_value and aux.money.format(disenchant_value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Disenchant Value: '..(disenchant_value and aux.money.to_string2(disenchant_value) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -93,7 +93,7 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
||||
|
||||
local _, price, limited = aux.cache.merchant_info(item_id)
|
||||
if price then
|
||||
tooltip:AddLine('Vendor Buy '..(limited and '(limited): ' or ': ')..aux.money.format(price * quantity), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Vendor Buy '..(limited and '(limited): ' or ': ')..aux.money.to_string2(price * quantity), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
if _G.aux_tooltip_vendor_sell then
|
||||
@@ -101,7 +101,7 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
||||
|
||||
local price = aux.cache.merchant_info(item_id)
|
||||
if price ~= 0 then
|
||||
tooltip:AddLine('Vendor Sell: '..(price and aux.money.format(price * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Vendor Sell: '..(price and aux.money.to_string2(price * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -113,11 +113,11 @@ function private.extend_tooltip(tooltip, hyperlink, quantity)
|
||||
local value = aux.history.value(item_key)
|
||||
if auctionable then
|
||||
if _G.aux_tooltip_value then
|
||||
tooltip:AddLine('Value: '..(value and aux.money.format(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
tooltip:AddLine('Value: '..(value and aux.money.to_string2(value * quantity) or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
if _G.aux_tooltip_daily then
|
||||
local market_value = aux.history.market_value(item_key)
|
||||
tooltip:AddLine('Today: '..(market_value and aux.money.format(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(aux.util.round(market_value / value * 100))..')' or GRAY_FONT_COLOR_CODE..'---'..FONT_COLOR_CODE_CLOSE), color.r, color.g, color.b)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -243,7 +243,7 @@ function m.game_tooltip_hooks:SetAuctionSellItem()
|
||||
if name then
|
||||
for slot in aux.util.inventory() do
|
||||
local link = GetContainerItemLink(unpack(slot))
|
||||
if link and ({aux.info.parse_hyperlink(link)})[5] == name then
|
||||
if link and ({aux.info.parse_link(link)})[5] == name then
|
||||
m.extend_tooltip(GameTooltip, link, quantity)
|
||||
return
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user