Module:CoffreRécompenses

De Minecraft Wiki
Aller à : navigation, rechercher

Ce module permet de gérer les modèles {{CoffreRécompenses}} et {{CoffreRécompensesObjet}}.

  • p.base() est la fonction qui permet de générer un tableau pour chaque coffre ;
  • p.bas2() est la fonction qui permet de générer un tableau avec un ou plusieurs objets.

Voir les modèles respectifs pour plus d'information sur l'utilisation.

Les données utilisées par le module sont situées dans les tableaux du haut de la page.

[voir | modifier | historique | purger]La documentation ci-dessus est insérée depuis Module:CoffreRécompenses/doc.
local p = {

	calc_average_amount_this_item_per_pool = function( 
			min_stacksize, max_stacksize,
			min_pool_rolls, max_pool_rolls, 
			item_weight, pool_total_item_weight )

		local avg_stacksize = ( min_stacksize + max_stacksize ) / 2
		local avg_rolls = ( min_pool_rolls + max_pool_rolls ) / 2
		
		return avg_stacksize * avg_rolls * item_weight / pool_total_item_weight
		
	end,
	
	calc_chance_any_of_this_item_per_pool = function( 
			min_pool_rolls, max_pool_rolls,
			item_weight, pool_total_item_weight )

		local avg_rolls = ( min_pool_rolls + max_pool_rolls ) / 2
		local relativeweight = item_weight / pool_total_item_weight
		
		return 1 - math.pow( 1 - relativeweight, avg_rolls )
		
	end,
	
	dev = 'En [[1.15]] {{à venir|ver=1.15}} \n',
	
	-- these define which sprite, label and link to use, in the table,
	-- and 'cannot_stack' and 'plural' dictate how to display the single-item summary
	-- mettre article="partitif" fait utiliser "du" ou "de la" devant l'objet
	-- il faut mettre genre="féminin" pour les objets au nom féminin
	
	-- NOTE: order in this list doesn't matter.

	items = {
		["arbalète"]                 = { "objet" },
		["rails-déclencheurs"]    = { "bloc" },
		["rails-détecteurs"]       = { "bloc", title="Rails détecteurs" },
		["pomme"]                 = { "objet" },
		["flèche"]                = { "objet" },
        ['fiole-expérience']      = { "objet", title="Fiole d'expérience" },
		["graines-betterave"]     = { "objet", title="Graines de betterave", link="Graines de betterave" },
		["soupe-betterave"]       = { "objet", title="Soupe de betteraves", link="Soupe de betteraves" },
		["os"]                    = { "objet" },
		["livre"]                 = { "objet" },
		["pain"]                  = { "objet" },
		["seau"]                  = { "objet" },
		["charbon"]               = { "objet" },
		["morue-cuite"]           = { "objet", link="Poisson (nourriture)" },
		["saumon-cuit"]           = { "objet", link="Poisson (nourriture)" },
		["boussole"]              = { "objet" },
        ["montre"]                = { "objet" },
		["plastron-diamant"]      = { "objet", link="Armure", cannot_stack=true },
		["diamant"]               = { "objet" },
		["disque-doré"]           = { "objet", title="Disque doré", link="Disque", cannot_stack=true },
		["disque-vert"]           = { "objet", title="Disque vert", link="Disque", cannot_stack=true },
		["émeraude"]              = { "objet" },
		["carte-vierge"]          = { "objet", title="Carte vierge", link="Carte (objet)" },
        ["carte-trésor-enfoui"]   = { "objet", title="Carte d'exploration", link="Carte d'exploration" },
        ["carotte"]               = { "objet" },
        ["crochet"]               = { "bloc" },
        ["citrouille"]            = { "bloc" },
		["livre-enchanté"]        = { "objet", cannot_stack=true, note="enchantement1" },
		["livre-enchanté-alt"]    = { "objet", id='livre-enchanté', title="Livre enchanté", link="Livre enchanté", cannot_stack=true, note="livre-aléatoire" },
        ["canne-pêche-enchantée"] = { "objet", id="canne-pêche", link="Canne à pêche", cannot_stack=true, note="enchantement1" },
		["perle-ender"]           = { "objet", title="Perle de l'Ender" },
		["briquet"]               = { "objet", cannot_stack=true },
		["plastron-or"]           = { "objet", title="Plastron en or", link="Armure", cannot_stack=true },
        ["casque-or"]             = { "objet", title="Casque en or",link="Armure", cannot_stack=true },
		["épée-or"]               = { "objet", title="Épée en or", link="Épée", cannot_stack=true },
		["lingot-or"]             = { "objet", title="Lingot d'or" },
        ["pépite-fer"]            = { "objet", title="Pépite de fer" },
		["pépite-or"]             = { "objet", title="Pépite d'or" },
		["poudre-canon"]          = { "objet", title="Poudre à canon", article="partitif" },
		["armure-cheval-diamant"] = { "objet", title="Armure en diamant pour cheval", link="Armure pour cheval", cannot_stack=true },
		["armure-cheval-or"]      = { "objet", title="Armure en or pour cheval", link="Armure pour cheval", cannot_stack=true },
		["armure-cheval-fer"]     = { "objet", title="Armure en fer pour cheval", link="Armure pour cheval", cannot_stack=true },
		["bottes-fer"]            = { "objet", title="Bottes en fer", link="Armure", cannot_stack=true },
		["plastron-fer"]          = { "objet", title="Plastron en fer", link="Armure", cannot_stack=true },
		["casque-fer"]            = { "objet", title="Casque en fer", link="Armure", cannot_stack=true },
		["lingot-fer"]            = { "objet", title="Lingot de fer" },
		["jambières-fer"]         = { "objet", title="Jambières en fer", link="Armure", cannot_stack=true },
		["pioche-fer"]            = { "objet", title="Pioche en fer", link="Pioche", cannot_stack=true },
		["épée-fer"]              = { "objet", title="Épée en fer", link="Épée", cannot_stack=true },
		["cotte-de-mailles"]	  = { "objet", title="Cotte de mailles", link="Armure", cannot_stack=true },
        ["tunique-cuir"]          = { "objet", title="Tunique en cuir", link="Armure", cannot_stack=true },
        ["bottes-cuir"]           = { "objet", title="Bottes en cuir", link="Armure", cannot_stack=true },
        ["chapeau-cuir"]          = { "objet", title="Chapeau en cuir", link="Armure", cannot_stack=true },
        ["pantalon-cuir"]         = { "objet", title="Pantalon en cuir", link="Armure", cannot_stack=true },
		["lapis-lazuli"]          = { "objet", title="Lapis-lazuli", link="lapis-lazuli"},
		["graines-pastèque"]      = { "objet", title="Graines de pastèque" },
		["étiquette"]             = { "objet" },
        ["pomme-dorée"]           = { "objet", title="Pomme dorée", link="Pomme dorée" },
		["pomme-dorée-enchantée"] = { "objet", title="Pomme dorée enchantée", link="Pomme dorée" },
        ['pomme-terre']           = { "objet", title="Pomme de terre" },
        ['pomme-terre-empoisonnée']  = { "objet", title="Pomme de terre empoisonnée" },
		["verrues-du-nether"]     = { "objet", title="Verrues du Nether" },
		["pousse-chêne"]          = { "bloc", title="Pousse de chêne", link="Pousse d'arbre" },
		["pousse-acacia"]         = { "bloc", title="Pousse d'acacia", link="Pousse d'arbre" },
		["pousse-sapin"]          = { "bloc", title="Pousse de sapin", link="Pousse d'arbre" },
		["bûche-acacia"] = { "bloc", title="Bûche d'acacia", id='bûche-acacia', link="Bûche" },
		["bûche-chêne"]           = { "bloc", title="Bûche de chêne", id='bûche-chêne', link="Bûche" },
		["bûche-sapin"]           = { "bloc", title="Bûche de sapin", id='bûche-sapin', link="Bûche" },
		["bûche-bouleau"]         = { "bloc", title="Bûche de bouleau", id='bûche-bouleau', link="Bûche" },
		["bûche-acajou"]          = { "bloc", title="Bûche d'acajou", id='bûche-acajou', link="Bûche" },
		["bûche-chêne-noir"]      = { "bloc", title="Bûche de chêne noir", id='bûche-chêne-noir', link="Bûche" },
		["bûche-chêne-seulement"] = { "bloc", title="Bûche de chêne", id='bûche-chêne', link="Bûche" },
		["pancarte-sapin"]        = { "objet", title="Pancarte en sapin", id='pancarte-sapin', link="Pancarte" },
		["obsidienne"]            = { "bloc" },
		["papier"]                = { "objet" },
		["rails-propulsion"]      = { "bloc", title="Rails de propulsion" },
		["cristaux-de-prismarine"]   = { "objet", title="Cristaux de prismarine" },
		["graines-citrouille"]    = { "objet", title="Graines de citrouille" },
		["tarte-citrouille"]      = { "objet", title="Tarte à la citrouille" },
		["rails"]                 = { "bloc" },
		["redstone"]              = { "objet" },
		["chair-putréfiée"]       = { "objet" },
		["sable"]                 = { "bloc" },
		["selle"]                 = { "objet", cannot_stack=true },
		["saumon-cru"]            = { "objet" },
		["œil-araignée"]          = { "objet", title="Œil d'araignée", link="Œil d'araignée" },
		["bâton"]                 = { "objet" },
		["hache-pierre"]          = { "objet", title="Hache en pierre", link="Hache", cannot_stack=true },
		["pioche-pierre"]         = { "objet", title="Pioche en pierre", link="Pioche", cannot_stack=true },
		["ficelle"]               = { "objet" },
		["tnt"]                   = { "bloc", title="TNT" },
		["torche"]                = { "bloc" },
		["blé"]                   = { "objet" },
		["planches-chêne"]        = { "bloc", title="Planche de chêne", link="Planches", },
        ["plume"]                 = { "objet" },
		["hache-bois"]            = { "objet", title="Hache en bois", link="Hache", cannot_stack=true },
		["pioche-bois"]           = { "objet", title="Pioche en bois", link="Pioche", cannot_stack=true },
		["houe-bois"]             = { "objet", title="Houe en bois", link="Houe", cannot_stack=true },
		["houe-diamant"]          = { "objet", title="Houe en diamant", link="Houe", cannot_stack=true },
		["laisse"]                = { "objet", title="Laisse", link="Laisse" },
		["vide"]                  = { "bloc", id="air", link='', title="Rien" },
        ["cœur-de-la-mer"]        = { "objet", link="Cœur de la mer" },
        ["bambou"]                = { "objet", link="Bambou" },
        ["soupe-suspecte"]        = { "objet", link="Soupe suspecte" },
        ["porc-cru"]              = { "objet", link="Porc cru" },
        ["bœuf"]                  = { "objet", link="Bœuf cru" },
        ["mouton-cru"]            = { "objet", link="Mouton cru" },
        ["argile"]                = { "objet", link="Mouton cru" },
		["pot-fleurs"]            = { "bloc", title="Pot de fleurs", link="Pot de fleurs" },
		["roche"]                 = { "bloc" },
		["pierre-taillée"]        = { "bloc" },
		["teinture-jaune"]        = { "objet" },
		["teinture-verte"]        = { "objet" },
		["roche-lisse"]           = { "bloc", link="Roche" },
		["laine-blanche"]         = { "bloc" },
		["laine-noire"]           = { "bloc" },
		["laine-grise"]           = { "bloc" },
		["laine-marron"]          = { "bloc" },
		["laine-gris-clair"]      = { "bloc" },
		["cisailles"]             = { "objet" },
		["cuir"]                  = { "objet" },
		["cactus"]                = { "bloc" },
		["arbuste-mort"]          = { "bloc" },
		["pissenlit"]             = { "bloc" },
		["coquelicot"]            = { "bloc" },
		["hautes-herbes"]          = { "bloc" },
		["très-hautes-herbes"]    = { "bloc" },
		["fougère"]               = { "bloc" },
		["grande fougère"]        = { "bloc" },
		["graines-blé"]           = { "objet", title="Graines de blé", link="Graines de blé" },
		["glace-bleue"]           = { "bloc" },
		["bloc-neige"]            = { "bloc", title="Bloc de neige", link="Bloc de neige" },
		["boule-de-neige"]        = { "objet" },
		["fourneau"]                  = { "bloc" },
		["baies-sucrées"]         = { "objet" },
	

		["bottes-diamant-enchantées"]      = { "objet", title="Bottes en diamant enchantées", id="bottes-diamant", link="Bottes en diamant", note="enchantement2", cannot_stack=true },
		["plastron-diamant-enchanté"] = { "objet", title="Plastron en diamant enchanté", id="plastron-diamant", link="Plastron en diamant", note="enchantement2", cannot_stack=true },
		["casque-diamant-enchanté"]     = { "objet", title="Casque en diamant enchanté", id="casque-diamant", link="Casque en diamant", note="enchantement2", cannot_stack=true },
		["jambières-diamant-enchantées"]   = { "objet", title="Jambières en diamant enchantées", id="jambières-diamant", link="Jambières en diamant", note="enchantement2", cannot_stack=true },
		["pioche-diamant-enchantée"]    = { "objet", title="Pioche en diamant enchantée", id="pioche-diamant", link="Pioche en diamant", note="enchantement2", cannot_stack=true },
		["pelle-diamant-enchantée"]     = { "objet", title="Pelle en diamant enchantée", id="pelle-diamant", link="Pelle en diamant", note="enchantement2", cannot_stack=true },
		["épée-diamant-enchantée"]      = { "objet", title="Épée en diamant enchantée", id="épée-diamant", link="Épée en diamant", note="enchantement2", cannot_stack=true },
		["bottes-fer-enchantées"]         = { "objet", title="Bottes en fer enchantées", id="bottes-fer", link="Bottes en fer", note="enchantement2", cannot_stack=true },
		["plastron-fer-enchanté"]    = { "objet", title="Plastron en fer enchanté", id="plastron-fer", link="Plastron en fer", note="enchantement2", cannot_stack=true },
		["casque-fer-enchanté"]        = { "objet", title="Casque en fer enchanté", id="casque-fer", link="Casque en fer", note="enchantement2", cannot_stack=true },
		["jambières-fer-enchantées"]      = { "objet", title="Jambières en fer enchantées", id="jambières-fer", link="Jambières en fer", note="enchantement2", cannot_stack=true },
		["pioche-fer-enchantée"]       = { "objet", title="Pioche en fer enchantée", id="pioche-fer", link="Pioche en fer", note="enchantement2", cannot_stack=true },
		["pelle-fer-enchantée"]        = { "objet", title="Pelle en fer enchantée", id="pelle-fer", link="Pelle en fer", note="enchantement2", cannot_stack=true },
		["épée-fer-enchantée"]         = { "objet", title="Épée en fer enchantée", id="épée-fer", link="Épée en fer", note="enchantement2", cannot_stack=true },
        ["chapeau-cuir-enchanté"]         = { "objet", title="Chapeau en cuir enchanté", id="chapeau-cuir", link="Armure", note="livre-aléatoire", cannot_stack=true },
		["tunique-cuir-enchantée"]       = { "objet", title="Tunique en cuir enchantée", id="tunique-cuir", link="Armure", note="livre-aléatoire", cannot_stack=true }, 
		["pantalon-cuir-enchanté"]       = { "objet", title="Pantalon en cuir enchanté", id="pantalon-cuir", link="Armure", note="livre-aléatoire", cannot_stack=true },
		["bottes-cuir-enchantées"]     = { "objet", title="Bottes en cuir enchantées", id="bottes-cuir", link="Armure", note="livre-aléatoire", cannot_stack=true },
	},

	notes = {
		["enchantement1"] = "Les probabilités des enchantements sont les mêmes que pour une utilisation d'une [[table d'enchantement]] au niveau 30, mais la probabilité des enchantements multiples n'est pas réduite.",
		["enchantement2"] = "Les objets enchantés d'un coffre auront les mêmes enchantements. Les probabilités des enchantements sont les mêmes que pour une utilisation d'une [[table d'enchantement]] pour un niveau compris entre 20 et 39.",
		["livre-aléatoire"] = "Tous les enchantements et tous les niveaux d'enchantement ont la même probabilité.",
	},
	
	-- NOTE: order here doesn't matter.  
	--		 * in the table, chests will sort in alphabetical order
	--       * in the table, items will sort by chance, then by avg#, then alphabetically.
	--       * If poolsDev is omitted, pools will be used. To omit a pool entirely in the dev version, set poolsDev = {}.
	
	chests = {
         ["avant-poste-de-pillards"] = { -- pillager_outpost.json
			header = "Avant-poste de pillards",
			link   = "[[Avant-poste de pillards]]",
			structure = "Avant-poste de pillards",
			conteneur = "Coffre des pillards",
			structID = "avant-poste-de-pillards",
			poolsDev = {},
			pools = {			
				{
					rolls = {0,1},
					items = {
						["arbalète"]             = {1,1,1},
					}
				},
				{
					rolls = {2,3},
					items = {
						["blé"]                = {3,5,7},
						["pomme-terre"]               = {2,5,5},
						["carotte"]               = {3,5,5}
					}
				},
				{
					rolls = {1,3},
					items = {
						["bûche-chêne-noir"]         = {2,3,1}
					}
				},
				{
					rolls = {2,3},
					items = {
						["fiole-expérience"] = {1,1,7},
						["fil"]               = {1,6,4},
						["flèche"]                = {2,7,4},
						["crochet"]        = {1,3,3},
						["lingot-fer"]           = {1,3,3},
						["livre-enchanté-alt"]   = {1,1,1}
					}
				},
			}
		},
     	["carte-d'épave-de-navire"] = { -- shipwreck_map.json
			header = "Coffre à carte",
			superheader = "[[Épave de navire]]",
			link   = "carte d'[[épave de navire]]",
			structure = "Épave de navire",
			conteneur = "Coffre à carte",
			structID = "épave-navire",
			pools = {
				{
					rolls = {1,1},
					items = {
                        ["carte-trésor-enfoui"] = {1,1,1},
					}
				},
				{
					rolls = {3,3},
					items = {
						["boussole"]             = {1,1,1},
						["carte-vierge"]           = {1,1,1},
						["montre"]               = {1,1,1},
						["papier"]               = {1,10,20},
						["plume"]             = {1,5,10},
						["livre"]                = {1,5,5},
					}
				}
			},
			poolsDev = {}
		
		},
		["réserve-d'épave-de-navire"] = { -- shipwreck_supply.json
			header = "Réserve",
			superheader = "[[\Épave de navire]]",
			link   = "réserve d'[[épave de navire]]",
			structure = "Épave de navire",
			conteneur = "Coffre de la réserve",
			structID = "épave-navire",
			poolsDev = {},
			pools = {
				{
					rolls = {3,10},
					items = {
						["papier"]              = {1,12,8},
						['pomme-terre']         = {2,6,7},
						['pomme-terre-empoisonnée']  = {2,6,7},
						["soupe-suspecte"]     = {1,1,10},
						["carotte"]              = {4,8,7},
						["blé"]               = {8,21,7},
						["bambou"]               = {1,3,2},
						["charbon"]                = {2,8,6},
						["chair-putréfiée"]        = {5,24,5},
						["citrouille"]             = {1,3,2},
						["poudre-canon"]            = {1,5,3},
						["tnt"]                 = {1,2,1},
						["chapeau-cuir-enchanté"]         = {1,1,3},
						["tunique-cuir-enchantée"]       = {1,1,3},
						["pantalon-cuir-enchanté"]       = {1,1,3},
						["bottes-cuir-enchantées"]     = {1,1,3},
					}
				},
			}
		},
		["trésor-d'épave-de-navire"] = { -- shipwreck_treasure.json
			header = "Trésor",
			superheader = "[[Épave de navire]]",
			link   = "trésor d'[[épave de navire]]",
			structure = "Épave de navire",
			conteneur = "Coffre du trésor",
			structID = "épave-navire",
			pools = {
				{
					rolls = {3,6},
					items = {
						["lingot-fer"]          = {1,5,90},
						["lingot-or"]          = {1,5,10},
						["emeraude"]             = {1,5,40},
						["diamant"]             = {1,1,5},
						['fiole-expérience']  = {1,1,5},
					}
				},
				{
					rolls = {2,5},
					items = {
						["pépite-fer"]          = {1,10,50},
						["pépite-or"]           = {1,10,10},
						["lapis-lazuli"]        = {1,10,20},
					}
				}
			},
			poolsDev = {}
		},
		["trésor-enfoui"] = { -- buried_treasure.json
			header = "Trésor enfoui",
			link   = "[[trésor enfoui]]",
			structure = "Trésor enfoui",
			conteneur = "Coffre au trésor",
			structID = "trésor-enfoui",
			pools = {
                {
					rolls = {1,1},
					items = {
						["cœur-de-la-mer"]          = {1,1,1},
					}
				},
				{
					rolls = {5,8},
					items = {
						["lingot-fer"]          = {1,4,20},
						["lingot-or"]           = {1,4,10},
						["tnt"]                 = {1,2,5},
					}
				},
				{
					rolls = {1,3},
					items = {
						["émeraude"]            = {4,8,5},
						["diamant"]             = {1,2,5},
						["cristaux-de-prismarine"] = {1,5,5},
					}
				},
				{
					rolls = {0,1},
					items = {
						["tunique-cuir"]        = {1,1,1},
						["épée-fer"]            = {1,1,1},
					}
				},
				{
					rolls = {2,2},
					items = {
						["morue-cuite"]         = {2,4,1},
						["saumon-cuit"]         = {2,4,1},
					}
				},
			},
			poolsDev = {}
		},
         ["grande-ruine-sous-marine"] = { -- underwater_ruin_big.json
			header = "Grande",
			superheader = "[[Ruines sous-marines]]",
			link   = "grandes [[ruines sous-marines]]",
			structure = "Ruines sous-marines",
			conteneur = "Coffre de grande ruine",
			structID = "ruines-sous-marines",
			pools = {
				{
					rolls = {2,8},
					items = {
						["charbon"]                = {1,4,10},
						["pépite-or"]         = {1,3,10},
						["émeraude"]             = {1,1,1},
						["blé"]               = {2,3,10},
					}
				},
				{
					rolls = {1,1},
					items = {
						["pomme-dorée"]        = {1,1,1},
						["livre-enchanté"]      = {1,1,5},
						["tunique-cuir"]       = {1,1,1},
						["casque-or"]       = {1,1,1},
						["canne-pêche-enchantée"] = {1,1,5},
                        ["carte-trésor-enfoui"] = {1,1,10},
					}
				},
			},
			poolsDev = {}
		},
		["petite-ruine-sous-marine"] = { -- underwater_ruin_small.json
			header = "Petite",
			superheader = "[[Ruines sous-marines]]",
			link   = "petites [[ruines sous-marines]]",
			structure = "Ruines sous-marines",
			conteneur = "Coffre de petite ruine",
			structID = "ruines-sous-marines",
			pools = {
				{
					rolls = {2,8},
					items = {
						["charbon"]                = {1,4,10},
						["hache-pierre"]          = {1,1,2},
						["chair-putréfiée"]        = {1,1,5},
						["émeraude"]             = {1,1,1},
						["blé"]               = {2,3,10},
					}
				},
				{
					rolls = {1,1},
					items = {
						["tunique-cuir"]       = {1,1,1},
						["casque-or"]       = {1,1,1},
						["canne-pêche-enchantée"] = {1,1,5},
                        ["carte-trésor-enfoui"] = {1,1,5},
					}
				},
			},
			poolsDev = {}
		},
		["village-forge"] = {
			header      = "Forge",
			superheader      = "[[Village]]",
			link        = "forge de [[village]]",
			structure = "Village",
			conteneur = "Coffre de la forge",
			structID = "village",
			pools = {
				{
					rolls = {3,8},
					items = {
						["diamant"]             = {1,3,3},
						["lingot-fer"]          = {1,5,10},
						["lingot-or"]          = {1,3,5},
						["pain"]               = {1,3,15},
						["pomme"]               = {1,3,15},
						["pioche-fer"]        = {1,1,5},
						["épée-fer"]          = {1,1,5},
						["plastron-fer"]     = {1,1,5},
						["casque-fer"]         = {1,1,5},
						["jambières-fer"]       = {1,1,5},
						["bottes-fer"]          = {1,1,5},
						["obsidienne"]            = {3,7,5},
						["pousse-chêne"]         = {3,7,5},
						["armure-cheval-fer"]    = {1,1,1},
						["armure-cheval-or"]    = {1,1,1},
						["armure-cheval-diamant"] = {1,1,1},
						["selle"]              = {1,1,3}
					}
				},
			},
			poolsDev = {}
			},
		["village-armurerie"] = { -- village\village_armorer.json
			header      = "Armurerie",
			superheader      = "[[Village]]",
			link        = "Armurerie de [[village]]",
			structure = "Village",
			conteneur = "Coffre de l'armurerie",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {1,5},
					items = {
						["lingot-fer"]     = {1,3,2},
						["pain"]          = {1,4,4},
						["casque-fer"]    = {1,1,1},
						["émeraude"]        = {1,1,1}
					}
				},
			}
		},
	    ["village-boucherie"] = { -- village\village_butcher.json
			header      = "Boucherie",
			superheader      = "[[Village]]",
			link        = "Boucherie de [[village]]",
			structure = "Village",
			conteneur = "Coffre de boucher",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {1,5},
					items = {
						["émeraude"]        = {1,1,1},
						["porc-cru"]   = {1,3,6},
						["blé"]          = {1,3,6},
						["bœuf"]           = {1,3,6},
						["mouton-cru"]     = {1,3,6},
						["charbon"]           = {1,3,3}
					}
				},
			}
		},
	    ["village-cartographe"] = { -- village\village_cartographer.json
			header      = "Cartographe",
			superheader      = "[[Village]]",
			link        = "Cartographe de [[village]]",
			structure = "Village",
			conteneur = "Coffre de cartographe",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {1,5},
					items = {
						["carte-vierge"]      = {1,3,10},
						["papier"]          = {1,5,15},
						["boussole"]        = {1,1,5},
						["pain"]          = {1,4,15},
						["pousse-chêne"]    = {1,2,5}
					}
				},
			}
		},
	    ["village-maçon"] = { -- village\village_mason.json
			header      = "Maçon",
			superheader      = "[[Village]]",
			link        = "Maçon de [[village]]",
			structure = "Village",
			conteneur = "Coffre de maçon",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {1,5},
					items = {
						["argile"]           = {1,3,1},
						["pot-fleurs"]     = {1,1,1},
						["roche"]          = {1,1,2},
						["pierre-taillée"]   = {1,1,2},
						["pain"]          = {1,4,4},
						["teinture-jaune"]     = {1,1,1},
						["roche-lisse"]   = {1,1,1},
						["émeraude"]        = {1,1,1}
					}
				},
			}
		},
	    ["village-bergerie"] = { -- village\village_shepherd.json
			header      = "Bergerie",
			superheader      = "[[Village]]",
			link        = "Bergerie de [[village]]",
			structure = "Village",
			conteneur = "Coffre de bergerie",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {1,5},
					items = {
						["laine-blanche"]      = {1,8,6},
						["laine-noire"]      = {1,3,3},
						["laine-grise"]       = {1,3,2},
						["laine-marron"]      = {1,3,2},
						["laine-gris-clair"] = {1,3,2},
						["émeraude"]         = {1,1,1},
						["cisailles"]          = {1,1,1},
						["blé"]           = {1,6,6}
					}
				},
			}
		},
	    ["village-tannerie"] = { -- village\village_tannery.json
			header      = "Tannerie",
			superheader      = "[[Village]]",
			link        = "Tannerie de [[village]]",
			structure = "Village",
			conteneur = "Coffre de tannerie",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {1,5},
					items = {
						["cuir"]         = {1,3,1},
						["tunique-cuir"]   = {1,1,2},
						["bottes-cuir"]   = {1,1,2},
						["chapeau-cuir"]     = {1,1,2},
						["pain"]           = {1,4,5},
						["pantalon-cuir"]   = {1,1,2},
						["selle"]          = {1,1,1},
						["émeraude"]         = {1,4,1}
					}
				},
			}
		},
	    ["village-forgeron-armes"] = { -- village\village_weaponsmith.json
			header      = "Forgeron d'armes",
			superheader      = "[[Village]]",
			link        = "Forgeron d'armes de [[village]]",
			structure = "Village",
			conteneur = "Coffre de forgeron d'armes",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {3,8},
					items = {
						["diamant"]             = {1,3,3},
						["lingot-fer"]          = {1,5,10},
						["lingot-or"]          = {1,3,5},
						["pain"]               = {1,3,15},
						["pomme"]               = {1,3,15},
						["pioche-fer"]        = {1,1,5},
						["épée-fer"]          = {1,1,5},
						["plastron-fer"]     = {1,1,5},
						["casque-fer"]         = {1,1,5},
						["jambières-fer"]       = {1,1,5},
						["bottes-fer"]          = {1,1,5},
						["obsidienne"]            = {3,7,5},
						["pousse-chêne"]         = {3,7,5},
						["armure-cheval-fer"]    = {1,1,1},
						["armure-cheval-or"]    = {1,1,1},
						["armure-cheval-diamant"] = {1,1,1},
						["selle"]              = {1,1,3}
					}
				},
			}
		},
	    ["village-désert"] = { -- village\village_desert_house.json
			header      = "Maison du désert",
			superheader      = "[[Village]]",
			link        = "Maison de [[village]] du désert",
			structure = "Village",
			conteneur = "Coffre de maison du désert",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {3,8},
					items = {
						["argile"]            = {1,1,1},
						["teinture-verte"]       = {1,1,1},
						["cactus"]          = {1,4,10},
						["blé"]           = {1,7,10},
						["pain"]           = {1,4,10},
						["livre"]            = {1,1,1},
						["arbuste-mort"]       = {1,3,2},
						["émeraude"]         = {1,3,1}
					}
				},
			}
		},
	    ["village-plaine"] = { -- village\village_plains_house.json
			header      = "Maison des plaines",
			superheader      = "[[Village]]",
			link        = "Maison de [[village]] des plaines",
			structure = "Village",
			conteneur = "Coffre de maison des plaines",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {3,8},
					items = {
						["pépite-or"]     = {1,3,1},
						["pissenlit"]       = {1,1,1},
						["coquelicot"]           = {1,1,1},
						["pomme-terre"]          = {1,7,10},
						["pain"]           = {1,4,10},
						["pomme"]           = {1,5,10},
						["émeraude"]         = {1,4,2},
						["pousse-chêne"]     = {1,2,5}
					}
				},
			}
		},
	    ["village-savane"] = { -- village\village_savanna_house.json
			header      = "Maison de la savane",
			superheader      = "[[Village]]",
			link        = "Maison de [[village]] de la savane",
			structure = "Village",
			conteneur = "Coffre de maison de la savane",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {3,8},
					items = {
						["pépite-or"]     = {1,3,1},
						["herbe"]           = {1,1,5},
						["hautes-herbes"]      = {1,1,5},
						["blé"]           = {1,4,10},
						["graines-blé"]     = {1,5,10},
						["émeraude"]         = {1,4,2},
						["pousse-acacia"]  = {1,2,10},
						["selle"]          = {1,1,1},
						["torche"]           = {1,2,1},
						["seau"]          = {1,1,1}
					}
				},
			}
		},
	    ["village-toundra"] = { -- village\village_snowy_house.json
			header      = "Maison de la toundra",
			superheader      = "[[Village]]",
			link        = "Maison de [[village]] de la toundra",
			structure = "Village",
			conteneur = "Coffre de maison de la toundra",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {3,8},
					items = {
						["glace-bleue"]        = {1,1,1},
						["bloc-neige"]      = {1,1,4},
						["pomme-terre"]          = {1,7,10},
						["pain"]           = {1,4,10},
						["graines-betterave"]  = {1,5,10},
						["soupe-betteraves"]   = {1,1,1},
						["fourneau"]         = {1,1,1},
						["émeraude"]         = {1,4,1},
						["boule-de-neige"]        = {1,7,10},
						["charbon"]            = {1,4,5}
					}
				},
			}
		},
	    ["village-taïga"] = { -- village\village_taiga_house.json
			header      = "Maison de la taïga",
			superheader      = "[[Village]]",
			link        = "Maison de [[village]] de la taïga",
			structure = "Village",
			conteneur = "Coffre de maison de la taïga",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {3,8},
					items = {
						["pépite-fer"]      = {1,5,1},
						["fougère"]            = {1,1,2},
						["grande-fougère"]      = {1,1,2},
						["pomme-terre"]     = {1,7,10},
						["baies-sucrées"]   = {1,7,5},
						["pain"]           = {1,4,10},
						["graines-citrouille"]   = {1,5,5},
						["tarte-citrouille"]     = {1,1,1},
						["émeraude"]         = {1,4,2},
						["pousse-sapin"]  = {1,5,5},
						["pancarte-sapin"]     = {1,1,1},
						["bûche-sapin"]      = {1,5,10}
					}
				},
			}
		},
	    ["village-maison-2-pièces"] = { -- village\village_two_room_house.json
			header      = "Maison 2 pièces",
			superheader      = "[[Village]]",
			link        = "Maison 2 pièces de [[village]]",
			structure = "Village",
			conteneur = "Coffre de maison 2 piéces",
			structID = "village",
			poolsDev = {},
		    pools = {
				{
					rolls = {6,8},
					items = {
						["pomme-terre"]      = {5,8,10},
						["carotte"]      = {4,8,10},
						["blé"]       = {8,12,15},
						["graines-blé"] = {2,4,5},
						["betterave"]    = {5,8,5},
						["houe-bois"]  = {1,1,1}
					}
				},
			}
		},
		["autel-fort"] = {
			header      = "Autel",
			superheader = "[[Fort]]",
			link        = "autel de [[fort]]",
			structure = "Forts",
			conteneur = "Coffre de l'autel",
			structID = "fort",
			pools = {
				{
					rolls = {2,3},
					items = {
						["diamant"]             = {1,3,3},
						["lingot-fer"]          = {1,5,10},
						["lingot-or"]          = {1,3,5},
						["pain"]               = {1,3,15},
						["pomme"]               = {1,3,15},
						["pioche-fer"]        = {1,1,5},
						["épée-fer"]          = {1,1,5},
						["plastron-fer"]     = {1,1,5},
						["casque-fer"]         = {1,1,5},
						["jambières-fer"]       = {1,1,5},
						["bottes-fer"]          = {1,1,5},
						["armure-cheval-fer"]    = {1,1,1},
						["armure-cheval-or"]    = {1,1,1},
						["armure-cheval-diamant"] = {1,1,1},
						["perle-ender"]         = {1,1,10},
						["redstone"]            = {4,9,5},
						["pomme-dorée"]        = {1,1,1},
						["selle"]              = {1,1,1},
						["livre-enchanté"]      = {1,1,1}
					}
				},
			},
			poolsDev = {}
		},
		["bibliothèque-fort"] = {
			header      = "Bibliothèque",
			superheader = "[[Fort]]",
			link        = "bibliothèque de [[fort]]",
			structure = "Forts",
			conteneur = "Coffre de bibliothèque",
			structID = "fort",
			pools = {
				{
					rolls = {2,10},
					items = {
						["livre-enchanté"]      = {1,1,10},
						["livre"]               = {1,3,20},
						["papier"]              = {2,7,20},
						["carte-vierge"]        = {1,1,1},
						["boussole"]             = {1,1,1}
					}
				},
			},
			poolsDev = {}
		},
		["entrepôt-fort"] = {
			header      = "Entrepôt",
			superheader = "[[Fort]]",
			link        = "entrepôt de [[fort]]",
			structure = "Forts",
			conteneur = "Coffre d'entrepôt",
			structID = "fort",
			pools = {
				{
					rolls = {1,4},
					items = {
						["lingot-fer"]          = {1,5,10},
						["lingot-or"]          = {1,3,5},
						["pain"]               = {1,3,15},
						["pomme"]               = {1,3,15},
						["pioche-fer"]        = {1,1,1},
						["redstone"]            = {4,9,5},
						["livre-enchanté"]      = {1,1,1},
						["charbon"]                = {3,8,10}
					}
				},
			},
			poolsDev = {}
		},
		["bonus"] = {
			header      = "[[Coffre#Coffre bonus|Bonus]]",
			link        = "[[Coffre#Coffre bonus|bonus]]",
			structure = "Coffre bonus",
			conteneur = "Coffre bonus",
			structID = "jour",
			pools = {
				{
					rolls = {1,1},
					items = {
						["hache-pierre"]        = {1,1,1},
						["hache-bois"]          = {1,1,3},
					}
				},
				{
					rolls = {1,1},
					items = {
						["pioche-pierre"]       = {1,1,1},
						["pioche-bois"]         = {1,1,3}
					}
				},
				{
					rolls = {3,3},
					items = {
						["pomme"]               = {1,2,5},
						["pain"]                = {1,2,3},
						["saumon-cru"]          = {1,2,3},
					}
				},
				{
					rolls = {4,4},
					items = {
						["bâton"]               = {1,12,10},
						["planches-chêne"]         = {1,12,10},
						["bûche-chêne"]            = {1,3,3},
						["bûche-bouleau"]            = {1,3,3},
						["bûche-sapin"]            = {1,3,3},
						["bûche-acajou"]            = {1,3,3},
						["bûche-acacia"]         = {1,3,3},
						["bûche-chêne-noir"]            = {1,3,3},
					}
				},
			},
			poolsDev = {}
		},
		["donjon"] = {
			header      = "[[Donjon]]",
			link        = "[[donjon]]",
			structure = "Donjon",
			conteneur = "Coffre de donjon",
			structID = "donjon",
			pools = {
				{
					rolls = {1,3},
					items = {
						["selle"]              = {1,1,20},
						["pomme-dorée"]        = {1,1,15},
						["pomme-dorée-enchantée"] = {1,1,2},
						["disque-doré"]             = {1,1,15},
						["disque-vert"]            = {1,1,15},
						["étiquette"]            = {1,1,20},
						["armure-cheval-or"]    = {1,1,10},
						["armure-cheval-fer"]    = {1,1,15},
						["armure-cheval-diamant"] = {1,1,5},
						["livre-enchanté-alt"]  = {1,1,10},
					}
				},
				{
					rolls = {1,4},
					items = {
						["lingot-fer"]          = {1,4,10},
						["lingot-or"]           = {1,4,5},
						["pain"]                = {1,1,20},
						["blé"]                 = {1,4,20},
						["seau"]                = {1,1,10},
						["redstone"]            = {1,4,15},
						["charbon"]             = {1,4,15},
						["graines-pastèque"]    = {2,4,10},
						["graines-citrouille"]  = {2,4,10},
						["graines-betterave"]   = {2,4,10},
					}
				},
				{
					rolls = {3,3},
					items = {
						["os"]                = {1,8,10},
						["poudre-canon"]           = {1,8,10},
						["chair-putréfiée"]        = {1,8,10},
						["ficelle"]              = {1,8,10},
					}
				},
			},
			poolsDev = {}
		},
		["puits-mine-abandonné"] = {
			chest_type = "wagonnet de stockage",
			header      = "[[Puits de mine abandonné]]",
			link        = "[[puits de mine abandonné]]s",
			structure = "Mine abandonnée",
			conteneur = "Wagonnet de stockage",
			structID = "puits-mine-abandonné",
			pools = {
				{
					rolls = {1,1},
					items = {
						["pomme-dorée"]         = {1,1,20},
						["pomme-dorée-enchantée"] = {1,1,1},
						["étiquette"]           = {1,1,30},
						["livre-enchanté-alt"]  = {1,1,10},
						["pioche-fer"]          = {1,1,5},
						["vide"]				= {1,1,5},
					}
				},
				{
					rolls = {2,4},
					items = {
						["lingot-fer"]          = {1,5,10},
						["lingot-or"]           = {1,3,5},
						["redstone"]            = {4,9,5},
						["lapis-lazuli"]        = {4,9,5},
						["diamant"]             = {1,2,3},
						["charbon"]             = {3,8,10},
						["pain"]                = {1,3,15},
						["graines-pastèque"]    = {2,4,10},
						["graines-citrouille"]  = {2,4,10},
						["graines-betterave"]   = {2,4,10},
					}
				},
				{
					rolls = {3,3},
					items = {
						["rails"]                = {4,8,20},
						["rails-propulsion"]        = {1,4,5},
						["rails-détecteurs"]       = {1,4,5},
						["rails-déclencheurs"]      = {1,4,5},
						["torche"]               = {1,16,15},
					}
				},
			},
			poolsDev = {}
		},
		["forteresse-nether"] = {
			header      = "[[Forteresse du Nether|Forteresse]]<br>[[Forteresse du Nether|du Nether]]",
			link        = "[[forteresse du Nether]]",
			structure = "Forteresse du Nether",
			conteneur = "Coffre des allées",
			structID = "forteresse-nether",
			pools = {
				{
					rolls = {2,4},
					items = {
						["diamant"]              = {1,3,5},
						["lingot-fer"]           = {1,5,5},
						["lingot-or"]            = {1,3,15},
						["épée-or"]              = {1,1,5},
						["plastron-or"]          = {1,1,5},
						["briquet"]              = {1,1,5},
						["verrues-du-nether"]        = {3,7,5},
						["selle"]                = {1,1,10},
						["armure-cheval-or"]     = {1,1,8},
						["armure-cheval-fer"]    = {1,1,5},
						["armure-cheval-diamant"] = {1,1,3},
						["obsidienne"]           = {2,4,2},
					}
				},
			},
			poolsDev = {}
		},
		["temple-désert"] = {
			header      = "Temple du [[Pyramide|désert]]",
			link        = "[[Pyramide|temple du désert]]",
			structure = "Temple du désert",
			conteneur = "Coffre de la crypte",
			structID = "pyramides",
			pools = {
				{
					rolls = {2,4},
					items = {
						["diamant"]               = {1,3,5},
						["lingot-fer"]            = {1,5,15},
						["lingot-or"]             = {2,7,15},
						["émeraude"]              = {1,3,15},
						["os"]                    = {4,6,25},
						["œil-araignée"]          = {1,3,25},
						["chair-putréfiée"]       = {3,7,25},
						["selle"]                 = {1,1,20},
						["armure-cheval-fer"]     = {1,1,15},
						["armure-cheval-or"]      = {1,1,10},
						["armure-cheval-diamant"] = {1,1,5},
						["livre-enchanté"]        = {1,1,20},
						["pomme-dorée"]           = {1,1,20},
						["pomme-dorée-enchantée"] = {1,1,2},
						["vide"]                  = {1,1,15},
					}
				},
				{
					rolls = {4,4},
					items = {
						["os"]                  = {1,8,10},
						["poudre-canon"]        = {1,8,10},
						["chair-putréfiée"]     = {1,8,10},
						["ficelle"]             = {1,8,10},
						["sable"]               = {1,8,10},
					}
				},
			},
			poolsDev = {}
		},
		["temple-jungle"] = {
			header      = "[[Temple de la jungle]]",
			link        = "[[temple de la jungle]]",
			structure = "Temple de la jungle",
			conteneur = "Coffre du temple",
			structID = "temple-jungle",
			poolsDev = {},
			pools = {
				{
					rolls = {2,6},
					items = {
						["diamant"]             = {1,3,3},
						["lingot-fer"]          = {1,5,10},
						["lingot-or"]          = {2,7,15},
						["émeraude"]             = {1,3,2},
						["armure-cheval-fer"]    = {1,1,1},
						["armure-cheval-or"]    = {1,1,1},
						["armure-cheval-diamant"] = {1,1,1},
						["bambou"]              = {1,3,15},
						["selle"]              = {1,1,3},
						["livre-enchanté-alt"]  = {1,1,1},
						["os"]                = {4,6,20},
						["chair-putréfiée"]        = {3,7,16}
					}
				},
			}
		},
		["distributeur-temple-jungle"] = { -- jungle_temple_dispenser.json
			chest_type = "distributeur",
			header      = "[[Temple de la jungle]]",
			link   = "[[temple de la jungle]]",
			structure = "Temple de la jungle",
			conteneur = "Distributeurs du temple",
			structID = "temple-jungle",
			pools = {
				{
					rolls = {1,2},
					items = {
						["flèche"] = {2,7,30}
					}
				},
			},
			poolsDev = {}
		},
		["ville-end"] = {
			header      = "[[Ville de l'End]]",
			link        = "[[ville de l'End]]",
			structure = "Ville de l'End",
			conteneur = "Coffre des villes",
			structID = "ville-end",
			pools = {
				{
					rolls = {2,6},
					items = {
						["diamant"]             = {2,7,5},
						["lingot-fer"]          = {4,8,10},
						["lingot-or"]          = {2,7,15},
						["émeraude"]             = {2,6,2},
						["graines-betterave"]      = {1,10,5},
						["selle"]              = {1,1,3},
						["armure-cheval-fer"]    = {1,1,1},
						["armure-cheval-or"]    = {1,1,1},
						["armure-cheval-diamant"] = {1,1,1},
						["épée-diamant-enchantée"]      = {1,1,3},
						["bottes-diamant-enchantées"]      = {1,1,3},
						["plastron-diamant-enchanté"] = {1,1,3},
						["jambières-diamant-enchantées"]   = {1,1,3},
						["casque-diamant-enchanté"]     = {1,1,3},
						["pioche-diamant-enchantée"]    = {1,1,3},
						["pelle-diamant-enchantée"]     = {1,1,3},
						["épée-fer-enchantée"]         = {1,1,3},
						["bottes-fer-enchantées"]         = {1,1,3},
						["plastron-fer-enchanté"]    = {1,1,3},
						["jambières-fer-enchantées"]      = {1,1,3},
						["casque-fer-enchanté"]        = {1,1,3},
						["pioche-fer-enchantée"]       = {1,1,3},
						["pelle-fer-enchantée"]        = {1,1,3},
					}
				},
			},
			poolsDev = {}
		},
		["igloo"] = {
			header      = "[[Igloo]]",
			link        = "[[igloo]]",
			structure = "Igloo",
			conteneur = "Coffre de la cave",
			structID = "igloo",
			pools = {
				{
					rolls = {2,8},
					items = {
						["pomme"]               = {1,3,15},
						["charbon"]             = {1,4,15},
						["pépite-or"]           = {1,3,10},
						["hache-pierre"]        = {1,1,2},
						["chair-putréfiée"]     = {1,1,10},
						["émeraude"]            = {1,1,1},
						["blé"]                 = {2,3,10}
					}
				},
				{
					rolls = {1,1},
					items = {
						["pomme-dorée"]         = {1,1,1},
					}
				},
			},
			poolsDev = {}
		},
		["manoir"] = { -- woodland_mansion.json
			header = "[[Manoir]]",
			link   = "[[manoir]]s",
			structure = "Manoir",
			conteneur = "Coffre du manoir",
			structID = "manoir",
			pools = {
				{
					rolls = {1,3},
					items = {
						["laisse"]                 	= {1,1,20},
						["pomme-dorée"]            	= {1,1,15},
						["pomme-dorée-enchantée"]  	= {1,1,2},
						["disque-doré"]            	= {1,1,15},
						["disque-vert"]            	= {1,1,15},
						["étiquette"]              	= {1,1,20},
						["cotte-de-mailles"]		= {1,1,10},
						["houe-diamant"]           	= {1,1,15},
						["plastron-diamant"]       	= {1,1,5},
						["livre-enchanté-alt"]     	= {1,1,10},
					}
				},
				{
					rolls = {1,4},
					items = {
						["lingot-fer"]             = {1,4,10},
						["lingot-or"]              = {1,4,5},
						["pain"]                   = {1,1,20},
						["blé"]                    = {1,4,20},
						["seau"]                   = {1,1,10},
						["redstone"]               = {1,4,15},
						["charbon"]                = {1,4,15},
						["graines-pastèque"]       = {2,4,10},
						["graines-citrouille"]     = {2,4,10},
						["graines-betterave"]      = {2,4,10},
					}
				},
				{
					rolls = {3,3},
					items = {
						["os"]                     = {1,8,10},
						["poudre-canon"]           = {1,8,10},
						["chair-putréfiée"]        = {1,8,10},
						["ficelle"]                = {1,8,10},
					}
				},
			},
			poolsDev = {}
		},
	},

	-- these values are used:
	-- * in place of the keys, when the key is used as a parameter
	
	-- chest-param -> internally-valid-chest-param
	
	synonyms = {
		["jungle"] = "temple-jungle",
		["pyramide"] = "temple-désert",
		["nether"] = "forteresse-nether",
		["forteresse"] = "forteresse-nether",
		["village"] = "forge-village",
		["forge"] = "village-forge",
		["armurerie"] = "village-armurerie",
		["boucherie"] = "village-boucherie",
		["cartographe"] = "village-cartographe",
		["maçon"] = "village-maçon",
		["bergerie"] = "village-bergerie",
		["tannerie"] = "village-tannerie",
		["forgeron-armes"] = "village-forgeron-armes",
		["désert"] = "village-désert",
		["plaine"] = "village-plaine",
		["savane"] = "village-savane",
		["toundra"] = "village-toundra",
		["taïga"] = "village-taïga",
		["2-pièces"] = "village-maison-2-pièces",
		["autel"] = "autel-fort",
		["entrepôt"] = "entrepôt-fort",
		["bibliothèque"] = "bibliothèque-fort"
	},

	-- these values are used:
	-- * in the header-description of a table showing only a single chest
	-- * if the key is not here, but it is a valid chest parameter,
	--   that header-description will default to use the key string from p.chests,
	--   e.g. "forteresse-nether"
	
	-- chest-param -> description-string
	
	display_names = {
		["puits-mine-abandonné"] = "puits de mine abandonné",
		["forteresse-nether"] = "forteresse du Nether",
		["nether"] = "forteresse du Nether",
		["forteresse"] = "forteresse du Nether",
		["village-forge"] = "forge de village",
		["village"] = "forge de village",
		["forge"] = "forge de village",
		["armurerie"] = "armurerie de village",
		["boucherie"] = "boucherie de village",
		["cartographe"] = "cartographe de village",
		["maçon"] = "maçon de village",
		["bergerie"] = "bergerie de village",
		["tannerie"] = "tannerie de village",
		["forgeron-armes"] = "forgeron d'armes de village",
		["désert"] = "maison de village du desert",
		["plaine"] = "maison de village des plaines",
		["savane"] = "maison de village de la savane",
		["toundra"] = "maison de village de la toundra",
		["taïga"] = "maison de village de la taïga",
		["2-pièces"] = "maison 2 pièces de village",
		["jungle"] = "temple de la jungle",
		["temple-désert"] = "pyramide",
		["temple-jungle"] = "temple de la jungle",
		["distributeur-temple-jungle"] = "temple de la jungle",
		["autel-fort"] = "autel",
		["bibliothèque-fort"] = "bibliothèque",
		["entrepôt-fort"] = "entrepôt",
		["ville-end"] = "ville de l\'End"
	},
	
	-- these descriptions are used:
	-- * in column <abbr> titles,
	-- * and above the table when only a single column-type is chosen
	
	columns = {
		["taillepiles"] = "la taille des piles d&apos;objets (ou le nombre d&apos;objets pas empilables) pouvant être trouvées dans ce coffre. Une pile est un &quot;stack&quot; en anglais.",
		["poids"] = "le poids relatif de cet objet par rapport aux autres objets du coffre.",
		["objets"] = "le nombre d&apos;objets espérés par coffre (moyenne pour un grand nombre de coffres).",
		["probabilité"] = "la probabilité d&apos;obtenir l&apos;un de ces objets dans le coffre.",
		["coffres"] = "le nombre moyen de coffres à ouvrir pour espérer trouver l&apos;un de ces objets."
	},
	
	current_frame = nil
}

p.base = function( ... )

	p.current_frame = mw.getCurrentFrame()

	local args = { ... }
	if args[1] == p.current_frame then 
		args = require( 'Module:ProcessArgs' ).merge( true )
	else
		args = args[1]
	end
	
	-- transform args into usable list
	
	local chests, columns = q.massage_args( args )
	
	if #chests == 0 then
		return "<span class='error'>Module:CoffreRécompenses : arguments invalides</span>"
	end

	q.fill_in_chest_derivative_data( chests )
	
	-- construct an ordered list dictating the order of the rows
	
	local ordered_item_rows, ordered_item_rows_dev

	local ret = {}
	if args.dev and args.dev ~= '0' then
		local ordered_item_rows = q.construct_ordered_item_rows( chests, 'Dev' )
		if q.tablelength( ordered_item_rows ) > 0 then
			table.insert( ret, q.print_table( chests, columns, ordered_item_rows, 'Dev' ) )
		end
	else
		local ordered_item_rows = q.construct_ordered_item_rows( chests, '' )
		local ordered_item_rows_dev = q.construct_ordered_item_rows( chests, 'Dev' )

		if q.tablelength( ordered_item_rows ) > 0 then
			table.insert( ret, q.print_table( chests, columns, ordered_item_rows, '' ) )
		end
		if q.tablelength( ordered_item_rows_dev ) > 0 and q.compare_tables( ordered_item_rows, ordered_item_rows_dev ) then
			table.insert( ret, p.current_frame:preprocess( p.dev ) .. q.lcfirst( q.print_table( chests, columns, ordered_item_rows_dev, 'Dev' ) ) )
		end
	end

	return table.concat( ret, '\n\n' )
end

p.doc = function()

	local valid_args = {}
	for chest_name, val in pairs(p.chests) do
		local synonyms = {}
		for syn, orig in pairs(p.synonyms) do
			if orig == chest_name then
				table.insert( synonyms, syn )
			end
		end
		if #synonyms > 0 then
			chest_name = chest_name .. " ( " .. table.concat( synonyms, ", " ) .. " )"
		end
		table.insert( valid_args, chest_name )
	end
	table.sort( valid_args )
	return table.concat( valid_args, ",\n<br>" )

end

p.doc2 = function()

	local valid_args = {}
	for column_name, val in pairs(p.columns) do
		table.insert( valid_args, column_name .. ": " .. val )
	end
	table.sort( valid_args )
	return table.concat( valid_args, ",\n<br>" )

end

p.doc3 = function()

	local valid_args = {}
	for item_name, val in pairs(p.items) do
		table.insert( valid_args, item_name )
	end
	table.sort( valid_args )
	return table.concat( valid_args, ", " )

end

p.base2 = function( ... )

	p.current_frame = mw.getCurrentFrame()

	local args = { ... }
	if args[1] == p.current_frame then 
		args = require( 'Module:ProcessArgs' ).merge( true )
	else
		args = args[1]
	end
	
	local z = args[1]
	
	local rC = {}
	local rDC = {}
	local rErr = ""
	
	local zT = {}
	if args[1] == "!!!TOUS!!!" then
		for item_name, v in pairs( p.items ) do
			table.insert( zT, item_name )
			table.sort( zT )
		end
	else
		zT = mw.text.split( args[1], ',' )
	end
	
	local mDev = ""
	for x, itemname in pairs( zT ) do
		if p.items[itemname] == nil then
			rErr = rErr .. "<span class='error'>Objet " .. itemname .. " inconnu</span>\n"
		else
			local chances, devChances
			if args.dev and args.dev ~= '0' then
				chances = q.single_item_find_values( itemname, 'poolsDev' )
				devChances = {}
			else
				chances = q.single_item_find_values( itemname, 'pools' )
				devChances = q.single_item_find_values( itemname, 'poolsDev' )
			end
			
			if q.tablelength( chances ) > 0 then
				table.insert( rC, p.base2_sub( itemname, chances ) )
			end
			if q.tablelength( devChances ) > 0 and q.compare_tables( chances, devChances ) then
				if mDev == "" then
					mDev = '|-\n!colspan=5| À venir en [[1.15]] \n'	
				end
				table.insert( rDC, p.base2_sub( itemname, devChances ) )
			end
		end	
	end
	
	return rErr .. '{| class="wikitable" \n! Objet \n! Structure \n! Conteneur \n! Quantité \n! Chance \n' .. table.concat( rC ) .. mDev .. table.concat( rDC ) .. '|}' .. p.current_frame:extensionTag( 'references', "", { group="note" } )
end

p.base2_sub = function( itemname, chances )
	local html = {}
	local item_display_name = ''
	local output = ""
	lang = mw.getContentLanguage()
	
	if p.items[itemname].title ~= nil then
		item_display_name = p.items[itemname].title
	else
		item_display_name = string.gsub( itemname, '-', ' ' )
	end
	
	item_display_name = q.capitalize( item_display_name )

	local listeObjet = {}
	local ns = q.tablelength( chances )
	local s = 0
	local m = 0
	
	local rn = 0

	for stacksize, chest_details in pairs( chances ) do
		s = s + 1
		
		local nc = q.tablelength( chest_details )
		local c = 0
		for k, chest in pairs( chest_details ) do
			c = c + 1
			rn = rn + 1
			local r = ""
			
			r = r .. '|' .. p.chests[chest.chest_name].conteneur  .. '\n|' .. stacksize .. '\n|' .. lang:formatNum( math.floor( chest.chance*1000 + 0.5 ) /10 ) .. ' %' .. '\n'
			if ns ~= s or nc ~= c then
				r = r 
			end
			
			table.insert( listeObjet , { p.chests[chest.chest_name].structID , p.chests[chest.chest_name].structure, r } )
			
		end
		m = m + nc
	end
	table.sort( listeObjet, function(a,b) return a[1] < b[1] end )
	local struct = ""
	local t = ""
	local nt = 1
	local ntt = 0
	for v, w  in pairs( listeObjet ) do
		ntt = ntt + 1
		if w[1] ~= struct then
			if t ~= "" then
				output = output .. "|rowspan=" .. nt .. t
			end
			t = "|'''" .. p.current_frame:expandTemplate{ title = 'LienEnv', args = { w[2],  id = w[1] } } .. "'''\n" .. w[3]
			struct = w[1]
			nt = 1
		else
			t = t .. w[3]
			nt = nt + 1
		end
		if ntt == m then
			output = output .. "|rowspan=" .. nt .. t
		else
			t = t .. '|-' .. '\n'
		end
	end

	return "|-\n| rowspan=" .. m .. "|'''" .. p.getItem(itemname, item_display_name) .. "'''\n" .. output
	
end

p.getItem = function( itemname, item_display_name )
	local s = ""
	local k = item_display_name
	local link = item_display_name
	local m = itemname
	
	if p.items[itemname].title ~= nil then
		k = p.items[itemname].title
	end
	if p.items[itemname].link ~= nil then
		link = p.items[itemname].link
	end
	if p.items[itemname].id ~= nil then
		m = p.items[itemname].id
	end
	
	if p.items[itemname][1] == "objet" then
		s = p.current_frame:expandTemplate{ title = 'LienObjet', args = { link , k , id = m } }
	elseif p.items[itemname][1] == "bloc" then
		s = p.current_frame:expandTemplate{ title = 'LienBloc', args = { link , k , id = m } }
	end
	if p.items[itemname].note ~= nil and p.items[itemname].note ~= "" then
		s = s .. p.current_frame:extensionTag( 'ref', p.notes[p.items[itemname].note], { group='note', name=p.items[itemname].note } )
	end
	return s
	
end

q = {

	tablelength = function(T)
		local count = 0
		for _ in pairs(T) do count = count + 1 end
		return count
	end,
	
	single_item_find_values = function( itemname, key )
	
		local chances = {}

		for chest_name, chest in pairs( p.chests ) do
			local poolchances = {}
			for k, pool in pairs( chest[key] or chest.pools or {} ) do
				local poolitem = pool.items[itemname]
				if poolitem ~= nil then
				
					local stacksize = poolitem[1]
					if poolitem[1] ~= poolitem[2] then
					stacksize = stacksize .. "-" .. poolitem[2]
				end
					
				local itemweight = poolitem[3]
					
				local pool_total_item_weight = 0
				for itemname, item in pairs(pool.items) do
					pool_total_item_weight = pool_total_item_weight + item[3]
				end
				
				local chance = p.calc_chance_any_of_this_item_per_pool( 
					pool.rolls[1], pool.rolls[2],
					itemweight, pool_total_item_weight )

				if poolchances[stacksize] == nil then
					poolchances[stacksize] = chance
				else
					poolchances[stacksize] = poolchances[stacksize] + (1 - poolchances[stacksize]) * chance
				end
			end
		end
			for stacksize, chance in pairs( poolchances ) do
				if chances[stacksize] == nil then
					chances[stacksize] = {}
				end
				table.insert( chances[stacksize], { ["chance"]=chance, ["chest_name"]=chest_name, ["chest_type"]=( chest.chest_type or "coffre" ) } )
			end
		end

		return chances
		
	end,
	
	massage_args = function( args )

		-- find what columns to put
		
		local columns = {}
		
		for k, _arg in pairs(args) do
			if p.columns[_arg] ~= nil then
				columns[_arg] = true
			end
		end
		
		if q.tablelength(columns) == 0 then
			for column_name, v in pairs(p.columns) do
				columns[column_name] = true
			end
		end
		
		-- find what chests to show

		local chests = {}
		
		for k, _arg in pairs(args) do
			if p.chests[_arg] ~= nil then
				table.insert( chests, _arg )
			elseif p.synonyms[_arg] ~= nil then 
				table.insert( chests, p.synonyms[_arg] )
			end
			if p.display_names[_arg] ~= nil then
				local chestname = _arg
				if p.chests[chestname] == nil then 
					chestname = p.synonyms[_arg]
				end
				p.chests[chestname].display_name = p.display_names[_arg]
			end
		end
		
		if #chests == 0 then
			for chest_name, chest in pairs(p.chests) do
				local chest_type = ( chest.chest_type or "coffre" )
				if chest_type == "coffre" or chest_type == "wagonnet de stockage" then
					table.insert( chests, chest_name )
				end
			end
		end
		
		table.sort( chests )
		
		return chests, columns
		
	end,

	sort_items = function( e1, e2 )
		
		if e1.chanceany ~= e2.chanceany then return ( e1.chanceany > e2.chanceany ) end
		if e1.avgamount ~= e2.avgamount then return ( e1.avgamount > e2.avgamount ) end
		
		if e1.material == nil then
			
			e1.material = 0
			if string.find( e1.itemname, "cuir" ) ~= nil then e1.material = 1 end
			if string.find( e1.itemname, "fer" ) ~= nil then e1.material = 2 end
			if string.find( e1.itemname, "or" ) ~= nil then e1.material = 3 end
			if string.find( e1.itemname, "diamant" ) ~= nil then e1.material = 4 end
			e1.armor = 0
			if string.find( e1.itemname, "casque" ) ~= nil or string.find( e1.itemname, "chapeau" ) ~= nil then e1.armor = 1 end
			if string.find( e1.itemname, "plastron" ) ~= nil or string.find( e1.itemname, "tunique" ) ~= nil then e1.armor = 2 end
			if string.find( e1.itemname, "jambières" ) ~= nil or string.find( e1.itemname, "pantalon" ) ~= nil then e1.armor = 3 end
			if string.find( e1.itemname, "bottes" ) ~= nil then e1.armor = 4 end
			
		end
		
		if e2.material == nil then
			
			e2.material = 0
			if string.find( e2.itemname, "cuir" ) ~= nil then e2.material = 1 end
			if string.find( e2.itemname, "fer" ) ~= nil then e2.material = 2 end
			if string.find( e2.itemname, "or" ) ~= nil then e2.material = 3 end
			if string.find( e2.itemname, "diamant" ) ~= nil then e2.material = 4 end
			e2.armor = 0
			if string.find( e2.itemname, "casque" ) ~= nil or string.find( e2.itemname, "chapeau" ) ~= nil then e2.armor = 1 end
			if string.find( e2.itemname, "plastron" ) ~= nil or string.find( e2.itemname, "tunique" ) ~= nil then e2.armor = 2 end
			if string.find( e2.itemname, "jambières" ) ~= nil or string.find( e2.itemname, "pantalon" ) ~= nil then e2.armor = 3 end
			if string.find( e2.itemname, "bottes" ) ~= nil then e2.armor = 4 end
		
		end
		
		if e1.material ~= e2.material then return ( e1.material < e2.material ) end
		if e1.armor ~= e2.armor then return ( e1.armor < e2.armor ) end
		
		return ( e1.itemname < e2.itemname )
		
	end,
	
	fill_in_chest_derivative_data = function( chest_names )

		for k, chest_name in pairs(chest_names) do
			local chest = p.chests[chest_name]
			if chest == nil then break end

			chest.allRolls = {}
			chest.itemData = {}
			for k, pool in pairs( chest.pools or {} ) do
				table.insert( chest.allRolls, q.tern( pool.rolls[1] == pool.rolls[2], pool.rolls[1], pool.rolls[1]..' à '..pool.rolls[2] ) )

				local total_weight = 0
				for itemname, item in pairs(pool.items) do
					total_weight = total_weight + item[3]
				end
				pool.totalweight = total_weight

				q.fill_in_chest_item_details( chest.itemData, pool, #chest.allRolls )
			end

			chest.allRollsDev = {}
			chest.itemDataDev = {}
			for k, pool in pairs( chest.poolsDev or chest.pools or {} ) do
				table.insert( chest.allRollsDev, q.tern( pool.rolls[1] == pool.rolls[2], pool.rolls[1], pool.rolls[1]..' à '..pool.rolls[2] ) )

				local total_weight = 0
				for itemname, item in pairs(pool.items) do
					total_weight = total_weight + item[3]
				end
				pool.totalweight = total_weight

				q.fill_in_chest_item_details( chest.itemDataDev, pool, #chest.allRollsDev )
			end
		end
	end,

	fill_in_chest_item_details = function( data, pool, ct )
		for item_name, item in pairs(pool.items) do
			if p.items[item_name] then
				local min_stacksize = item[1]
				local max_stacksize = item[2]
				local min_pool_rolls = pool.rolls[1]
				local max_pool_rolls = pool.rolls[2]
				local item_weight = item[3]
			
				if data[item_name] == nil then
					data[item_name] = {
						avgamount = 0,
						chanceany = 0,
						itemname = item_name,
						sortsize = {},
						sortweight = {},
						sizes = {},
						weights = {},
					}
					for i = 1, ct-1 do
						data[item_name].sortsize[i] = 0
						data[item_name].sortweight[i] = 0
						data[item_name].sizes[i] = '—'
						data[item_name].weights[i] = '—'
					end
				end

				data[item_name].avgamount = data[item_name].avgamount + p.calc_average_amount_this_item_per_pool( 
					min_stacksize, max_stacksize, 
					min_pool_rolls, max_pool_rolls, 
					item_weight, pool.totalweight )
					
				data[item_name].chanceany = data[item_name].chanceany + (1 - data[item_name].chanceany) * p.calc_chance_any_of_this_item_per_pool(
					min_pool_rolls, max_pool_rolls, 
					item_weight, pool.totalweight )

				data[item_name].sortsize[ct] = ( min_stacksize + max_stacksize ) / 2
				data[item_name].sortweight[ct] = item_weight;
				data[item_name].sizes[ct] = q.tern( min_stacksize == max_stacksize, min_stacksize, min_stacksize .. '–' .. max_stacksize )
				data[item_name].weights[ct] = p.current_frame:expandTemplate{ title = 'fraction', args = { item_weight, pool.totalweight } }
			end
		end

		for item_name, d in pairs(data) do
			if not d.sizes[ct] then
				d.sortsize[ct] = 0
				d.sortweight[ct] = 0
				d.sizes[ct] = '—'
				d.weights[ct] = '—'
			end
		end
	end,

	construct_ordered_items_from_first_chest = function( chest_names, suffix )
		local items_from_first_table = {}
		local item_chests = {}
		local item_names_ordered = {}
		for item_name, item in pairs( p.chests[chest_names[1]]['itemData'..suffix] ) do
			table.insert( items_from_first_table, item )
		end
		
		table.sort( items_from_first_table, q.sort_items )
		
		for k, item in pairs( items_from_first_table ) do
			table.insert( item_names_ordered, item.itemname )
			item_chests[item.itemname] = true
		end
		
		return item_names_ordered, item_chests
	end,

	get_ordered_items_from_other_chests = function( chest_names, item_chests, suffix )
		local items_not_from_first_table = {}
		
		for chest_idx = 2, #chest_names do
			for item_name, item in pairs( p.chests[chest_names[chest_idx]]['itemData'..suffix] ) do
				if item_chests[item_name] == nil then
					p.items[item_name].itemname = item_name
					table.insert( items_not_from_first_table, p.chests[chest_names[chest_idx]]['itemData'..suffix][item_name] )
					item_chests[item_name] = true
				end
			end
		end

		table.sort( items_not_from_first_table, q.sort_items )
		
		return items_not_from_first_table
	end,

	add_other_items_to_first_list = function( chest_names, item_names_ordered, item_chests, items_not_from_first_table )
		for k, item in pairs( items_not_from_first_table ) do
			table.insert( item_names_ordered, item.itemname )
		end
		
		return item_names_ordered
	end,

	set_up_ordered_item_rows = function( chest_names, item_names_ordered, suffix )
		for k, itemname in pairs(item_names_ordered) do
			item_names_ordered[k] = {itemname}
			for chest_idx = 1, #chest_names do
				if suffix == 'Dev' or p.chests[chest_names[chest_idx]]['pools'..suffix] ~= nil then
					local item_data = p.chests[chest_names[chest_idx]]['itemData'..suffix][itemname]
					if item_data == nil then
						table.insert( item_names_ordered[k], false )
					else
						table.insert( item_names_ordered[k], item_data )
					end				
				end
			end
		end

		return item_names_ordered
	end,

	construct_ordered_item_rows = function( chest_names, suffix )
		-- for the first chest, sort its by chance desc, then by avg amount desc, then alphabetically asc
		local item_names_ordered, item_chests = q.construct_ordered_items_from_first_chest( chest_names, suffix )
		
		if #chest_names > 1 then
			-- after that, sort all the remaining items in list order
			local items_not_from_first_table = q.get_ordered_items_from_other_chests( chest_names, item_chests, suffix )
			item_names_ordered = q.add_other_items_to_first_list( chest_names, item_names_ordered, item_chests, items_not_from_first_table )
		end

		-- set up item_names_ordered so that each is a row, representing chest values
		item_names_ordered = q.set_up_ordered_item_rows( chest_names, item_names_ordered, suffix )
		
		return item_names_ordered
	end,

	print_table = function( chest_names, columns, ordered_item_rows, suffix )

		local html = {}
		
		local use_roll_row = false
		local use_superheader = false
		local superheader_sizes = {}
		for i = 1, #chest_names do
			sh = p.chests[chest_names[i]].superheader
			if sh ~= nil then
				if superheader_sizes[sh] == nil then
					superheader_sizes[sh] = 0
				end
				superheader_sizes[sh] = superheader_sizes[sh] + 1
				use_superheader = true
			end
			local allRolls = p.chests[chest_names[i]]['allRolls'..suffix]
			if #allRolls > 1 then
				use_roll_row = true
			end
		end
		if columns['taillepiles'] == nil and columns['poids'] == nil then
			use_roll_row = false
		end
		
		local rowspan = ( 1 + q.tern( #chest_names > 1, 1, 0 ) + q.tern( use_superheader, 1, 0 ) )
		local hide_col_description = rowspan > 1 and q.tablelength(columns) == 1
		if use_roll_row then
			rowspan = rowspan + 1
		end
		
		if q.tablelength(columns) == 1 then
			for column_name, v in pairs(columns) do
				table.insert( html, "Les valeurs représentent " )
				table.insert( html, p.columns[column_name] )
				table.insert( html, "\n" )
			end
		end

		if #chest_names == 1 then
		
			if q.tablelength(columns) == 1 then
				table.insert( html, "<br>" )
			end
		
			local chest_name = chest_names[1]
			local allRolls = p.chests[chest_name]['allRolls'..suffix]
			local chest_type = p.chests[chest_name].chest_type or "coffre"

			local display_name = p.chests[chest_name].display_name

			chest_name = chest_name:gsub( "-", " " )
			
			table.insert( html, "Chaque coffre " )
			if string.find(mw.ustring.lower(chest_name), 'bonus') == nil then -- "coffre bonus", pas "coffre de bonus"
				if string.find(mw.ustring.lower(chest_name), '^[aeiouyéÉ]') ~= nil then -- "coffre d'entrepôt", pas "coffre de entrepôt"
					table.insert( html, "d'" )
				else
					table.insert( html, "de " )
				end
			end
			table.insert( html, display_name or chest_name )
			table.insert( html, " contient " )
			if #allRolls == 1 then
				table.insert( html, allRolls[1] )
			else
				table.insert( html, #allRolls )
				table.insert( html, ' groupes de ' )
				local s = q.tern( #allRolls > 2, ', ', ' ' )
				for i = 1, #allRolls-1 do
					table.insert( html, allRolls[i] )
					table.insert( html, s )
				end
				table.insert( html, 'et ' )
				table.insert( html, allRolls[#allRolls] )
			end
			table.insert( html, " piles d'objets, avec la répartition suivante : \n" )
		end
		
		table.insert( html, '<div style="overflow:auto">\n' )
		table.insert( html, "<table class='wikitable sortable jquery-tablesorter'>\n" )
		table.insert( html, "<tr>\n" )
		table.insert( html, "<th rowspan=" )
		table.insert( html, ( rowspan - q.tern( hide_col_description, 1, 0 ) ) )
		table.insert( html, "></th>\n" )
		
		local superheader_cols_used = {}
		
		if #chest_names > 1 then
			local row1, row2 = {}, {}

			for i = 1, #chest_names do
			
				if suffix == 'Dev' or p.chests[chest_names[i]]['pools'..suffix] ~= nil then
					local allRolls = p.chests[chest_names[i]]['allRolls'..suffix]
					local colspan = q.tablelength(columns)
					local allRollsSpan = #allRolls == 0 and 1 or #allRolls
					if columns['taillepiles'] ~= nil then
						colspan = colspan - 1 + allRollsSpan
					end
					if columns['poids'] ~= nil then
						colspan = colspan - 1 + allRollsSpan
					end
					local row = row1
					
					rowspan = 1
					if use_superheader then
						sh = p.chests[chest_names[i]].superheader
						if sh ~= nil then
							if superheader_cols_used[sh] == nil then
								table.insert( row, "<th colspan=" )
								table.insert( row, ( colspan * superheader_sizes[sh] ) )
								table.insert( row, ">" )
								table.insert( row, sh )
								table.insert( row, "</th>\n" )
								superheader_cols_used[sh] = 0
							end
							row = row2
						else
							rowspan = rowspan + 1
						end
					end
					if use_roll_row and hide_col_description and #allRolls < 2 then
						rowspan = rowspan + 1
					end

					table.insert( row, "<th colspan=" )
					table.insert( row, colspan )
					if rowspan > 1 then
						table.insert( row, " rowspan=" )
						table.insert( row, rowspan )
					end
					table.insert( row, ">" )
					table.insert( row, p.chests[ chest_names[i] ].header )
					if #allRolls > 0 then
						table.insert( row, ' <br><span style="font-weight:normal; font-style:italic; font-size:11px;">(' )
						if #allRolls == 1 then
							table.insert( row, allRolls[1] )
						else
							local s = q.tern( #allRolls > 2, ', ', ' ' )
							for i = 1, #allRolls-1 do
								table.insert( row, allRolls[i] )
								table.insert( row, s )
							end
							table.insert( row, 'et ' )
							table.insert( row, allRolls[#allRolls] )
						end
						table.insert( row, ' piles)</span>' )
					end
					table.insert( row, "</th>\n" )
				end
			end
			
			table.insert( html, table.concat( row1 ) )
			table.insert( html, "</tr><tr>\n" )
			if #row2 then
				table.insert( html, table.concat( row2 ) )
				table.insert( html, "</tr><tr>\n" )
			end
		end

		if not hide_col_description then
			local headersort_th_open
			if use_roll_row then
				headersort_th_open = "<th rowspan='2' class='headersort' role='columnheader button' data-sort-type='number'> <abbr title='"
			else
				headersort_th_open = "<th class='headersort' role='columnheader button' data-sort-type='number'> <abbr title='"
			end
			for i = 1, #chest_names do
				if suffix == 'Dev' or p.chests[chest_names[i]]['pools'..suffix] ~= nil then
					local allRolls = p.chests[chest_names[i]]['allRolls'..suffix]
					local allRollsSpan = #allRolls == 0 and 1 or #allRolls
					local headersort_th_colspan_open
					if #allRolls > 1 then
						headersort_th_colspan_open = "<th colspan='" .. allRollsSpan .. "' role='columnheader'> <abbr title='"
					else
						headersort_th_colspan_open = headersort_th_open
					end

				if columns['taillepiles'] ~= nil then
					table.insert( html, headersort_th_colspan_open )
					table.insert( html, p.columns['taillepiles'] )
					table.insert( html, "'> Taille des piles </abbr></th>\n" )
				end
				if columns['poids'] ~= nil then
					table.insert( html, headersort_th_colspan_open )
					table.insert( html, p.columns['poids'] )
					table.insert( html, "'> Poids" )
					table.insert( html, "</abbr></th>\n" )
				end
				if columns['objets'] ~= nil then
					table.insert( html, headersort_th_open )
					table.insert( html, p.columns['objets'] )
					table.insert( html, "'> Nb d'objets </abbr></th>\n" )
				end
				if columns['probabilité'] ~= nil then
					table.insert( html, headersort_th_open )
					table.insert( html, p.columns['probabilité'] )
					table.insert( html, "'> Probabilité </abbr></th>\n" )
				end
				if columns['coffres'] ~= nil then
					table.insert( html, headersort_th_open )
					table.insert( html, p.columns['coffres'] )
					table.insert( html, "'> Nb coffres </abbr></th>\n" )
					end
				end
			end
			table.insert( html, "</tr><tr>\n" )
		end
		
		if use_roll_row then
			local rowcols = ( columns['taillepiles'] ~= nil and 1 or 0 ) + ( columns['poids'] ~= nil and 1 or 0 )
			for i = 1, #chest_names do
				local allRolls = p.chests[chest_names[i]]['allRolls'..suffix]
				if #allRolls > 1 then
					for j = 1, rowcols do
						for k = 1, #allRolls do
							table.insert( html, "<th class='headersort' role='columnheader button' data-sort-type='number' style='font-weight:normal'>" )
							table.insert( html, allRolls[k] )
							table.insert( html, "×</th>\n" )
						end
					end
				end
			end
			table.insert( html, "</tr><tr>\n" )
		end

		for i = 1, #ordered_item_rows do
			if type( ordered_item_rows[i] ) == "table" then
				for j = 1, #ordered_item_rows[i] do

					local chest_item = ordered_item_rows[i][j]
					
					if type( chest_item ) == "table" then
					
						local avg_amount = string.format("%.3f", chest_item.avgamount)
						local chance_any = string.format("%.1f", chest_item.chanceany*100) .. " %"
						local num_chests = string.format("%.1f", 1/chest_item.chanceany)
						
						table.insert( html, "\n" )
						if columns['taillepiles'] ~= nil then
							for k = 1, #chest_item.sizes do
								table.insert( html, "<td style='text-align:center;' data-sort-value='" )
								table.insert( html, chest_item.sortsize[k] )
								table.insert( html, "'>" )
								table.insert( html, chest_item.sizes[k] )
								table.insert( html, "</td>" )
							end
						end
						if columns['poids'] ~= nil then
							for k = 1, #chest_item.sizes do
								table.insert( html, "<td style='text-align:center;' data-sort-value='" )
								table.insert( html, chest_item.sortweight[k] )
								table.insert( html, "'>" )
								table.insert( html, chest_item.weights[k] )
								table.insert( html, "</td>" )
							end
						end
						if columns['objets'] ~= nil then
							table.insert( html, "<td style='text-align:center;'>" )
							table.insert( html, avg_amount )
							table.insert( html, "</td>" )
						end
						if columns['probabilité'] ~= nil then
							table.insert( html, "<td style='text-align:right;'>" )
							table.insert( html, chance_any )
							table.insert( html, "</td>" )
						end
						if columns['coffres'] ~= nil then
							table.insert( html, "<td style='text-align:right;'>" )
							table.insert( html, num_chests )
							table.insert( html, "</td>" )
						end
							
					elseif type( chest_item ) == "boolean" then
						local allRolls = p.chests[chest_names[j-1]]['allRolls'..suffix]
						local allRollsSpan = #allRolls == 0 and 1 or #allRolls

						table.insert( html, "\n" )
						if columns['taillepiles'] ~= nil then
							for k = 1, allRollsSpan do
								table.insert( html, "<td data-sort-value='0' style='text-align:center;'>—</td>" )
							end
						end
						if columns['poids'] ~= nil then
							for k = 1, allRollsSpan do
								table.insert( html, "<td data-sort-value='0' style='text-align:center;'>—</td>" )
							end
						end
						if columns['objets'] ~= nil then
							table.insert( html, "<td data-sort-value='0' style='text-align:center;'>—</td>" )
						end
						if columns['probabilité'] ~= nil then
							table.insert( html, "<td data-sort-value='0' style='text-align:right;'>—</td>" )
						end
						if columns['coffres'] ~= nil then
							table.insert( html, "<td data-sort-value='9e99' style='text-align:right;'>—</td>" )
						end
					else
						if i > 1 then
							table.insert( html, "</tr><tr>" )
						end
						
						local item = p.items[chest_item]
						
						local s = require( 'Module:Sprite' )
						table.insert( html, "\n<td>" )
						local image, spriteCat = s.link{ 
							id=item.id or chest_item, 
							link=item.link or item.title or string.gsub(chest_item,'-',' '),
							text=q.capitalize(item.title or string.gsub(chest_item,'-',' ')),
							data= q.tern( item[1] == 'objet', 'ObjetSprite', 'BlocSprite' )
						}
						table.insert( html, image )
						table.insert( html, spriteCat )
						if item.note and p.notes[item.note] then
							table.insert( html, p.current_frame:extensionTag( 'ref', p.notes[item.note], { group='note', name=item.note } ) )
						end
						table.insert( html, "</td>" )
					end
					
					if j == #ordered_item_rows[i] then
						table.insert( html, "</tr>" )
					end
					
				end
				table.insert( html, "\n" )
			end
		end
		
		table.insert( html, "</table></div>" )
		
		return table.concat( html )
		
	end,
	
	titlecase = function( str )
		local buf = {}
		for word in string.gfind(str, "%S+") do
			if word == "et" then
				table.insert( buf, word )
			else
				local first, rest = string.sub( word, 1, 1 ), string.sub( word, 2 )
				table.insert( buf, mw.ustring.upper(first) .. mw.ustring.lower(rest) )
			end
		end    
		return table.concat( buf, " " )
	end,
	
	capitalize = function( str )
		return ( str:gsub( "^%l", mw.ustring.upper ):gsub( "^é", "É" ) )
	end,
	
	lcfirst = function( str )
		return ( string.gsub( str, "^%u", string.lower ) )
	end,

	tern = function( cond , T , F )
		if cond then return T else return F end
	end,

	compare_tables = function( a, b )
		local seen = {}
		for k, v in pairs( a ) do
			if type( v ) ~= type( b[k] ) then
				return true
			end
			if v ~= b[k] then
				return true
			end
			if type( v ) == 'table' and q.compare_tables( v, b[k] ) then
				return true
			end
			seen[k] = true
		end
		for k, v in pairs( b ) do
			if not seen[k] then
				return true
			end
		end
		return false
	end,
}

string.lpad = function(str, len, char)
	if char == nil then char = ' ' end
	return string.rep(char, len - #(''..str)) .. str
end

return p