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
-- profit from selling the items
ifitem.material not= item.givesCoinsmaterial or then''
item.product = item.product or ''
item.product = item.product or ''
-- price of bait
-- 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.productmaterial .. ']][[Shop sellbuy price::!~N/A]]|?Shop sellbuy price=data|mainlabel=-')
if type(query)=='table' then
-- price is returned as a number
item.coinsbuy = 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.coinsbuy = 0
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
end
-- 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.coinsPerHourprofitPerHour = item.coinsprofit and item.productPerHour and math.floor(item.coinsprofit * item.productPerHour)
end
 
Line 90 ⟶ 104:
:tag('tr')
:tag('th')
:wikitext('[[File:MinerFisher small icon.png|15px]] Level')
:done()
:tag('th')
:attr{ colspan = '2' }
:wikitext('MiningFishing node')
:done()
:tag('th')
:attr{ colspan = '3' }
:wikitext('ProductBait')
:done()
:tag('th')
:attr{ colspan = '10' }
:wikitext('Quantity/hr')
:wikitext('Buy Value')
:done()
:tag('tdth')
: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' }
:wikitext('QuantityCoins/hrXP')
:done()
:done()
Line 133 ⟶ 164:
:END()
-- activityfishing node
: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()
-- productsbait (coins or items)
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'right' }
:attr{ ['data-sort-value'] = item.namematerial }
: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('0.9 × [[File:' .. item.productmaterial .. '.png|link=' .. item.productmaterial .. '|30x30px]]')
:done()
:tag('td')
:css{ ['border-left'] = '0', ['text-align'] = 'rightleft' }
:wikitext('[[' .. item.material .. ']]')
:done()
-- profit per hour (coins)
:node(currency_cell(item.coinsPerHourbuy))
-- 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' }
:addClass('plinkt-link no-border')
:wikitext('[[' .. item.product .. ']]')
:done()
-- economics
-- products per hour (items)
: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()
9,859

edits