Module:FisherPassiveList: Difference between revisions
cost of bait and price of fish, acts more like a recipe than a passive node
(starting copy of miner, needs a lot of data checking) |
(cost of bait and price of fish, acts more like a recipe than a passive node) |
||
Line 22:
'?Activity coins = coins',
'?Skill node name = product',
'?Activity input #- = material',
'sort = Profession Level A',
'limit = 500'
Line 56 ⟶ 57:
for _, item in ipairs(results) do
--catch badly submitted data
▲ item.product = item.product or ''
-- price of bait
end▼
end
-- price of fish
-- 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.sell = 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.sell = 0
-- profitability
item.profit = item.buy and item.sell and item.sell - item.buy
item.profitPerXP = item.profit and item.XP and item.profit / item.XP
-- no downtime for passives
Line 78 ⟶ 92:
-- properties per hour
item.XPPerHour = item.XP and item.productPerHour and math.floor(item.XP * item.productPerHour)
item.
end
Line 90 ⟶ 104:
:tag('tr')
:tag('th')
:wikitext('[[File:
:done()
:tag('th')
:attr{ colspan = '2' }
:wikitext('
:done()
:tag('th')
:attr{ colspan = '3' }
:wikitext('
:done()
:tag('th')
:attr{ colspan = '10' }
:wikitext('Quantity/hr')▼
:wikitext('Buy Value')
:attr{ colspan = '3' }
:wikitext('Fish')
:done()
:tag('th')
:attr{ colspan = '10' }
:wikitext('Sell Value')
:done()
:tag('th')
:attr{ colspan = '10' }
:wikitext('Profit')
:done()
:tag('th')
Line 112 ⟶ 139:
:tag('th')
:wikitext('XP/hr')
:done()
:tag('th')
:attr{ colspan = '10' }
:done()
:done()
Line 133 ⟶ 164:
:END()
--
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'right', ['max-width'] = '100px' }
Line 141 ⟶ 172:
:done()
:tag('td')
:addClass('plinkt-link no-border')▼
:wikitext('[[' .. item.name .. ']]')
:done()
--
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'right' }
:attr{ ['data-sort-value'] = item.
:wikitext(' 0.005 × ')
:done()
:tag('td')
:css{ ['border-right'] = '0', ['border-left'] = '0', ['text-align'] = 'center', ['max-width'] = '100px' }
▲ :addClass('plinkt-link no-border')
:wikitext('
:done()
:tag('td')
:wikitext('[[' .. item.material .. ']]')
:done()
-- profit per hour (coins)▼
-- fish
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'right' }
:attr{ ['data-sort-value'] = item.product }
:wikitext('0.005 × ')
:done()
:tag('td')
:css{ ['border-right'] = '0', ['border-left'] = '0', ['text-align'] = 'center', ['max-width'] = '100px' }
:addClass('plinkt-link no-border')
:wikitext('[[File:' .. item.product .. '.png|link=' .. item.product .. '|30x30px]]')
:done()
:tag('td')
:css{ ['border-left'] = '0', ['text-align'] = 'left' }
:wikitext('[[' .. item.product .. ']]')
:done()
-- economics
:node(currency_cell(item.sell))
▲ :tag('td')
:node(currency_cell(item.profit))
▲ :css{ ['text-align'] = 'right' }
:node(currency_cell(item.profitPerHour))
▲ :wikitext('0.9 × [[File:' .. item.product .. '.png|link=' .. item.product .. '|30x30px]]')
▲ :done()
▲ -- profit per hour (coins)
▲ :node(currency_cell(item.coinsPerHour))
-- XP
Line 187 ⟶ 232:
:node(unknown_value_cell)
:END()
-- coins per xp
:node(currency_cell(item.profitPerXP))
:done()
|