Ouvrir le menu principal

Modifications

Module:IU

4 470 octets ajoutés, 24 décembre 2016 à 01:17
m
ObelusPA2 a déplacé la page Module:MAJ/IU vers Module:IU sans laisser de redirection : Déploiement du nouveau module
local slot = require( [[Module:Case inventaire]] ).slot
local addSlot = function( args, item, prefix, class, default )
prefix = prefix or item
return slot{
args[item], mod = args.Mod, link = args[prefix .. 'link'],
title = args[prefix .. 'title'], class = class, default = default,
parsed = args.parsed
}
end

local p = {}

-- Établi
function p.craftingTable( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
else
f = mw.getCurrentFrame()
end

local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Crafting_Table' )

local input = body:tag( 'span' ):addClass( 'mcui-input' )
for num = 1, 3 do
local row = input:tag( 'span' ):addClass( 'mcui-row' )
for _, letter in ipairs{ 'A', 'B', 'C' } do
row:wikitext( addSlot( args, letter .. num ) )
end
end

local arrow = body:tag( 'span' ):addClass( 'mcui-arrow' ):tag( 'br' ):done()
if args.arrow or '' ~= '' then
arrow:css(
'background-image',
'{{FileUrl|' .. args.arrow .. ' (' .. args.Mod .. ').png}}'
)
end

body
:tag( 'span' )
:addClass( 'mcui-output' )
:wikitext( addSlot( args, 'résultat', 'O', 'invslot-large' ) )

local shapeless = args.shapeless or ''
local fixed = args.fixed or ''
if shapeless ~= '' or fixed ~= '' then
local icon = body:tag( 'span' )
:addClass( 'mcui-icons' )
:tag( 'span' )
:tag( 'br' )
:done()
if shapeless ~= '' then
icon:addClass( 'mcui-shapeless' )
:attr( 'title',
'Les ingrédients peuvent être placés partout sur la grille.'
)
elseif fixed ~= '' then
local notFixed = args.notfixed or ''
local exceptFixed = ''
if notFixed ~= '' then
exceptFixed = ', à l\'exeption de ' .. notFixed .. ', qui peut être placé n\'importe où'
end

icon:addClass( 'mcui-fixed' )
:attr( 'title',
'Cette recette est fixe, la disposition des ingrédients ne peut pas être modifiée ou inversée' .. exceptFixed .. '.'
)
end
end

return tostring( mw.html.create( 'div' ):node( body ) )
end

-- Fourneau
function p.furnace( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
else
f = mw.getCurrentFrame()
end

local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Furnace' )

local input = body:tag( 'span' ):addClass( 'mcui-input' )
input:wikitext( addSlot( args, 'ingrédient', 'I' ) )
local fuel = input:tag( 'span' ):addClass( 'mcui-fuel' ):tag( 'br' ):done()
local fuelImg = args.FuelUsage or ''
local burning = args['ingrédient'] or '' ~= '' and args.combustible or '' ~= ''
if not burning then
fuel:addClass( 'mcui-inactive' )
if fuelImg ~= '' then
fuelImg = fuelImg .. ' (in-active)'
end
end
if fuelImg ~= '' then
fuel:css(
'background-image',
'{{FileUrl|' .. fuelImg .. ' (' .. args.mod .. ').png}}'
)
end
input:wikitext( addSlot( args, 'combustible', 'F' ) )

local arrow = body:tag( 'span' ):addClass( 'mcui-arrow' ):tag( 'br' ):done()
local arrowImg = args.Progress or ''
if not burning or ( args['résultat'] or '' ) == '' then
arrow:addClass( 'mcui-inactive' )
if arrowImg ~= '' then
arrowImg = arrowImg .. ' (in-active)'
end
end
if arrowImg ~= '' then
arrow:css(
'background-image',
'{{FileUrl|' .. arrowImg .. ' Progress (' .. args.mod .. ').png}}'
)
end

body
:tag( 'span' )
:addClass( 'mcui-output' )
:wikitext( addSlot( args, 'résultat', 'O', 'invslot-large' ) )

return tostring( mw.html.create( 'div' ):node( body ) )
end

-- Alambic
function p.brewingStand( f )
local args = f
if f == mw.getCurrentFrame() then
args = f:getParent().args
else
f = mw.getCurrentFrame()
end

local body = mw.html.create( 'span' ):addClass( 'mcui mcui-Brewing_Stand' )

local input = body:tag( 'span' ):addClass( 'mcui-input' )
input:tag( 'span' ):addClass( 'mcui-bubbling' ):tag( 'br' )
input:wikitext( addSlot( args, 'ingrédient', 'I' ) )
input:tag( 'span' ):addClass( 'mcui-arrow' ):tag( 'br' )
if ( args['ingrédient'] or '' ) == '' or
( ( args['résultat1'] or '' ) == '' and ( args['résultat2'] or '' ) == '' and ( args['résultat3'] or '' ) == '' )
then
input:addClass( 'mcui-inactive' )
end

body:tag( 'span' ):addClass( 'mcui-paths' ):tag( 'br' )

local output = body:tag( 'span' ):addClass( 'mcui-output' )
for i = 1, 3 do
output:wikitext( addSlot( args, 'résultat' .. i, 'O' .. i, 'mcui-output' .. i ) )
end

return tostring( mw.html.create( 'div' ):node( body ) )
end

return p
Utilisateur anonyme