Module:MinerPassiveList: Difference between revisions

m
condense table by omitting " (skill node)" from the displayed links to the skill nodes (link still goes to node)
(copy of merchant, but set up for only activities that produce items)
 
m (condense table by omitting " (skill node)" from the displayed links to the skill nodes (link still goes to node))
 
(3 intermediate revisions by the same user not shown)
Line 55:
-- iterate through products
for _, item in ipairs(results) do
 
-- profit from selling the items
--TESTING
item.productif =not item.product orgivesCoins ''then
-- protection against missing parameters
item.product = item.product or ''
-- query is: there is a shop object page that has this item AND has buy price cannot be "N/A"
local query = mw.smw.ask('[[Sold item::' .. item.product .. ']][[Shop sell price::!~N/A]]|?Shop sell price=data|mainlabel=-')
if type(query)=='table' then
-- price is returned as a number
item.coins = tonumber(query[1].data)*0.005 or 0
else
-- will return nil if the item is not in a shop, or if it is in a shop but can only be sold to the shop
item.coins = 0
end
end
-- no downtime for passives
item.productPerHour = item.duration and 1 / item.duration * 3600
Line 83 ⟶ 98:
:done()
:tag('th')
:attr{ colspan = '23' }
:wikitext('Product')
:done()
:tag('th')
:wikitext('Quantity/hr')
:done()
:tag('th')
:attr{ colspan = '10' }
:wikitext('Profit/hr')
:done()
:tag('th')
Line 120 ⟶ 139:
:addClass('plinkt-link no-border')
:attr{ ['data-sort-value'] = item.name }
:wikitext(' [[' .. item.Image .. '|link=' .. item.name .. '|30x30px]]')
:done()
:tag('td')
:addClass('plinkt-link no-border')
:wikitext('[[' .. item.name .. '|' .. item.product .. ']]')
:done()
-- products (coins or items)
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'right' }
:attr{ ['data-sort-value'] = item.name }
:wikitext('0.005 × ')
:done()
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'center' }
Line 138 ⟶ 162:
:done()
-- products per hour (coins or items)
:tag('td')
:css{ ['text-align'] = 'right' }
:wikitext('0.9 × [[File:' .. item.product .. '.png|link=' .. item.product .. '|30x30px]]')
:done()
-- profit per hour (coins)
:node(currency_cell(item.coinsPerHour))
 
-- XP
9,734

edits