Module:WoodcutterList: Difference between revisions
m
profit per xp not used
(correctly parses coop and solo activities separately) |
m (profit per xp not used) |
||
(One intermediate revision by the same user not shown) | |||
Line 1:
require('strict')
require('Module:Mw.html extension')
local lang = mw.getContentLanguage()
local plist = require('Module:ProfessionList')
local rts = require('Module:RecipeTreeSearch')
local p = {}
Line 10:
function p.main()
local queryString = '[[Category:Woodcutter]] AND [[Category:Pages with activities]]'
local
return not item.passive
end
local results = plist.generate_recipe_table(queryString,screenFunction)
results = p.formatResults(results)
Line 40 ⟶ 27:
end
-- do calculations and determine strings to go in cells
function p.formatResults(results)
--simple check for nil results
return nil
end
-- iterate through products
for _, item in ipairs(results) do
-- detect brambles
item.
-- profitability
item.
-- DOWNTIME VERY IMPORTANT FOR GATHERING TYPE PROFESSIONS
Line 138 ⟶ 50:
-- properties per hour
item.
item.profitPerHour = item.profit and item.productPerHour and math.floor(item.profit * item.productPerHour)
end
Line 147 ⟶ 59:
-- make the table
function p.displayTable(results)
--simple check for nil results
if results ==nil or results[1] == nil then
return 'No data found for table'
end
local out = mw.html.create('table')
:addClass('wikitable sortable')
Line 179 ⟶ 97:
:done()
:done()
for i, item in ipairs(results) do
Line 189 ⟶ 102:
--level
:IF(item.
:tag('td')
:css{ ['text-align'] = 'center' }
:wikitext(item.
:done()
:ELSE()
:node(plist.unknown_value_edit_cell(item.pageName,1))
:END()
-- gathering node
:node(plist.two_column_image_text(item.pageName,item.pageImage,item.pageName,item.pageName))
-- resource
:IF(item.
:tag('td')
:addClass('table-na')
Line 217 ⟶ 122:
:done()
:ELSE()
:
:node(plist.two_column_image_text(item.product,'File:' .. item.product .. '.png',item.product .. ' (co-op)',item.product))
:ELSE()
:
:
-- resource/hr
:IF(item.productPerHour)
Line 236 ⟶ 134:
:done()
:ELSE()
:node(
:END()
-- economics
:node(plist.currency_cell(item.profit))
:node(plist.currency_cell(item.profitPerHour))
:END()
-- XP
:IF(item.
:tag('td')
:wikitext(item.
:done()
:ELSE()
:node(plist.unknown_value_edit_cell(item.pageName,1))
:END()
-- XP per hour
:IF(item.
:tag('td')
:wikitext(item.
:done()
:ELSE()
:node(plist.unknown_value_cell(1))
:END()
|