Editing Module:RecipeTable
From Eco - English Wiki
Your changes will be displayed to readers once an authorized user accepts them. (help)
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 1: | Line 1: | ||
-- Module:RecipeTable https://wiki.play.eco/en/Module:RecipeTable | |||
local p = {} | local p = {} | ||
local Utils = require("Module:Utils") | local Utils = require("Module:Utils") | ||
local L = require("Module:Localization") | local L = require("Module:Localization") | ||
Line 14: | Line 16: | ||
headerStr = headerStr .. '! colspan=\"4\" | ' .. L.t('Item') .. ' !! colspan=\"4\" | ' .. L.t('Materials') .. ' !! ' .. L.t('Level Needed') .. ' !! ' .. L.t('Crafting Time<br>(mins)') .. ' !! ' .. L.t('Labour Cost') .. ' || ' .. L.t('XP Gained') .. ' !!\n' | headerStr = headerStr .. '! colspan=\"4\" | ' .. L.t('Item') .. ' !! colspan=\"4\" | ' .. L.t('Materials') .. ' !! ' .. L.t('Level Needed') .. ' !! ' .. L.t('Crafting Time<br>(mins)') .. ' !! ' .. L.t('Labour Cost') .. ' || ' .. L.t('XP Gained') .. ' !!\n' | ||
return headerStr | return headerStr | ||
end | |||
function imagedisp(name, nameEN, style, borderColour) | |||
local borderImageClass = '' | |||
local icon | |||
if borderColour == 'green' then | |||
borderImageClass = ' borderGreen' | |||
elseif borderColour == 'yellow' then | |||
borderImageClass = ' borderYellow' | |||
end | |||
local iconBG | |||
if style == 'tag' then | |||
iconBG = 'iconGrey' | |||
icon = L.tag(name) .. 'Tag' | |||
name = L.t('%s Tag'):format(name) | |||
elseif style == 'skill' then | |||
iconBG = 'iconBrightBlue' | |||
icon = nameEN | |||
end | |||
if not icon then | |||
icon = name | |||
end | |||
return Utils.build_icon(icon, name, 'iconRecipe', iconBG, borderImageClass, true) .. '\n[[' .. name .. ']]' | |||
end | end | ||
function stationcell(args) | function stationcell(args) | ||
local str = '' | local str = '' | ||
str = str .. '| | str = str .. '| ' .. imagedisp(args[1], args[2]) | ||
return str | return str | ||
end | end | ||
Line 24: | Line 52: | ||
function itemcell(args) | function itemcell(args) | ||
local str = '' | local str = '' | ||
str = str .. '| | str = str .. '| ' .. imagedisp(args[1], args[3]) | ||
str = str .. '<br>x' .. args[2] .. '\n' | |||
return str | return str | ||
end | end | ||
Line 41: | Line 70: | ||
style = nil | style = nil | ||
end | end | ||
return str .. '| ' .. imagedisp(args[2], args[5], style, borderColour) .. '<br>x' .. args[3] .. '\n' | |||
end | end | ||
function skillreqcell(args) | function skillreqcell(args) | ||
local str = '' | local str = '' | ||
str = str .. '| | str = str .. '| ' .. imagedisp(args[1], args[3], 'skill') | ||
str = str .. '<br> ' .. L.t('Level') .. ' ' .. args[2] .. ' \n' | |||
return str | return str | ||
end | end | ||
Line 62: | Line 84: | ||
--function groupedskillcell( args ) | --function groupedskillcell( args ) | ||
-- local str = '' | -- local str = '' | ||
-- str = str .. '| ' .. args[1] | -- str = str .. '| ' .. imagedisp(args[1],args[3]) | ||
-- if args[2] ~= nil then | -- if args[2] ~= nil then | ||
-- str = str .. ' <br> ' .. args[2] | -- str = str .. ' <br> ' .. imagedisp(args[2]) | ||
-- end | -- end | ||
-- return str | -- return str |