m (Traductions) |
m (7 avec la netherite) |
||
(47 versions intermédiaires par 8 utilisateurs non affichées) | |||
Ligne 1 : | Ligne 1 : | ||
local p = {} |
local p = {} |
||
+ | |||
+ | local breakingTimeHeader; |
||
+ | local function getBreakingTimeHeader( f ) |
||
+ | if breakingTimeHeader == nil then |
||
⚫ | |||
+ | end |
||
+ | return breakingTimeHeader |
||
+ | end |
||
+ | |||
p.row = function( f ) |
p.row = function( f ) |
||
+ | lang = mw.getContentLanguage() |
||
local args = require( [[Module:ProcessArgs]] ).norm() |
local args = require( [[Module:ProcessArgs]] ).norm() |
||
Ligne 15 : | Ligne 25 : | ||
table.insert( dplVars, val or '1' ) |
table.insert( dplVars, val or '1' ) |
||
end |
end |
||
⚫ | |||
⚫ | |||
local rows = {} |
local rows = {} |
||
local tableParts = {} |
local tableParts = {} |
||
+ | local categories = {} |
||
local horizontal |
local horizontal |
||
Ligne 30 : | Ligne 39 : | ||
local header, sortable, simple |
local header, sortable, simple |
||
if horizontal or not getDplVar( 'header' ) then |
if horizontal or not getDplVar( 'header' ) then |
||
− | if args. |
+ | if args.cacheroutil or horizontal and ( not args[2] or args[2]:lower() == 'tous' or args[2]:lower() == 'aucun' ) then |
showTool = false |
showTool = false |
||
setDplVar( 'hidetool' ) |
setDplVar( 'hidetool' ) |
||
end |
end |
||
− | if args. |
+ | if args.cachercisailles or horizontal and not args.cisailles then |
showShears = false |
showShears = false |
||
setDplVar( 'hideshears' ) |
setDplVar( 'hideshears' ) |
||
end |
end |
||
− | if args |
+ | if args['cacherépée'] or horizontal and not args['épée'] then |
showSword = false |
showSword = false |
||
setDplVar( 'hidesword' ) |
setDplVar( 'hidesword' ) |
||
end |
end |
||
− | sortable = not horizontal and args. |
+ | sortable = not horizontal and args.tri |
if sortable then |
if sortable then |
||
setDplVar( 'sortable' ) |
setDplVar( 'sortable' ) |
||
Ligne 71 : | Ligne 80 : | ||
if not simple then |
if not simple then |
||
− | table.insert( header, '! ' .. rowspan .. sortType .. ' | |
+ | table.insert( header, '! ' .. rowspan .. sortType .. ' | Dureté' ) |
if showTool then |
if showTool then |
||
table.insert( header, '! ' .. rowspan .. ' | Outil' ) |
table.insert( header, '! ' .. rowspan .. ' | Outil' ) |
||
Ligne 79 : | Ligne 88 : | ||
local toolColumns = {} |
local toolColumns = {} |
||
if showTool then |
if showTool then |
||
− | toolColumns = { 'Bois', 'Pierre', 'Fer', 'Diamant', 'Or' } |
+ | toolColumns = { 'Bois', 'Pierre', 'Fer', 'Diamant', 'Netherite', 'Or' } |
end |
end |
||
table.insert( |
table.insert( |
||
toolColumns, 1, |
toolColumns, 1, |
||
− | '<abbr title="Inclut aussi les objets divers et l\'utilisation |
+ | '<abbr title="Inclut aussi les objets divers et l\'utilisation d\'un mauvais outil.">Poing</abbr>' |
) |
) |
||
if not simple then |
if not simple then |
||
Ligne 95 : | Ligne 104 : | ||
if not horizontal then |
if not horizontal then |
||
− | table.insert( header, '! colspan="' .. #toolColumns .. '" |' .. |
+ | table.insert( header, '! colspan="' .. #toolColumns .. '" |' .. getBreakingTimeHeader( f )) |
table.insert( header, '|-' ) |
table.insert( header, '|-' ) |
||
end |
end |
||
Ligne 131 : | Ligne 140 : | ||
Fer = 3, |
Fer = 3, |
||
Diamant = 4, |
Diamant = 4, |
||
− | + | Netherite = 5, |
|
+ | Aucun = 6 |
||
} |
} |
||
local materialSpeed = { |
local materialSpeed = { |
||
Ligne 140 : | Ligne 150 : | ||
Fer = 6, |
Fer = 6, |
||
Diamant = 8, |
Diamant = 8, |
||
+ | Netherite = 9, |
||
Or = 12 |
Or = 12 |
||
} |
} |
||
⚫ | |||
+ | local nombreMateriaux = 6 |
||
+ | |||
local insertBlock = function( blockArgs ) |
local insertBlock = function( blockArgs ) |
||
local cells = {} |
local cells = {} |
||
local blocks = mw.text.split( blockArgs[1], '%s*,%s*' ) |
local blocks = mw.text.split( blockArgs[1], '%s*,%s*' ) |
||
− | local hardnessVal = tonumber( hardness{ blocks[1], type = ' |
+ | local hardnessVal = tonumber( hardness{ blocks[1], type = 'dureté' } ) |
if not hardnessVal then |
if not hardnessVal then |
||
hardnessVal = '?' |
hardnessVal = '?' |
||
end |
end |
||
local unbreakable |
local unbreakable |
||
− | if hardnessVal == -1 or blockArgs. |
+ | if hardnessVal == -1 or blockArgs.liquide then |
unbreakable = true |
unbreakable = true |
||
end |
end |
||
local blockSprites = {} |
local blockSprites = {} |
||
− | local links = mw.text.split( blockArgs. |
+ | local links = mw.text.split( blockArgs.lien or '', '%s*,%s*' ) |
local ids = mw.text.split( blockArgs.sprite or '', '%s*,%s*' ) |
local ids = mw.text.split( blockArgs.sprite or '', '%s*,%s*' ) |
||
− | local items = mw.text.split( blockArgs. |
+ | local items = mw.text.split( blockArgs.objet or '', '%s*,%s*' ) |
for i, block in ipairs( blocks ) do |
for i, block in ipairs( blocks ) do |
||
local link |
local link |
||
Ligne 172 : | Ligne 186 : | ||
end |
end |
||
local blockText |
local blockText |
||
− | if args. |
+ | if args.couperTexte then |
− | blockText = block:gsub( args. |
+ | blockText = mw.ustring.gsub( block:gsub( args.couperTexte, '' ):gsub("^%s*(.-)%s*$", "%1"), "^%a", mw.ustring.upper ) |
else |
else |
||
blockText = block |
blockText = block |
||
end |
end |
||
local blockSpriteArgs = { |
local blockSpriteArgs = { |
||
− | + | data = 'BlocSprite', |
|
block, |
block, |
||
text = blockText, |
text = blockText, |
||
Ligne 185 : | Ligne 199 : | ||
} |
} |
||
if items[i] == '1' or not items[i] and items[1] == '1' then |
if items[i] == '1' or not items[i] and items[1] == '1' then |
||
− | blockSpriteArgs. |
+ | blockSpriteArgs.data = 'ObjetSprite' |
end |
end |
||
− | + | local image, spriteCat = sprite.link( blockSpriteArgs ) |
|
+ | table.insert( blockSprites, image ) |
||
+ | table.insert( categories, spriteCat ) |
||
end |
end |
||
table.insert( cells, |
table.insert( cells, |
||
Ligne 194 : | Ligne 210 : | ||
) |
) |
||
− | local tool = mw.text.trim( simple and 'Outil' or blockArgs[2] or 'Tous' ) |
+ | local tool = mw.ustring.gsub( mw.text.trim( simple and 'Outil' or blockArgs[2] or 'Tous' ), '^%a', mw.ustring.upper ) |
− | local material = mw.text.trim( simple and blockArgs[2] or blockArgs[3] or 'Tous' ) |
+ | local material = mw.ustring.gsub( mw.text.trim( simple and blockArgs[2] or blockArgs[3] or 'Tous' ), '^%a', mw.ustring.upper ) |
if tool == 'Aucun' then |
if tool == 'Aucun' then |
||
material = tool |
material = tool |
||
Ligne 209 : | Ligne 225 : | ||
local toolCell = '—' |
local toolCell = '—' |
||
if tool ~= 'Tous' and tool ~= 'Aucun' then |
if tool ~= 'Tous' and tool ~= 'Aucun' then |
||
− | local toolName = ( material ~= 'Tous' and |
+ | local toolName = tool .. ( material ~= 'Tous' and ' ' .. material or '' ) |
− | + | local image, spriteCat = sprite.sprite{ |
|
− | + | data = 'ObjetSprite', |
|
− | ( material == 'Tous' and ' |
+ | toolName .. ( material == 'Tous' and ' bois' or '' ), |
title = toolName, |
title = toolName, |
||
link = tool |
link = tool |
||
} |
} |
||
+ | toolCell = ( sortable and 'data-sort-value="' .. toolName .. '" |' or '' ) .. image |
||
+ | table.insert( categories, spriteCat ) |
||
end |
end |
||
table.insert( cells, '|' .. toolCell ) |
table.insert( cells, '|' .. toolCell ) |
||
Ligne 230 : | Ligne 248 : | ||
if hardnessVal == '?' then |
if hardnessVal == '?' then |
||
− | fillCells( cells, '|?', |
+ | fillCells( cells, '|?', nombreMateriaux +1 ) |
else |
else |
||
local processTime = function( num ) |
local processTime = function( num ) |
||
Ligne 248 : | Ligne 266 : | ||
else |
else |
||
local drop = 'oui' |
local drop = 'oui' |
||
− | if blockArgs. |
+ | if blockArgs.butin == '0' then |
− | drop = ' |
+ | drop = 'partiellement' |
end |
end |
||
local requiredLevel = unbreakable and 999 or materialGrade[material] |
local requiredLevel = unbreakable and 999 or materialGrade[material] |
||
Ligne 258 : | Ligne 276 : | ||
end |
end |
||
local breakTime = processTime( hardnessVal / materialSpeed[material] * ( willDrop == 'non' and 5 or 1.5 ) ) |
local breakTime = processTime( hardnessVal / materialSpeed[material] * ( willDrop == 'non' and 5 or 1.5 ) ) |
||
− | table.insert( cells, '|' .. getChoice( willDrop, breakTime ) ) |
+ | table.insert( cells, '|' .. getChoice( willDrop, lang:formatNum( breakTime ) ) ) |
end |
end |
||
Ligne 267 : | Ligne 285 : | ||
end |
end |
||
else |
else |
||
− | for _, material in ipairs{ 'Tous', 'Bois', 'Pierre', 'Fer', 'Diamant', 'Or' } do |
+ | for _, material in ipairs{ 'Tous', 'Bois', 'Pierre', 'Fer', 'Diamant', 'Netherite', 'Or' } do |
insertMaterialCell( material ) |
insertMaterialCell( material ) |
||
end |
end |
||
Ligne 285 : | Ligne 303 : | ||
else |
else |
||
local toolSpeed = { |
local toolSpeed = { |
||
− | + | Cisailles = 1, |
|
− | + | ['Épée'] = 1.5 |
|
} |
} |
||
if blocks[1] == 'Laine' then |
if blocks[1] == 'Laine' then |
||
− | toolSpeed. |
+ | toolSpeed.Cisailles = 5 |
elseif blocks[1] == 'Feuillage' then |
elseif blocks[1] == 'Feuillage' then |
||
− | toolSpeed. |
+ | toolSpeed.Cisailles = 15 |
elseif blocks[1] == 'Toile d\'araignée' then |
elseif blocks[1] == 'Toile d\'araignée' then |
||
− | toolSpeed |
+ | toolSpeed['Épée'] = 15 |
− | toolSpeed. |
+ | toolSpeed.Cisailles = 15 |
+ | elseif blocks[1] == 'Bambou' then |
||
+ | toolSpeed['Épée'] = 5000 |
||
end |
end |
||
Ligne 304 : | Ligne 324 : | ||
local willDrop = 'oui' |
local willDrop = 'oui' |
||
if toolDrop == '0' then |
if toolDrop == '0' then |
||
− | willDrop = ' |
+ | willDrop = 'partiellement' |
end |
end |
||
local breakTime = processTime( hardnessVal / toolSpeed[tool] * 1.5 ) |
local breakTime = processTime( hardnessVal / toolSpeed[tool] * 1.5 ) |
||
− | table.insert( cells, '|' .. getChoice( willDrop, breakTime ) ) |
+ | table.insert( cells, '|' .. getChoice( willDrop, lang:formatNum( breakTime ) ) ) |
end |
end |
||
end |
end |
||
Ligne 323 : | Ligne 343 : | ||
if horizontal then |
if horizontal then |
||
local blocksArgs = {} |
local blocksArgs = {} |
||
− | for _, arg in ipairs{ 1, 'note', 'sprite', ' |
+ | for _, arg in ipairs{ 1, 'note', 'sprite', 'lien', 'objet', 'butin', 2, 3, 'cisailles', 'épée' } do |
if args[arg] then |
if args[arg] then |
||
local col = 0 |
local col = 0 |
||
Ligne 352 : | Ligne 372 : | ||
-- Insert breaking time header after block row when simple, or after tool or hardness row when not |
-- Insert breaking time header after block row when simple, or after tool or hardness row when not |
||
− | table.insert( rows, simple and 3 or showTool and 5 or 4, '! colspan="' .. columns + 1 .. '" |' .. |
+ | table.insert( rows, simple and 3 or showTool and 5 or 4, '! colspan="' .. columns + 1 .. '" |' .. getBreakingTimeHeader( f ) ) |
else |
else |
||
insertBlock( args ) |
insertBlock( args ) |
||
Ligne 362 : | Ligne 382 : | ||
local note = '' |
local note = '' |
||
− | if args. |
+ | if args.bas or horizontal then |
note = f:preprocess( '<references group="note"/>' ) |
note = f:preprocess( '<references group="note"/>' ) |
||
− | if args. |
+ | if args.bas == '2' then |
table.insert( rows, header or getDplVar( 'header' ) ) |
table.insert( rows, header or getDplVar( 'header' ) ) |
||
end |
end |
||
Ligne 384 : | Ligne 404 : | ||
end |
end |
||
− | return table.concat( rows, '\n|-\n' ) .. note |
+ | return table.concat( rows, '\n|-\n' ) .. note .. table.concat( categories ) |
end |
end |
||
return p |
return p |
Version du 5 juin 2021 à 11:33
Implémente {{Tableau de minage}}
.
Dépendances
[voir | modifier | historique | purger]La documentation ci-dessus est insérée depuis Module:Tableau de minage/doc.
local p = {}
local breakingTimeHeader;
local function getBreakingTimeHeader( f )
if breakingTimeHeader == nil then
breakingTimeHeader = 'Temps de [[minage]]' .. f:preprocess( '<ref group="note" name="breakingtimenote">Les temps sont donnés en secondes pour des outils non enchantés.</ref>' )
end
return breakingTimeHeader
end
p.row = function( f )
lang = mw.getContentLanguage()
local args = require( [[Module:ProcessArgs]] ).norm()
local getDplVar = function( var )
local val = f:callParserFunction( '#dplvar', 'creusage ' .. var )
if val == '' then
val = false
end
return val
end
local dplVars = {}
local setDplVar = function( var, val )
table.insert( dplVars, 'creusage ' .. var )
table.insert( dplVars, val or '1' )
end
local rows = {}
local tableParts = {}
local categories = {}
local horizontal
if args.horizontal or args[1]:match( ';' ) then
horizontal = true
end
local showTool = true
local showShears = true
local showSword = true
local header, sortable, simple
if horizontal or not getDplVar( 'header' ) then
if args.cacheroutil or horizontal and ( not args[2] or args[2]:lower() == 'tous' or args[2]:lower() == 'aucun' ) then
showTool = false
setDplVar( 'hidetool' )
end
if args.cachercisailles or horizontal and not args.cisailles then
showShears = false
setDplVar( 'hideshears' )
end
if args['cacherépée'] or horizontal and not args['épée'] then
showSword = false
setDplVar( 'hidesword' )
end
sortable = not horizontal and args.tri
if sortable then
setDplVar( 'sortable' )
end
simple = args.simple
if simple and not horizontal then
setDplVar( 'simple' )
end
local tableClasses = { 'wikitable' }
if sortable then
table.insert( tableClasses, 'sortable' )
end
table.insert( rows, ' {| class="' .. table.concat( tableClasses, ' ' ) .. '" style="text-align:center"' )
local sortType = ''
if sortable then
sortType = 'data-sort-type="number"'
end
local rowspan = ''
if not horizontal then
rowspan = 'rowspan="2" '
end
header = {
'! ' .. rowspan .. ' | Bloc'
}
if not simple then
table.insert( header, '! ' .. rowspan .. sortType .. ' | Dureté' )
if showTool then
table.insert( header, '! ' .. rowspan .. ' | Outil' )
end
end
local toolColumns = {}
if showTool then
toolColumns = { 'Bois', 'Pierre', 'Fer', 'Diamant', 'Netherite', 'Or' }
end
table.insert(
toolColumns, 1,
'<abbr title="Inclut aussi les objets divers et l\'utilisation d\'un mauvais outil.">Poing</abbr>'
)
if not simple then
if showShears then
table.insert( toolColumns, 'Cisailles' )
end
if showSword then
table.insert( toolColumns, 'Épée' )
end
end
if not horizontal then
table.insert( header, '! colspan="' .. #toolColumns .. '" |' .. getBreakingTimeHeader( f ))
table.insert( header, '|-' )
end
for _, tool in ipairs( toolColumns ) do
table.insert( header, '! ' .. sortType .. ' | ' .. tool )
end
if not horizontal then
header = table.concat( header, '\n' )
setDplVar( 'header', header )
end
table.insert( tableParts, header )
else
showTool = not getDplVar( 'hidetool' )
showShears = not getDplVar( 'hideshears' )
showSword = not getDplVar( 'hidesword' )
sortable = getDplVar( 'sortable' )
simple = getDplVar( 'simple' )
end
local sprite = require( [[Module:Sprite]] )
local hardness = require( [[Module:Valeur de bloc]] ).value
local fillCells = function( cellsTable, text, num )
for i = 1, num do
table.insert( cellsTable, text )
end
end
local materialGrade = {
Tous = 0,
Bois = 1,
Or = 1,
Pierre = 2,
Fer = 3,
Diamant = 4,
Netherite = 5,
Aucun = 6
}
local materialSpeed = {
Aucun = 1,
Tous = 1,
Bois = 2,
Pierre = 4,
Fer = 6,
Diamant = 8,
Netherite = 9,
Or = 12
}
local nombreMateriaux = 6
local insertBlock = function( blockArgs )
local cells = {}
local blocks = mw.text.split( blockArgs[1], '%s*,%s*' )
local hardnessVal = tonumber( hardness{ blocks[1], type = 'dureté' } )
if not hardnessVal then
hardnessVal = '?'
end
local unbreakable
if hardnessVal == -1 or blockArgs.liquide then
unbreakable = true
end
local blockSprites = {}
local links = mw.text.split( blockArgs.lien or '', '%s*,%s*' )
local ids = mw.text.split( blockArgs.sprite or '', '%s*,%s*' )
local items = mw.text.split( blockArgs.objet or '', '%s*,%s*' )
for i, block in ipairs( blocks ) do
local link
if not links[i] and links[1] ~= '' then
link = links[1]
elseif links[i] ~= '' then
link = links[i]
end
local id
if not ids[i] and ids[1] ~= '' then
id = ids[1]
elseif ids[i] ~= '' then
id = ids[i]
end
local blockText
if args.couperTexte then
blockText = mw.ustring.gsub( block:gsub( args.couperTexte, '' ):gsub("^%s*(.-)%s*$", "%1"), "^%a", mw.ustring.upper )
else
blockText = block
end
local blockSpriteArgs = {
data = 'BlocSprite',
block,
text = blockText,
link = link,
id = id
}
if items[i] == '1' or not items[i] and items[1] == '1' then
blockSpriteArgs.data = 'ObjetSprite'
end
local image, spriteCat = sprite.link( blockSpriteArgs )
table.insert( blockSprites, image )
table.insert( categories, spriteCat )
end
table.insert( cells,
'! style="text-align:left" | ' .. table.concat( blockSprites, '<br>' ) .. ( blockArgs.note or '' )
)
local tool = mw.ustring.gsub( mw.text.trim( simple and 'Outil' or blockArgs[2] or 'Tous' ), '^%a', mw.ustring.upper )
local material = mw.ustring.gsub( mw.text.trim( simple and blockArgs[2] or blockArgs[3] or 'Tous' ), '^%a', mw.ustring.upper )
if tool == 'Aucun' then
material = tool
end
if not simple then
local hardnessText = hardnessVal
if hardnessVal == -1 then
hardnessText = ( sortable and 'data-sort-value="999" | ' or '' ) .. '∞'
end
table.insert( cells, '|' .. hardnessText )
if showTool then
local toolCell = '—'
if tool ~= 'Tous' and tool ~= 'Aucun' then
local toolName = tool .. ( material ~= 'Tous' and ' ' .. material or '' )
local image, spriteCat = sprite.sprite{
data = 'ObjetSprite',
toolName .. ( material == 'Tous' and ' bois' or '' ),
title = toolName,
link = tool
}
toolCell = ( sortable and 'data-sort-value="' .. toolName .. '" |' or '' ) .. image
table.insert( categories, spriteCat )
end
table.insert( cells, '|' .. toolCell )
end
end
local choices = {}
local getChoice = function( choice, text )
if not choices[choice] then
choices[choice] = f:expandTemplate{ title = 'Choix tableau', args = { choice, '' } }
end
return choices[choice] .. text
end
if hardnessVal == '?' then
fillCells( cells, '|?', nombreMateriaux +1 )
else
local processTime = function( num )
if num < 0.05 then -- Blocks have a minimum breaking time of 1 game tick (0.05 seconds)
num = 0.05
else -- And they must be broken in multiples of 1 game tick (0.05 seconds)
num = math.ceil( num * 20 ) / 20
end
return num
end
if unbreakable then
table.insert( cells, '| ' .. ( sortable and 'data-sort-value="999" ' or '' ) .. getChoice( 'non', '∞' ) )
if showTool then
fillCells( cells, '|—', 5 )
end
else
local drop = 'oui'
if blockArgs.butin == '0' then
drop = 'partiellement'
end
local requiredLevel = unbreakable and 999 or materialGrade[material]
local insertMaterialCell = function( material )
local willDrop = drop
if materialGrade[material] < requiredLevel then
willDrop = 'non'
end
local breakTime = processTime( hardnessVal / materialSpeed[material] * ( willDrop == 'non' and 5 or 1.5 ) )
table.insert( cells, '|' .. getChoice( willDrop, lang:formatNum( breakTime ) ) )
end
if not showTool or tool == 'Tous' or tool == 'Aucun' then
insertMaterialCell( 'Tous' )
if showTool then
fillCells( cells, '|—', 5 )
end
else
for _, material in ipairs{ 'Tous', 'Bois', 'Pierre', 'Fer', 'Diamant', 'Netherite', 'Or' } do
insertMaterialCell( material )
end
end
end
if not simple and ( showShears or showSword ) then
local tools = {}
if showShears then
table.insert( tools, 'Cisailles' )
end
if showSword then
table.insert( tools, 'Épée' )
end
if hardnessVal == '?' then
fillCells( cells, '|?', #tools )
else
local toolSpeed = {
Cisailles = 1,
['Épée'] = 1.5
}
if blocks[1] == 'Laine' then
toolSpeed.Cisailles = 5
elseif blocks[1] == 'Feuillage' then
toolSpeed.Cisailles = 15
elseif blocks[1] == 'Toile d\'araignée' then
toolSpeed['Épée'] = 15
toolSpeed.Cisailles = 15
elseif blocks[1] == 'Bambou' then
toolSpeed['Épée'] = 5000
end
for _, tool in ipairs( tools ) do
local toolDrop = blockArgs[mw.ustring.lower( tool )]
if not toolDrop then
table.insert( cells, '|—' )
else
local willDrop = 'oui'
if toolDrop == '0' then
willDrop = 'partiellement'
end
local breakTime = processTime( hardnessVal / toolSpeed[tool] * 1.5 )
table.insert( cells, '|' .. getChoice( willDrop, lang:formatNum( breakTime ) ) )
end
end
end
end
end
if not horizontal then
cells = table.concat( cells, '\n' )
end
table.insert( tableParts, cells )
end
if horizontal then
local blocksArgs = {}
for _, arg in ipairs{ 1, 'note', 'sprite', 'lien', 'objet', 'butin', 2, 3, 'cisailles', 'épée' } do
if args[arg] then
local col = 0
for colVal in mw.text.gsplit( args[arg], '%s*;%s*' ) do
col = col + 1
if colVal ~= '' then
if not blocksArgs[col] then
blocksArgs[col] = {}
end
blocksArgs[col][arg] = colVal
end
end
end
end
for _, block in ipairs( blocksArgs ) do
insertBlock( block )
end
local columns = #tableParts
for row = 1, #tableParts[1] do
local cells = {}
for col = 1, columns do
table.insert( cells, tableParts[col][row] )
end
table.insert( rows, table.concat( cells, '\n' ) )
end
-- Insert breaking time header after block row when simple, or after tool or hardness row when not
table.insert( rows, simple and 3 or showTool and 5 or 4, '! colspan="' .. columns + 1 .. '" |' .. getBreakingTimeHeader( f ) )
else
insertBlock( args )
for _, row in ipairs( tableParts ) do
table.insert( rows, row )
end
end
table.insert( rows, '' )
local note = ''
if args.bas or horizontal then
note = f:preprocess( '<references group="note"/>' )
if args.bas == '2' then
table.insert( rows, header or getDplVar( 'header' ) )
end
table.insert( rows, '|}' )
if not horizontal then
f:callParserFunction( '#dplvar:set',
'breaking header', '',
'breaking hidetool', '',
'breaking hideshears', '',
'breaking hidesword', '',
'breaking simple', '',
'breaking sortable', ''
)
end
elseif #dplVars > 0 then
f:callParserFunction( '#dplvar:set', dplVars )
end
return table.concat( rows, '\n|-\n' ) .. note .. table.concat( categories )
end
return p