Editing Module:Products

Jump to navigation Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.

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 }
:IF(recipe.passive)
: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')
:wikitext(('%s × [[File:%s.png|link=%s|18px]] [[%s]]'):format(item.quantity, item.name, item.name, item.name))
:IF(recipe.passive)
:wikitext(('%s (/hr) × [[File:%s.png|link=%s|18px]] [[%s]]'):format(item.displayQuantity, item.name, item.name, item.name))
:ELSE()
:wikitext(('%s × [[File:%s.png|link=%s|18px]] [[%s]]'):format(item.quantity, item.name, item.name, item.name))
:END()
:done()
:done()
end
end
Please note that all contributions to Brighter Shores Wiki are considered to be released under the CC BY-NC-SA 3.0 (see Brighter Shores:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template

This page is a member of a hidden category: