Module:ProfessionList: Difference between revisions
Jump to navigation
Jump to search
Content added Content deleted
mNo edit summary |
No edit summary |
||
Line 1: | Line 1: | ||
local currency = require('Module:Currency') |
local currency = require('Module:Currency') |
||
local search = require('Module:RecipeTreeSearch') |
|||
local p = {} |
local p = {} |
||
Line 101: | Line 102: | ||
end |
end |
||
end |
|||
-- if none of the pages had recipes of activities, skip the rest of this function |
|||
if recipes == nil or recipes[1] == nil then |
|||
return nil |
|||
end |
end |
||
Line 111: | Line 117: | ||
table.insert(output,item) |
table.insert(output,item) |
||
end |
end |
||
end |
|||
-- if all of the results were screened, skip the rest of this function |
|||
if output == nil or output[1] == nil then |
|||
return nil |
|||
end |
end |
||
Line 127: | Line 138: | ||
return item1.level < item2.level |
return item1.level < item2.level |
||
end) |
end) |
||
-- perform a number of useful calculations on the data that are widely useful |
|||
-- like cost of materials, profit of products, recipe tree search |
|||
for _,item in ipairs(output) do |
|||
item.product = item.output[1].name or '' |
|||
-- perform the full recipe tree search on the product |
|||
local fullRecipe = search.main(item.product) |
|||
-- overwrite any parameters from the original recipe with their counterparts from the full recipe |
|||
-- when product is nil, no data is overwritten |
|||
for key,value in pairs(fullRecipe) do |
|||
item[key] = value |
|||
end |
|||
-- include the price of selling the product |
|||
item.sellPrice = search.getShopSellPrice(item.product) |
|||
end |
|||
return output |
return output |
||
Line 132: | Line 162: | ||
end |
end |
||
function p.two_column_image_text(sort,image,text,link) |
|||
return mw.html.create('td') |
|||
:css{ ['border-right'] = '0', ['text-align'] = 'right', ['max-width'] = '100px' } |
|||
:attr{ ['data-sort-value'] = sort } |
|||
:wikitext(' [[' .. image .. '|link=' .. link .. '|30x30px]]') |
|||
:done() |
|||
:tag('td') |
|||
:addClass('plinkt-link no-border') |
|||
:wikitext('[[' .. link .. '|' .. text ..']]') |
|||
:done() |
|||
end |
|||
function p.three_column_image_text(sort,quantity,image,text,link) |
|||
return mw.html.create('td') |
|||
:css{ ['border-right'] = '0', ['padding-right'] = '0', ['text-align'] = 'right' } |
|||
:attr{ ['data-sort-value'] = sort } |
|||
:wikitext(quantity .. ' ×') |
|||
:done() |
|||
:tag('td') |
|||
:addClass('plinkt-image no-border') |
|||
:css{ ['border-left'] = '0', ['padding-left'] = '0' } |
|||
:wikitext('[[File:' .. image .. '.png|link=' .. link .. '|30px]]') |
|||
:done() |
|||
:tag('td') |
|||
:addClass('plinkt-link no-border') |
|||
:wikitext('[[' .. link .. '|' .. text .. ']]') |
|||
:done() |
|||
end |
|||
return p |
return p |