Module:GathererList: Difference between revisions
offload much of the search, screen, and format functions to the new ProfessionList module, so they work the same for all tables
m (spacing around images) |
(offload much of the search, screen, and format functions to the new ProfessionList module, so they work the same for all tables) |
||
Line 1:
require('strict')
require('Module:Mw.html extension')
local param = require( 'Module:Paramtest' )▼
local currency = require('Module:Currency')▼
local lang = mw.getContentLanguage()
local p = {}
Line 10:
function p.main()
local queryString = '[[Category:Gatherer]] AND [[Category:Pages with activities]]'
local
return not item.passive
end▼
local results = plist.generate_recipe_table(queryString,screenFunction)
▲ }
results = p.formatResults(results)
Line 34 ⟶ 25:
--return '<pre>'..mw.text.jsonEncode(results, mw.text.JSON_PRETTY)..'</pre>'
▲ end
end
-- do calculations and determine strings to go in cells
function p.formatResults(results)
--simple check for nil results
if results ==nil or results[1] == nil then
return nil
▲ end
-- iterate through products
Line 57 ⟶ 39:
--catch badly submitted data
item.product = item.product or ''
item.
-- profitability
item.
item.profitPerXP = item.profit and item.xp and item.profit / item.xp
-- DOWNTIME VERY IMPORTANT FOR GATHERING TYPE PROFESSIONS
Line 81 ⟶ 52:
-- properties per hour
item.
item.profitPerHour = item.profit and item.productPerHour and math.floor(item.profit * item.productPerHour)
end
Line 90 ⟶ 61:
-- 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'
local out = mw.html.create('table')
:addClass('wikitable sortable')
Line 132 ⟶ 109:
--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
:node(plist.two_column_image_text(item.product,'File:' .. item.product .. '.png',item.product,item.product))
-- resource/hr
Line 169 ⟶ 130:
:done()
:ELSE()
:node(plist.unknown_value_edit_cell(item.pageName,1))
:END()
-- economics
:node(plist.currency_cell(item.profit))
:node(plist.currency_cell(item.profitPerHour))
-- 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()
|