Module:Sandbox/User:Artoire/1: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
Line 81:
 
local function _lookup_price_uncached(item)
local result = tonumber(mw.smw.ask{
('[[Sold item::%s]]'):format(item),
['?Shop buy price'] = 'buy',
['?Shop sell price'] = 'sell',
mainlabel = '-'
}[1][1])
return result or -1{
buy = tonumber(result.buy),
sell = tonumber(result.sell)
}
end
 
Line 189 ⟶ 193:
 
local remaining_xp = target_xp - current_xp
 
local buying_ores = args.ore_buy ~= 'no'
 
local buying_poles = args.pole_buy
Line 312 ⟶ 318:
:td{ '[[' .. weapon.name .. ']]', addClass = 'plinkt-link no-border' }
 
local cost = needed_ores * lookup_price(ingot.ore)[buying_ores and 'buy' or 'sell']
if chopping_logs then
--if Noneeded_logs extra costthen
cost = cost + needed_logs * lookup_price(pole_info.log).sell
end
elseif buying_logs then
if needed_logs then
cost = cost + needed_logs * lookup_price(pole_info.log).buy
end
else
if weapon.pole then
cost = cost + needed_poles * lookup_price(weapon.pole.name).buy
end
end
697

edits