Module:FisherPassiveList: Difference between revisions

m
condense table by omitting " (skill node)" from the displayed links to the skill nodes (link still goes to node)
(starting copy of miner, needs a lot of data checking)
 
m (condense table by omitting " (skill node)" from the displayed links to the skill nodes (link still goes to node))
 
(4 intermediate revisions by the same user not shown)
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, 0.1 is for the crate
item.coinsbuy = (0.1+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<br>Value')
:done()
:tag('tdth')
:attr{ colspan = '3' }
:wikitext('Quantity/hrFish')
:done()
:tag('th')
:attr{ colspan = '10' }
:wikitext('Sell<br>Value')
:done()
:tag('th')
:attr{ colspan = '10' }
:wikitext('Profit')
:done()
:tag('th')
Line 113 ⟶ 140:
:wikitext('XP/hr')
:done()
-- :tag('th')
-- :attr{ colspan = '10' }
-- :wikitext('Coins/XP')
-- :done()
:done()
 
Line 133 ⟶ 164:
:END()
-- activityfishing node
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'right', ['max-width'] = '100px' }
Line 142 ⟶ 173:
:tag('td')
:addClass('plinkt-link no-border')
:wikitext('[[' .. item.name .. '|' .. item.product ..']]')
:done()
-- productsbait (coins or items)
:tag('td')
:css{ ['border-right'] = '0', ['text-align'] = 'right' }
:attr{ ['data-sort-value'] = item.namematerial }
:wikitext(' 0.005 &times; ')
:done()
:tag('td')
:css{ ['border-right'] = '0', ['border-left'] = '0', ['text-align'] = 'center', ['max-width'] = '100px' }
:addClass('plinkt-link no-border')
:wikitext('0.9 &times; [[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 &times; ')
: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 &times; [[File:' .. item.product .. '.png|link=' .. item.product .. '|30x30px]]')
:done()
-- profit per hour (coins)
:node(currency_cell(item.coinsPerHour))
 
-- XP
Line 187 ⟶ 233:
:node(unknown_value_cell)
:END()
-- coins per xp
-- :node(currency_cell(item.profitPerXP))
 
:done()
9,734

edits