mAucun résumé des modifications |
Aucun résumé des modifications |
||
(5 versions intermédiaires par 2 utilisateurs non affichées) | |||
Ligne 4 : | Ligne 4 : | ||
colored = 'coloré', |
colored = 'coloré', |
||
coloredDyes = { |
coloredDyes = { |
||
− | + | 'Teinture orange', 'Teinture magenta', 'Teinture bleu clair', 'Teinture jaune', 'Teinture vert clair', |
|
'Teinture rose', 'Teinture grise', 'Teinture gris clair', 'Teinture cyan', 'Teinture violette', |
'Teinture rose', 'Teinture grise', 'Teinture gris clair', 'Teinture cyan', 'Teinture violette', |
||
− | + | 'Teinture bleue', 'Teinture marron', 'Teinture verte', 'Teinture rouge', 'Teinture noire', |
|
}, |
}, |
||
categoryIngredientUsage = 'Catégorie:Recette utilisant $1', |
categoryIngredientUsage = 'Catégorie:Recette utilisant $1', |
||
categoryRecipeType = 'Catégorie:Recette $1', |
categoryRecipeType = 'Catégorie:Recette $1', |
||
categoryUpcoming = 'Catégorie:Fonctionnalité à venir', |
categoryUpcoming = 'Catégorie:Fonctionnalité à venir', |
||
− | itemBlockOfQuartz = ' |
+ | itemBlockOfQuartz = 'Bloc de quartz', |
⚫ | |||
− | itemBoneMeal = 'poudre d\'os', |
||
+ | itemCharcoal = 'Charbon de bois', |
||
⚫ | |||
− | + | itemCoal = 'Charbon', |
|
+ | itemColoredDye = 'Teinture colorée', |
||
− | itemCoal = 'charbon', |
||
− | + | itemDye = 'Teinture', |
|
− | + | itemMushroom = 'Champignon', |
|
⚫ | |||
− | itemMushroom = 'champignon', |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
+ | itemWhiteDye = 'Teinture blanche', |
||
⚫ | |||
moduleArgs = [[Module:ProcessArgs]], |
moduleArgs = [[Module:ProcessArgs]], |
||
moduleRecipe = [[Module:Tableau de recette]], |
moduleRecipe = [[Module:Tableau de recette]], |
||
moduleSlot = [[Module:Case inventaire]], |
moduleSlot = [[Module:Case inventaire]], |
||
− | stoneVariants = { ' |
+ | stoneVariants = { 'Roche', 'Andésite', 'Granite', 'Diorite' }, |
type = 'Fabrication', |
type = 'Fabrication', |
||
variantPages = { |
variantPages = { |
||
Ligne 153 : | Ligne 153 : | ||
-- List each dye individually as they have their own pages |
-- List each dye individually as they have their own pages |
||
if |
if |
||
− | name |
+ | name == slot.i18n.prefixes.any .. ' ' .. i18n.itemDye or |
− | name |
+ | name == slot.i18n.prefixes.matching .. ' ' .. i18n.itemDye or |
− | name |
+ | name == slot.i18n.prefixes.any .. ' ' .. i18n.itemColoredDye or |
− | name |
+ | name == slot.i18n.prefixes.matching .. ' ' .. i18n.itemColoredDye |
then |
then |
||
if not name:find( i18n.colored ) then |
if not name:find( i18n.colored ) then |
||
− | categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', |
+ | categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', i18n.itemWhiteDye ) .. ']]' |
cI = cI + 1 |
cI = cI + 1 |
||
− | usedNames[i18n. |
+ | usedNames[i18n.itemWhiteDye] = true |
end |
end |
||
for _, dye in pairs( i18n.coloredDyes ) do |
for _, dye in pairs( i18n.coloredDyes ) do |
||
− | categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', |
+ | categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', dye ) .. ']]' |
cI = cI + 1 |
cI = cI + 1 |
||
usedNames[dye] = true |
usedNames[dye] = true |
||
Ligne 175 : | Ligne 175 : | ||
then |
then |
||
for _, stone in pairs( i18n.stoneVariants ) do |
for _, stone in pairs( i18n.stoneVariants ) do |
||
− | categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', |
+ | categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', stone ) .. ']]' |
cI = cI + 1 |
cI = cI + 1 |
||
usedNames[stone] = true |
usedNames[stone] = true |
||
Ligne 182 : | Ligne 182 : | ||
-- Merge item variants which use a single page |
-- Merge item variants which use a single page |
||
if |
if |
||
− | name |
+ | name == slot.i18n.prefixes.any .. ' ' .. i18n.itemMushroom or |
− | name |
+ | name == slot.i18n.prefixes.matching .. ' ' .. i18n.itemMushroom or |
name == i18n.itemRedMushroom or |
name == i18n.itemRedMushroom or |
||
name == i18n.itemBrownMushroom |
name == i18n.itemBrownMushroom |
||
Ligne 201 : | Ligne 201 : | ||
if name:find( '^' .. prefix .. ' ' ) then |
if name:find( '^' .. prefix .. ' ' ) then |
||
name = name:gsub( '^' .. prefix .. ' ', '' ) |
name = name:gsub( '^' .. prefix .. ' ', '' ) |
||
− | break |
||
− | end |
||
− | end |
||
− | -- Remove suffixes |
||
− | for _, suffix in pairs( slot.i18n.suffixes ) do |
||
− | if name:find( ' ' .. suffix .. '$' ) then |
||
− | name = name:gsub( ' ' .. suffix .. '$', '' ) |
||
break |
break |
||
end |
end |
||
Ligne 214 : | Ligne 207 : | ||
if not usedNames[name] then |
if not usedNames[name] then |
||
− | categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', |
+ | categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', name ) .. ']]' |
cI = cI + 1 |
cI = cI + 1 |
||
usedNames[name] = true |
usedNames[name] = true |
Version du 24 avril 2020 à 14:49
[créer | historique | purger]Documentation
Ce module n'a pas de documentation. Si vous savez comment l'utiliser, merci de la créer.local p = {}
local i18n = {
colored = 'coloré',
coloredDyes = {
'Teinture orange', 'Teinture magenta', 'Teinture bleu clair', 'Teinture jaune', 'Teinture vert clair',
'Teinture rose', 'Teinture grise', 'Teinture gris clair', 'Teinture cyan', 'Teinture violette',
'Teinture bleue', 'Teinture marron', 'Teinture verte', 'Teinture rouge', 'Teinture noire',
},
categoryIngredientUsage = 'Catégorie:Recette utilisant $1',
categoryRecipeType = 'Catégorie:Recette $1',
categoryUpcoming = 'Catégorie:Fonctionnalité à venir',
itemBlockOfQuartz = 'Bloc de quartz',
itemBrownMushroom = 'Champignon marron',
itemCharcoal = 'Charbon de bois',
itemCoal = 'Charbon',
itemColoredDye = 'Teinture colorée',
itemDye = 'Teinture',
itemMushroom = 'Champignon',
itemQuartzBlock = 'Bloc de quartz',
itemRedMushroom = 'Champignon rouge',
itemStone = 'Roche',
itemWhiteDye = 'Teinture blanche',
moduleArgs = [[Module:ProcessArgs]],
moduleRecipe = [[Module:Tableau de recette]],
moduleSlot = [[Module:Case inventaire]],
stoneVariants = { 'Roche', 'Andésite', 'Granite', 'Diorite' },
type = 'Fabrication',
variantPages = {
'Andésite', 'Bannière', 'Diorite', 'Étoile de feu d\'artifice', 'Granite', 'Lit',
'Plaque de pression', 'Sable', 'Grès', 'Bouclier', 'Dalle', 'Vitre teintée',
'Verre teinté', 'Escaliers', 'Pierre taillée', 'Planches', 'Bois', 'Laine',
},
}
p.i18n = i18n
local slot = require( i18n.moduleSlot )
local recipeTable = require( i18n.moduleRecipe ).table
local cArgVals = { 'A1', 'B1', 'C1', 'A2', 'B2', 'C2', 'A3', 'B3', 'C3' }
p.cArgVals = cArgVals
function p.table( f )
local args = f
if f == mw.getCurrentFrame() then
args = require( i18n.moduleArgs ).merge( true )
else
f = mw.getCurrentFrame()
end
-- Automatic shapeless positioning
if args[1] then
args.shapeless = 1
if args[7] then
args.A1 = args[1]
args.B1 = args[2]
args.C1 = args[3]
args.A2 = args[4]
args.B2 = args[5]
args.C2 = args[6]
if args[8] then
-- ◼◼◼ ◼◼◼
-- ◼◼◼ OR ◼◼◼
-- ◼◼◼ ◼◼◻
args.A3 = args[7]
args.B3 = args[8]
args.C3 = args[9]
if args[9] then
local identical = true
for i = 1, 8 do
if args[i] ~= args[i + 1] then
identical = false
break
end
end
if identical then
args.shapeless = nil
end
end
else
-- ◼◼◼
-- ◼◼◼
-- ◻◼◻
args.B3 = args[7]
end
elseif args[2] then
args.A2 = args[1]
args.B2 = args[2]
if args[5] then
-- ◻◻◻ ◻◻◻
-- ◼◼◼ OR ◼◼◼
-- ◼◼◼ ◼◼◻
args.C2 = args[3]
args.A3 = args[4]
args.B3 = args[5]
args.C3 = args[6]
elseif args[4] then
-- ◻◻◻
-- ◼◼◻
-- ◼◼◻
args.A3 = args[3]
args.B3 = args[4]
else
-- ◻◻◻ ◻◻◻
-- ◼◼◻ OR ◼◼◻
-- ◻◼◻ ◻◻◻
args.B3 = args[3]
end
else
-- ◻◻◻
-- ◻◼◻
-- ◻◻◻
args.B2 = args[1]
args.shapeless = nil
end
for i = 1, 9 do
args[i] = nil
end
end
-- Create recipe table, and list of ingredients
local out, ingredientSets = recipeTable( args, {
uiFunc = 'craftingTable',
type = i18n.type,
ingredientArgs = cArgVals,
outputArgs = { 'résultat' },
} )
local title = mw.title.getCurrentTitle()
if args.nocat == '1' or title.namespace ~= 0 or title.isSubpage then
return out
end
local categories = {}
local cI = 1
if args.upcoming then
categories[cI] = '[[' .. i18n.categoryUpcoming .. ']]'
cI = cI + 1
end
if args.type then
categories[cI] = '[[' .. i18n.categoryRecipeType:gsub( '%$1', args.type ) .. ']]'
cI = cI + 1
end
if args.ignorerutilisation ~= '1' then
-- Create ingredient categories for DPL
local usedNames = {}
for _, ingredientSet in pairs( ingredientSets ) do
for _, ingredient in pairs( ingredientSet ) do
local name = ingredient.name
if not ingredient.mod and not usedNames[name] and name ~= title.text then
-- List each dye individually as they have their own pages
if
name == slot.i18n.prefixes.any .. ' ' .. i18n.itemDye or
name == slot.i18n.prefixes.matching .. ' ' .. i18n.itemDye or
name == slot.i18n.prefixes.any .. ' ' .. i18n.itemColoredDye or
name == slot.i18n.prefixes.matching .. ' ' .. i18n.itemColoredDye
then
if not name:find( i18n.colored ) then
categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', i18n.itemWhiteDye ) .. ']]'
cI = cI + 1
usedNames[i18n.itemWhiteDye] = true
end
for _, dye in pairs( i18n.coloredDyes ) do
categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', dye ) .. ']]'
cI = cI + 1
usedNames[dye] = true
end
-- List stone variants individually as they have their own pages
elseif
name == slot.i18n.prefixes.any .. ' ' .. i18n.itemStone or
name == slot.i18n.prefixes.matching .. ' ' .. i18n.itemStone
then
for _, stone in pairs( i18n.stoneVariants ) do
categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', stone ) .. ']]'
cI = cI + 1
usedNames[stone] = true
end
else
-- Merge item variants which use a single page
if
name == slot.i18n.prefixes.any .. ' ' .. i18n.itemMushroom or
name == slot.i18n.prefixes.matching .. ' ' .. i18n.itemMushroom or
name == i18n.itemRedMushroom or
name == i18n.itemBrownMushroom
then name = i18n.itemMushroom
elseif name == i18n.itemCharcoal then name = i18n.itemCoal
elseif name:find( ' ' .. i18n.itemQuartzBlock .. '$' ) then name = i18n.itemBlockOfQuartz
else
for _, variant in pairs( i18n.variantPages ) do
if name:find( ' ' .. variant .. '$' ) then
name = variant
break
end
end
-- Remove prefixes
for _, prefix in pairs( slot.i18n.prefixes ) do
if name:find( '^' .. prefix .. ' ' ) then
name = name:gsub( '^' .. prefix .. ' ', '' )
break
end
end
end
if not usedNames[name] then
categories[cI] = '[[' .. i18n.categoryIngredientUsage:gsub( '%$1', name ) .. ']]'
cI = cI + 1
usedNames[name] = true
end
end
end
end
end
end
return out, table.concat( categories, '' )
end
return p