Editing Module:Infobox Recipe

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 77: Line 77:
['Recipe JSON'] = mw.text.jsonEncode({
['Recipe JSON'] = mw.text.jsonEncode({
facility = args.facility,
xp = args.exp and tonumber(args.exp),
xp = args.exp and tonumber(args.exp),
kp = args.kp and tonumber(args.kp),
kp = args.kp and tonumber(args.kp),
duration = args.duration and tonumber(args.duration),
duration = args.duration,
materials = argsMaterials,
materials = argsMaterials,
profession = args.profession,
profession = args.profession,
passive = passive,
level = args.level and tonumber(args.level),
level = args.level and tonumber(args.level),
-- Make sure to update this when multiple outputs are supported
-- Make sure to update this when multiple outputs are supported
Line 109: Line 107:


-- display XP and duration totals for multi-step process
-- display XP and duration totals for multi-step process
args.fullXP = tonumber(args.exp) and searchResult.xp and searchResult.xp + tonumber(args.exp)
args.displayXP = tonumber(args.exp) and searchResult.xp and searchResult.xp + tonumber(args.exp)
args.displayDuration = tonumber(args.duration) and searchResult.duration and searchResult.duration + tonumber(args.duration)
args.displayDuration = tonumber(args.duration) and searchResult.duration and searchResult.duration + tonumber(args.duration)
Line 115: Line 113:
rawMaterials = argsMaterials
rawMaterials = argsMaterials
end
end
--If it is a passive recipe, will want to display the per-hour values for XP and materials used
args.recipePerHour = args.duration and math.floor(3600/args.duration)
args.displayXP = (tonumber(args.exp) and args.recipePerHour and tonumber(args.exp) * args.recipePerHour) or ''
args.displayOutput1qty = (args.output1qty and args.recipePerHour and args.output1qty * args.recipePerHour) or ''
--Simple query to get the shop buy price for the provided material, if no buy price is available returns 0
--Simple query to get the shop buy price for the provided material, if no buy price is available returns 0
Line 152: Line 145:
local materialBuyPrice = getBuyPrice(item) * (item.quantity or 1)
local materialBuyPrice = getBuyPrice(item) * (item.quantity or 1)
rawMaterialCost = rawMaterialCost + materialBuyPrice
rawMaterialCost = rawMaterialCost + materialBuyPrice
local displayQuantity = item.quantity or 1
if passive then
displayQuantity = displayQuantity and args.recipePerHour and displayQuantity * args.recipePerHour
end
return mw.html.create('tr')
return mw.html.create('tr')
:tag('td')
:tag('td')
Line 168: Line 157:
:css{ ['text-align'] = 'right' }
:css{ ['text-align'] = 'right' }
:wikitext(item.quantity or 1)
:wikitext(item.quantity or 1)
:IF(passive)
:wikitext('<br>( ' .. displayQuantity .. ' per hour)' )
:END()
:done()
:done()
:node(currency_cell(materialBuyPrice))
:node(currency_cell(materialBuyPrice))
Line 242: Line 228:
:IF(showFullRecipe)
:IF(showFullRecipe)
:wikitext(' (')
:wikitext(' (')
:wikitext(hc(args.fullXP) and (formatNum(tonumber(args.fullXP))) or ("'''?'''"))
:wikitext(hc(args.displayXP) and (formatNum(tonumber(args.displayXP))) or ("'''?'''"))
:wikitext(' total)')
:wikitext(' total)')
:END()
:IF(passive)
:wikitext(' (')
:wikitext(hc(args.displayXP) and (formatNum(tonumber(args.displayXP))) or ("'''?'''"))
:wikitext(' per hour)')
:END()
:END()
:done()
:done()
Line 282: Line 263:
:tag('th')
:tag('th')
:attr{ colspan = '5' }
:attr{ colspan = '5' }
:wikitext('[[Album|Album XP]] ')
:wikitext('[[Album|Album XP]]')
:node(tooltip._span{ 'album' })
:node(tooltip._div{ name = 'album', content = 'Album XP is a bonus awarded once for the first time the activity is performed.' })
:done()
:done()
:done()
:done()
Line 402: Line 381:
:css{ ['text-align'] = 'right' }
:css{ ['text-align'] = 'right' }
:wikitext(args.output1qty or 1)
:wikitext(args.output1qty or 1)
:IF(passive)
:wikitext('<br>( ' .. args.displayOutput1qty .. ' per hour)' )
:END()
:done()
:done()
:node(currency_cell(output1TotalValue))
:node(currency_cell(output1TotalValue))
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: