Editing Module:Products
Jump to navigation
Jump to search
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 78: | Line 78: | ||
table.sort(recipes, recipe_sort) |
table.sort(recipes, recipe_sort) |
||
-- if recipe is passive, want per hour |
|||
for _, recipe in ipairs(recipes) do |
|||
recipe.recipePerHour = recipe.duration and math.floor(3600/recipe.duration) |
|||
-- replace quantities with per-hour quantities |
|||
-- if recipe.passive then |
|||
for _,item in ipairs(recipe.output) do |
|||
item.displayQuantity = (item.quantity and recipe.recipePerHour and item.quantity * recipe.recipePerHour) or '' |
|||
end |
|||
for _,item in ipairs(recipe.materials) do |
|||
item.displayQuantity = (item.quantity and recipe.recipePerHour and item.quantity * recipe.recipePerHour) or '' |
|||
end |
|||
-- end |
|||
end |
|||
-- Calculate shop prices |
-- Calculate shop prices |
||
if showPrices then |
if showPrices then |
||
Line 142: | Line 128: | ||
:css{ ['border-right'] = '0', ['padding-right'] = '0' } |
:css{ ['border-right'] = '0', ['padding-right'] = '0' } |
||
:attr{ ['data-sort-value'] = recipe.output[1].name } |
:attr{ ['data-sort-value'] = recipe.output[1].name } |
||
: |
:wikitext(recipe.output[1].quantity .. ' ×') |
||
:wikitext(recipe.output[1].displayQuantity .. ' (/hr) ×') |
|||
:ELSE() |
|||
:wikitext(recipe.output[1].quantity .. ' ×') |
|||
:END() |
|||
:done() |
:done() |
||
:tag('td') |
:tag('td') |
||
Line 185: | Line 167: | ||
for _, item in ipairs(recipe.materials) do |
for _, item in ipairs(recipe.materials) do |
||
ingredients:tag('li') |
ingredients:tag('li') |
||
⚫ | |||
:IF(recipe.passive) |
|||
:wikitext(('%s (/hr) × [[File:%s.png|link=%s|18px]] [[%s]]'):format(item.displayQuantity, item.name, item.name, item.name)) |
|||
:ELSE() |
|||
⚫ | |||
:END() |
|||
:done() |
:done() |
||
end |
end |