Module:GathererList: Difference between revisions
m
add purge link
m (spacing around images) |
Californ1a (talk | contribs) m (add purge link) |
||
(4 intermediate revisions by one other user not shown) | |||
Line 1:
require('strict')
require('Module:Mw.html extension')
local lang = mw.getContentLanguage()
local plist = require('Module:ProfessionList')
local purge = require('Module:Purge')._purge
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
-- 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
for _, item in ipairs(results) do
-- downtime is very important for gathering-type professions
-- initial values, it will be obvious if these get used
item.
item.
-- these numbers are based roughly on how far the nodes are from a storage rift or shop or bank
--
-- duration and relocation times arent used for fisher, only respawn time and number of nodes
if string.find(item.pageName,'Globeplant') then
item.downtime = 40
item.nodes = 8
elseif string.find(item.pageName,'Dandelion') then
item.downtime = 20
item.nodes = 8
elseif string.find(item.pageName,'Goat Horn') then
item.downtime = 60
item.nodes = 8
elseif string.find(item.pageName,'Apple') then
item.downtime = 80
item.nodes = 6
elseif string.find(item.pageName,'Leek') then
item.downtime = 40
item.nodes = 8
elseif string.find(item.pageName,'Haleberries') then
item.downtime = 50 -- portal back after depositing
item.nodes = 8
elseif string.find(item.pageName,'Rams Horn') then
item.downtime = 100
item.nodes = 8
elseif string.find(item.pageName,'Bitterfruit') then
item.downtime = 160 -- cannot be banked, must be sold
item.nodes = 8
elseif string.find(item.pageName,'Chestnut') then
item.downtime = 80
item.nodes = 6
elseif string.find(item.pageName,'Bone Spike') then
item.downtime = 0
item.nodes = 8
elseif string.find(item.pageName,'Tangfruit') then
item.downtime = 150 -- cannot be banked, must be sold
item.nodes = 6
elseif string.find(item.pageName,'Catkin') then
item.downtime = 60
item.nodes = 6
elseif string.find(item.pageName,'Femur Shard') then
item.downtime = 80
item.nodes = 8
elseif string.find(item.pageName,'Clover') then
item.downtime = 40
item.nodes = 8
elseif string.find(item.pageName,'Snake Scale') then
item.downtime = 60
item.nodes = 8
elseif string.find(item.pageName,'Orchid') then
item.downtime = 60
item.nodes = 8
elseif string.find(item.pageName,'Dock Leaf') then
item.downtime = 80 -- portal back after depositing
item.nodes = 8
elseif string.find(item.pageName,'Sage') then
item.downtime = 120 -- portal to deposit then run back
item.nodes = 6
elseif string.find(item.pageName,'Thistle') then
item.downtime = 100
item.nodes = 6
end
-- profitability
item.
-- products per hour
item.batch = 24
item.
item.productPerHour = item.durationEffective and math.floor(1 / (item.durationEffective + item.downtime / item.batch) * 3600)
item.productPerHourDropping = item.durationEffective and 1 / (item.durationEffective) * 3600
-- properties per hour
item.
item.xpPerHourDropping = item.xp and item.productPerHourDropping and math.floor(item.xp * item.productPerHourDropping)
item.profitPerHour = item.profit and item.productPerHour and math.floor(item.profit * item.productPerHour)
end
Line 90 ⟶ 125:
-- 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')
:tag('caption')
:wikitext('This list is updated dynamically. '..purge())
:done()
:tag('tr')
:tag('th')
:wikitext('[[File:
:done()
:tag('th')
:attr{ colspan = '2' }
:wikitext('Node')
:done()
:tag('th')
:attr{ colspan = '2' }
:wikitext('
:done()
:tag('th')
Line 120 ⟶ 168:
:tag('th')
:wikitext('XP/hr')
:done()
:tag('th')
:wikitext('XP/hr<br>(Discarding)')
:done()
:done()
for i, item in ipairs(results) do
Line 132 ⟶ 178:
--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))
:
:
:tag('td')
:addClass('
:attr{ colspan = '2' }
:
:done()
:END()
-- resource
:node(plist.two_column_image_text(item.product,'File:' .. item.product .. '.png',item.product,item.product))
-- resource/hr
Line 169 ⟶ 209:
: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.xp and lang:formatNum(tonumber(item.xp)))
:done()
:ELSE()
:node(plist.unknown_value_edit_cell(item.pageName,1))
:END()
-- XP per hour
:IF(item.xpPerHour)
:tag('td')
:wikitext(item.
:done()
:ELSE()
:node(plist.unknown_value_cell(1))
:END()
-- XP per hour
:IF(item.
:tag('td')
:wikitext(item.
:done()
:ELSE()
:node(plist.unknown_value_cell(1))
:END()
|