Manutenção
| Os dados para versões lançadas da Java estão atualizados a partir da 1.19. (precisa ser verificado/atualizado para 1.20.1). | 14:30, 23 de abril de 2023 (UTC -3) |
| Os dados para snapshots Java estão atualizados a partir da 22w18a. (a wiki está atrás; só está atualizado para 1.20.2 Release Candidate 2). | 14:30, 23 de abril de 2023 (UTC -3) |
| Os dados para versões lançadas da Bedrock estão atualizados a partir da 1.19.0. (precisa ser verificado/atualizado para 1.20.30). | 14:30, 23 de abril de 2023 (UTC -3) |
| Os dados para versões Bedrock beta estão atualizados a partir da beta 1.19.80.22. (precisa ser verificado/atualizado para beta 1.20.40.21). | 14:30, 23 de abril de 2023 (UTC -3) |
Considerações iniciais
Para o funcionamento deste módulo deve ser utilizada a tradução oficial da Edição Java em português do Brasil, por questões internas de configuração. Sabemos que existem traduções oficiais diferentes entre edições (o que não deveria acontecer) e também localizações, porém atualmente o módulo só suporta um idioma, e como a wiki iniciou em português do Brasil, e como a Edição Java veio primeiro, esse idioma/localização/edição é a base para a configuração do módulo.
Uso .base (Predefinição:Saque de baú)
Gera uma tabela do conteúdo dos baús designados, com colunas correspondentes a várias estatísticas sobre a disponibilidade desses itens.
Invocando
Ela recebe qualquer número de parâmetros de baú, e qualquer número de parâmetros de coluna, em nenhuma ordem particular.
Se nenhum parâmetro de baú estiver listado, ele exibe todos eles; da mesma forma para parâmetros de coluna.
{{#invoke:LootChest|base
[ |<paramDeBaú1> ... |<paramDeBaúN> ]
[ |<paramDeColunaEscondido1> ... |<paramDeColunaEscondidoN> ]
}}
Parâmetros de baú
bonus,
desert-temple ( desert ),
dungeon,
end-city,
igloo,
jungle-temple ( jungle ),
jungle-temple-dispenser,
mineshaft,
nether-fortress ( nether, fortress ),
stronghold-altar ( altar ),
stronghold-library ( library ),
stronghold-storeroom ( storeroom ),
village-blacksmith ( blacksmith, village )
Parâmetros da coluna
chance: the odds of getting any of this item in a single chest.,
chests: the number of chests expected to search, to find any of this item.,
items: the number of items expected per chest, averaged over a large number of chests.,
stacksize: the size of stacks (or for unstackable items, number) of this item found in this chest.,
weight: the weight of this item relative to other items in the chest.
Exêmplo
{{#invoke:LootChest|base}} → todos os baús e todas as colunas
{{#invoke:LootChest|base|ferreiro|selva|bônus|chance|stacksize}} → apenas baús de ferreiro e selva, e apenas as colunas 'stacksize' e 'chance'
Uso .base2 (linha Predefinição:Item de saque de baú)
Imprime um resumo da disponibilidade deste item nos vários baús da geração do mundo.
Invocando
Leva exatamente um nome de item como um parâmetro.
{{#invoke:LootChest|base2|<paramDeitem>}}
Parâmetros de item
areia, armadura-de-diamante-para-cavalo, armadura-de-ferro-para-cavalo, armadura-de-ouro-para-cavalo, balde, barra-de-ferro, barra-de-ouro, botas-de-diamante-encantadas, botas-de-ferro, botas-de-ferro-encantadas, bússola, calças-de-diamante-encantadas, calças-de-ferro, calças-de-ferro-encantadas, carne-podre, carvão, diamante, disco-13, disco-cat, elmo-de-diamante-encantado, elmo-de-ferro, elmo-de-ferro-encantado, esmeralda, espada-de-diamante-encantada, espada-de-ferro, espada-de-ferro-encantada, espada-de-ouro, etiqueta, flecha, fungo-do-nether, graveto, isqueiro, linha, livro, livro-encantado, livro-encantado-rnd, lápis-lazúli, machado-de-madeira, machado-de-pedra, madeira-de-acácia, madeira-de-carvalho, mapa-em-branco, maçã, maçã-do-notch, maçã-dourada, muda-de-carvalho, obsidiana, olho-de-aranha, osso, papel, peitoral-de-diamante-encantado, peitoral-de-ferro, peitoral-de-ferro-encantado, peitoral-de-ouro, pepita-de-ouro, picareta-de-diamante-encantada, picareta-de-ferro, picareta-de-ferro-encantada, picareta-de-madeira, picareta-de-pedra, pá-de-diamante-encantada, pá-de-ferro-encantada, pão, pérola-do-fim, pólvora, redstone, salmão-cru, sela, sementes-de-abóbora, sementes-de-beterraba, sementes-de-melancia, somente-madeira-de-acácia, somente-madeira-de-carvalho, tocha, trigo, trilho, trilho-ativador, trilho-detector, trilho-elétrico, tábuas, vazio
Exemplo
{{#invoke:LootChest|base2|barra-de-ferro}} →
Barras de ferro podem ser encontradas em 18.8% de baús de calabouço em stacks de 1–4; em 23.4% de baús de altar da fortaleza, 19.2% de baús de fortaleza do Nether, 18.2% de baús de templo do deserto, 46.1% de baús de ferreiro da vila, 32.0% de carrinhos com baú em minas abandonadas, 44.5% de baús de templo da selva, e 35.6% de baús de despensa da fortaleza, tudo em stacks de 1–5; e em 39.4% de baús de Cidade do Fim em stacks de 4–8.
{{#invoke:LootChest|base2|esmeralda}} →
Esmeraldas podem ser encontradas em 7.7% de baús de iglu em stacks de 1, em 18.2% de baús de templo do deserto e 10.5% de baús de templo da selva em stacks de 1–3, e em 9.1% de baús de Cidade do Fim em stacks de 2–6.
Uso .base3 (tabela Predefinição:Item de saque de baú)
Imprime um resumo da disponibilidade deste item nos vários baús gerados no mundo na forma de uma tabela.
Invocando
Leva exatamente um nome de item como parâmetro.
{{#invoke:LootChest|base3|<paramDeitem>}}
Parâmetros do item
Igual a acima
Exemplo
{{#invoke:LootChest|base3|esmeralda}} → Erro de script: A função "base3" não existe.
Fonte
- Os dados são configurados dentro do
ppara que possa ser puxado diretamente dos (ou comparado diretamente aos) arquivos de tabela de saque do minecraft. - tamanho da pilha dado aqui (e dado em código) pode ser maior que o tamanho empilhável do item, principalmente no caso de livros encantados. No entanto, este fato não afeta os valores calculados. Isso ocorre porque o jogo coloca o número certo de itens, mas não empilhados, em vez de empilhados.
Estrutura de dados
p.items
'<item-id>' = {- Essa chave deve corresponder a um nome de sprite para os itens/blocos definidos em Módulo:BlockSprite ou Módulo:ItemSprite, a menos que
idesteja incluído na definição do item.
- Essa chave deve corresponder a um nome de sprite para os itens/blocos definidos em Módulo:BlockSprite ou Módulo:ItemSprite, a menos que
'<sprite-type>'- Ou
itemoublock.
- Ou
[, id='<sprite-id>']- Use isto para especificar um sprite definido em Módulo:BlockSprite ou Módulo:ItemSprite. Caso contrário, usará o sprite com o nome dado por
item-id.
- Use isto para especificar um sprite definido em Módulo:BlockSprite ou Módulo:ItemSprite. Caso contrário, usará o sprite com o nome dado por
[, link='<item-link>']- Um link para uma página que é diferente do nome do sprite-id. Usado em Pedefinição:Saque de baú.
[, title='<item-text>']- Um nome para um item que é diferente do nome do sprite-id.
[, cannot_stack=false]- Use isso para indicar que o item vem em grupos e não em pilhas. Usado em Pedefinição:Item de saque de baú.
[, plural=(false|'<custom-plural-word>')]- Use
falsequando uma palavra não tem plural ou já está no plural. Use uma palavra plural personalizada quando você não pode simplesmente acrescentar um 's' para a palavra base para torná-lo plural. Usado em Pedefinição:Item de saque de baú.
- Use
[, preserve_case=false]- Use
falsequando um nome de item deve seguir a capitalização exatamente especificada emtitle, e não segue o caso de sentença.
- Use
[, male=true]- Use
truequando um nome de item/bloco tiver gênero masculino. Pequena adição em relação ao módulo original na wiki em inglês, para que o módulo possa identificar o gênero correto a se usar durante a criação do texto. Usado em Pedefinição:Item de saque de baú.
- Use
[, note='<nome-da-nota>']- Indica que uma nota aparecerá ao lado deste item na tabela. (notas são definidas diretamente abaixo da lista de itens)
}
p.notes
'<nome-da-nota>' = '<texto-da-nota>'
p.chests[n].pools[n]p.chests[n].poolsJava[n]p.chests[n].poolsJavaUpcoming[n]p.chests[n].poolsBedrock[n]p.chests[n].poolsBedrockUpcoming[n]- rolls
{ <número-mín-de-pilhas>, <número-máx-de-pilhas> }
p.chests[n].poolsJava[n].itemsp.chests[n].poolsJavaUpcoming[n].itemsp.chests[n].poolsBedrock[n].itemsp.chests[n].poolsBedrockUpcoming[n].items
'<item-id>' = { <tam-mín-de-pilha>, <tam-máx-de-pilha>, <peso-do-item> }
p.synonyms
'<sinônimo-do-nome-do-baú>' = '<nome-original-do-baú-válido>'- Permite que os nomes adicionais do baú sejam utilizados como parâmetros, além dos definidos em p.chests.
p.display_names
'<nome-do-baú-dado-via-parâmetro>' = '<nome-exibido-na-tabela-do-baú-único>'- Se um parâmetro de baú único for usado, isso define o nome no qual é chamado no texto de resumo acima da tabela.
p.columns
'<nome-da-coluna>' = '<descrição-da-coluna>'- As descrições das colunas, encontradas na dica de ferramenta no cabeçalho da coluna ou no texto de resumo acima da tabela.
Funções
As seguintes funções são disponibilizadas na parte superior do arquivo, para facilitar a inspeção.
calc_average_amount_this_item_per_chest
- número médio de um determinado item (não é o número de pilhas), por baú (não por estrutura).
calc_chance_any_of_this_item_per_chest
- chance que pelo menos um de um determinado item será encontrado, por baú (não por estrutura).
Testes de itens
{{#invoke:LootChest|base2_test}}
Areias podem ser encontradas em 59.0% de baús de templo do deserto em stacks de 1–8.
Armaduras de diamante para cavalo podem ser encontradas em 2.5% de baús de altar da fortaleza, 11.8% de baús de fortaleza do Nether, 6.3% de baús de templo do deserto, 5.7% de baús de ferreiro da vila, 7.7% de baús de calabouço, 4.6% de baús de Cidade do Fim, e 5.4% de baús de templo da selva, tudo em grupos de 1.
Armaduras de ferro para cavalo podem ser encontradas em 2.5% de baús de altar da fortaleza, 19.2% de baús de fortaleza do Nether, 18.2% de baús de templo do deserto, 5.7% de baús de ferreiro da vila, 15.1% de baús de calabouço, 4.6% de baús de Cidade do Fim, e 5.4% de baús de templo da selva, tudo em grupos de 1.
Armaduras de ouro para cavalo podem ser encontradas em 2.5% de baús de altar da fortaleza, 29.4% de baús de fortaleza do Nether, 12.4% de baús de templo do deserto, 5.7% de baús de ferreiro da vila, 22.2% de baús de calabouço, 4.6% de baús de Cidade do Fim, e 5.4% de baús de templo da selva, tudo em grupos de 1.
Baldes podem ser encontrados em 18.8% de baús de calabouço em stacks de 1.
Barras de ferro podem ser encontradas em 18.8% de baús de calabouço em stacks de 1–4; em 23.4% de baús de altar da fortaleza, 19.2% de baús de fortaleza do Nether, 18.2% de baús de templo do deserto, 46.1% de baús de ferreiro da vila, 32.0% de carrinhos com baú em minas abandonadas, 44.5% de baús de templo da selva, e 35.6% de baús de despensa da fortaleza, tudo em stacks de 1–5; e em 39.4% de baús de Cidade do Fim em stacks de 4–8.
Barras de ouro podem ser encontradas em 12.2% de baús de altar da fortaleza, 49.8% de baús de fortaleza do Nether, 26.0% de baús de ferreiro da vila, 17.0% de carrinhos com baú em minas abandonadas, e 19.0% de baús de despensa da fortaleza, tudo em stacks de 1–3; em 18.2% de baús de templo do deserto, 54.0% de baús de Cidade do Fim, e 60.2% de baús de templo da selva, tudo em stacks de 2–7; e em 9.7% de baús de calabouço em stacks de 1–4.
Botas de diamante encantadas podem ser encontradas em 13.4% de baús de Cidade do Fim em grupos de 1.
Botas de ferro encantadas podem ser encontradas em 13.4% de baús de Cidade do Fim em grupos de 1.
Botas de ferro podem ser encontradas em 12.2% de baús de altar da fortaleza e 26.0% de baús de ferreiro da vila em grupos de 1.
Bússolas podem ser encontradas em 11.0% de baús de biblioteca da fortaleza em stacks de 1.
Calças de diamante encantadas podem ser encontradas em 13.4% de baús de Cidade do Fim em grupos de 1.
Calças de ferro encantadas podem ser encontradas em 13.4% de baús de Cidade do Fim em grupos de 1.
Calças de ferro podem ser encontradas em 12.2% de baús de altar da fortaleza e 26.0% de baús de ferreiro da vila em grupos de 1.
Carnes podres podem ser encontradas em 57.9% de baús de iglu em stacks de 1, em 29.0% de baús de templo do deserto e 62.8% de baús de templo da selva em stacks de 3–7, e em 59.0% de baús de templo do deserto e 57.8% de baús de calabouço em stacks de 1–8.
Carvões podem ser encontrados em 27.4% de baús de calabouço e 74.3% de baús de iglu em stacks de 1–4, e em 32.0% de carrinhos com baú em minas abandonadas e 35.6% de baús de despensa da fortaleza em stacks de 3–8.
Diamantes podem ser encontrados em 7.4% de baús de altar da fortaleza, 19.2% de baús de fortaleza do Nether, 6.3% de baús de templo do deserto, 16.3% de baús de ferreiro da vila, e 15.5% de baús de templo da selva, tudo em stacks de 1–3; em 10.5% de carrinhos com baú em minas abandonadas em stacks de 1–2; e em 21.5% de baús de Cidade do Fim em stacks de 2–7.
Discos de música podem ser encontrados em 22.2% de baús de calabouço em grupos de 1.
Discos de música podem ser encontrados em 22.2% de baús de calabouço em grupos de 1.
Elmos de diamante encantados podem ser encontrados em 13.4% de baús de Cidade do Fim em grupos de 1.
Elmos de ferro encantados podem ser encontrados em 13.4% de baús de Cidade do Fim em grupos de 1.
Elmos de ferro podem ser encontrados em 12.2% de baús de altar da fortaleza e 26.0% de baús de ferreiro da vila em grupos de 1.
Esmeraldas podem ser encontradas em 7.7% de baús de iglu em stacks de 1, em 18.2% de baús de templo do deserto e 10.5% de baús de templo da selva em stacks de 1–3, e em 9.1% de baús de Cidade do Fim em stacks de 2–6.
Espada de ouros podem ser encontradas em 19.2% de baús de fortaleza do Nether em grupos de 1.
Espadas de diamantes encantadas podem ser encontradas em 13.4% de baús de Cidade do Fim em grupos de 1.
Espadas de ferro encantadas podem ser encontradas em 13.4% de baús de Cidade do Fim em grupos de 1.
Espadas de ferro podem ser encontradas em 12.2% de baús de altar da fortaleza e 26.0% de baús de ferreiro da vila em grupos de 1.
Etiquetas podem ser encontradas em 29.0% de baús de calabouço e 42.3% de carrinhos com baú em minas abandonadas em stacks de 1.
Flechas podem ser encontradas em all baús de templo da selva em stacks de 2–7.
Fungos do nether podem ser encontrados em 19.2% de baús de fortaleza do Nether em stacks de 3–7.
Gravetos podem ser encontrados em 68.4% de baús de bônus em stacks de 1–12.
Isqueiros podem ser encontrados em 19.2% de baús de fortaleza do Nether em grupos de 1.
Linhas podem ser encontradas em 59.0% de baús de templo do deserto e 57.8% de baús de calabouço em stacks de 1–8.
Livros encantados podem ser encontrados em 2.5% de baús de altar da fortaleza, 72.2% de baús de biblioteca da fortaleza, 5.4% de baús de templo da selva, e 4.0% de baús de despensa da fortaleza, tudo em grupos de 1.
Livros encantados podem ser encontrados em 23.7% de baús de templo do deserto, 15.1% de baús de calabouço, e 14.1% de carrinhos com baú em minas abandonadas, tudo em grupos de 1.
Livros podem ser encontrados em 94.6% de baús de biblioteca da fortaleza em stacks de 1–3.
Lápis-lazúlis podem ser encontrados em 17.0% de carrinhos com baú em minas abandonadas em stacks de 4–9.
Machado de madeiras podem ser encontrados em 75.0% de baús de bônus em grupos de 1.
Machado de pedras podem ser encontrados em 14.9% de baús de iglu e 25.0% de baús de bônus em grupos de 1.
Madeiras de acácia ou carvalho escuro podem ser encontradas em 68.4% de baús de bônus em stacks de 1–3.
Madeiras de carvalho, pinheiro, eucalipto ou da selva podem ser encontradas em 68.4% de baús de bônus em stacks de 1–3.
Mapa em brancos podem ser encontrados em 11.0% de baús de biblioteca da fortaleza em stacks de 1.
Maçãs douradas (encantada) podem ser encontradas em 2.6% de baús de templo do deserto, 3.1% de baús de calabouço, e 1.4% de carrinhos com baú em minas abandonadas, tudo em stacks de 1.
Maçãs douradas (normais) podem ser encontradas em 2.5% de baús de altar da fortaleza, 23.7% de baús de templo do deserto, 22.2% de baús de calabouço, 28.2% de carrinhos com baú em minas abandonadas, e all baús de iglu, tudo em stacks de 1.
Maçãs podem ser encontradas em 33.7% de baús de altar da fortaleza, 61.6% de baús de ferreiro da vila, 74.3% de baús de iglu, e 50.0% de baús de despensa da fortaleza, tudo em stacks de 1–3; e em 83.8% de baús de bônus em stacks de 1–2.
Mudas de carvalho podem ser encontradas em 26.0% de baús de ferreiro da vila em stacks de 3–7.
Nada podem ser encontradas em 18.2% de baús de templo do deserto e 7.0% de carrinhos com baú em minas abandonadas em stacks de 1.
Obsidianas podem ser encontradas em 26.0% de baús de ferreiro da vila em stacks de 3–7, e em 8.0% de baús de fortaleza do Nether em stacks de 2–4.
Olhos de aranha podem ser encontrados em 29.0% de baús de templo do deserto em stacks de 1–3.
Ossos podem ser encontrados em 29.0% de baús de templo do deserto e 72.2% de baús de templo da selva em stacks de 4–6, e em 59.0% de baús de templo do deserto e 57.8% de baús de calabouço em stacks de 1–8.
Papéis podem ser encontrados em 94.6% de baús de biblioteca da fortaleza em stacks de 2–7.
Peitorais de diamante encantados podem ser encontrados em 13.4% de baús de Cidade do Fim em grupos de 1.
Peitorais de ferro encantados podem ser encontrados em 13.4% de baús de Cidade do Fim em grupos de 1.
Peitorais de ferro podem ser encontrados em 12.2% de baús de altar da fortaleza e 26.0% de baús de ferreiro da vila em grupos de 1.
Peitoral de ouros podem ser encontrados em 19.2% de baús de fortaleza do Nether em grupos de 1.
Pepitas de ouro podem ser encontradas em 57.9% de baús de iglu em stacks de 1–3.
Picareta de madeiras podem ser encontradas em 75.0% de baús de bônus em grupos de 1.
Picareta de pedras podem ser encontradas em 25.0% de baús de bônus em grupos de 1.
Picaretas de diamante encantadas podem ser encontradas em 13.4% de baús de Cidade do Fim em grupos de 1.
Picaretas de ferro encantadas podem ser encontradas em 13.4% de baús de Cidade do Fim em grupos de 1.
Picaretas de ferro podem ser encontradas em 12.2% de baús de altar da fortaleza, 26.0% de baús de ferreiro da vila, 7.0% de carrinhos com baú em minas abandonadas, e 4.0% de baús de despensa da fortaleza, tudo em grupos de 1.
Pás de diamante encantadas podem ser encontradas em 13.4% de baús de Cidade do Fim em grupos de 1.
Pás de ferro encantadas podem ser encontradas em 13.4% de baús de Cidade do Fim em grupos de 1.
Pães podem ser encontrados em 35.3% de baús de calabouço em stacks de 1; em 33.7% de baús de altar da fortaleza, 61.6% de baús de ferreiro da vila, 45.0% de carrinhos com baú em minas abandonadas, e 50.0% de baús de despensa da fortaleza, tudo em stacks de 1–3; e em 61.5% de baús de bônus em stacks de 1–2.
Pérolas do fim podem ser encontradas em 23.4% de baús de altar da fortaleza em stacks de 1.
Pólvoras podem ser encontradas em 59.0% de baús de templo do deserto e 57.8% de baús de calabouço em stacks de 1–8.
Redstones podem ser encontradas em 27.4% de baús de calabouço em stacks de 1–4, e em 12.2% de baús de altar da fortaleza, 17.0% de carrinhos com baú em minas abandonadas, e 19.0% de baús de despensa da fortaleza, tudo em stacks de 4–9.
Salmões crus podem ser encontrados em 61.5% de baús de bônus em stacks de 1–2.
Selas podem ser encontradas em 2.5% de baús de altar da fortaleza, 35.7% de baús de fortaleza do Nether, 23.7% de baús de templo do deserto, 16.3% de baús de ferreiro da vila, 29.0% de baús de calabouço, 13.4% de baús de Cidade do Fim, e 15.5% de baús de templo da selva, tudo em grupos de 1.
Sementes de abóbora podem ser encontradas em 18.8% de baús de calabouço e 32.0% de carrinhos com baú em minas abandonadas em stacks de 2–4.
Sementes de beterraba podem ser encontradas em 21.5% de baús de Cidade do Fim em stacks de 1–10, e em 18.8% de baús de calabouço e 32.0% de carrinhos com baú em minas abandonadas em stacks de 2–4.
Sementes de melancia podem ser encontradas em 18.8% de baús de calabouço e 32.0% de carrinhos com baú em minas abandonadas em stacks de 2–4.
Tochas podem ser encontradas em 65.7% de carrinhos com baú em minas abandonadas em stacks de 1–16.
Trigos podem ser encontrados em 35.3% de baús de calabouço em stacks de 1–4, e em 57.9% de baús de iglu em stacks de 2–3.
Trilhos ativadores podem ser encontrados em 27.1% de carrinhos com baú em minas abandonadas em stacks de 1–4.
Trilhos detectores podem ser encontrados em 27.1% de carrinhos com baú em minas abandonadas em stacks de 1–4.
Trilhos elétricos podem ser encontrados em 27.1% de carrinhos com baú em minas abandonadas em stacks de 1–4.
Trilhos podem ser encontrados em 78.4% de carrinhos com baú em minas abandonadas em stacks de 4–8.
Tábuas podem ser encontradas em 68.4% de baús de bônus em stacks de 1–12.
Notas
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 = 'Na 1.10 ',
-- 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
-- NOTE: order in this list doesn't matter.
items = {
["madeira-de-acácia"] = { "block", link="Madeira", title="Madeira de Acácia ou Carvalho Escuro", plural="Madeiras de Acácia ou Carvalho Escuro" },
["somente-madeira-de-acácia"] = { "block", id='madeira-de-acácia', link="Madeira", title="Madeira de Acácia", plural="Madeiras de Acácia" },
["trilho-ativador"] = { "block", plural="Trilhos Ativadores", male=true },
["maçã"] = { "item" },
["flecha"] = { "item" },
["sementes-de-beterraba"] = { "item", link="Sementes de Beterraba", plural=false },
["osso"] = { "item", male=true },
["livro"] = { "item", male=true },
["pão"] = { "item", plural="Pães", male=true },
["balde"] = { "item", male=true },
["carvão"] = { "item", plural="Carvões", male=true },
["bússola"] = { "item" },
["trilho-detector"] = { "block", plural="Trilhos Detectores", male=true },
["diamante"] = { "item", male=true },
["disco-13"] = { "item", title="Disco de Música (13)", link="Disco de Música", cannot_stack=true, plural="Discos de Música", male=true },
["disco-cat"] = { "item", title="Disco de Música (Cat)", link="Disco de Música", cannot_stack=true, plural="Discos de Música", male=true },
["esmeralda"] = { "item" },
["mapa-em-branco"] = { "item", link="Mapa", title="Mapa em Branco", male=true },
["livro-encantado"] = { "item", link="Livro Encantado", cannot_stack=true, note="level-book", plural="Livros Encantados", male=true },
["livro-encantado-rnd"] = { "item", id='livro-encantado', title="Livro Encantado", link="Livro Encantado", cannot_stack=true, note="random-book", plural="Livros Encantados", male=true },
["pérola-do-fim"] = { "item", plural="Pérolas do Fim" },
["isqueiro"] = { "item", cannot_stack=true, male=true },
["maçã-dourada"] = { "item", title="Maçã Dourada (Normal)", plural="Maçãs Douradas (Normais)" },
["peitoral-de-ouro"] = { "item", link="Armadura", cannot_stack=true, male=true },
["espada-de-ouro"] = { "item", link="Espada", cannot_stack=true },
["barra-de-ouro"] = { "item", plural="Barras de Ouro" },
["pepita-de-ouro"] = { "item", plural="Pepitas de Ouro" },
["pólvora"] = { "item" },
["armadura-de-diamante-para-cavalo"] = { "item", title="Armadura de Diamante para Cavalo", link="Armadura para Cavalo", cannot_stack=true, plural="Armaduras de Diamante para Cavalo" },
["armadura-de-ouro-para-cavalo"] = { "item", title="Armadura de Ouro para Cavalo", link="Armadura para Cavalo", cannot_stack=true, plural="Armaduras de Ouro para Cavalo" },
["armadura-de-ferro-para-cavalo"] = { "item", title="Armadura de Ferro para Cavalo", link="Armadura para Cavalo", cannot_stack=true, plural="Armaduras de Ferro para Cavalo" },
["botas-de-ferro"] = { "item", link="Armadura", cannot_stack=true, plural=false },
["peitoral-de-ferro"] = { "item", link="Armadura", cannot_stack=true, plural="Peitorais de Ferro", male=true },
["elmo-de-ferro"] = { "item", link="Armadura", cannot_stack=true, plural="Elmos de Ferro", male=true },
["barra-de-ferro"] = { "item", plural="Barras de Ferro" },
["calças-de-ferro"] = { "item", link="Armadura", cannot_stack=true, plural=false },
["picareta-de-ferro"] = { "item", link="Picareta", cannot_stack=true, plural="Picaretas de Ferro" },
["espada-de-ferro"] = { "item", link="Espada", cannot_stack=true, plural="Espadas de Ferro" },
["lápis-lazúli"] = { "item", plural="Lápis-Lazúlis", male=true },
["sementes-de-melancia"] = { "item", plural=false },
["etiqueta"] = { "item" },
["maçã-do-notch"] = { "item", id='maçã-dourada', link="Maçã Dourada", title="Maçã Dourada (Encantada)", plural="Maçãs Douradas (Encantada)" },
["fungo-do-nether"] = { "item", plural="Fungos do Nether", male=true },
["muda-de-carvalho"] = { "block", link="Muda", plural="Mudas de Carvalho" },
["madeira-de-carvalho"] = { "block", link="Madeira", title="Madeira de Carvalho, Pinheiro, Eucalipto ou da Selva", plural="Madeiras de Carvalho, Pinheiro, Eucalipto ou da Selva" },
["somente-madeira-de-carvalho"] = { "block", id='madeira-de-carvalho', link="Madeira", title="Madeira de Carvalho", plural="Madeiras de Carvalho" },
["obsidiana"] = { "block" },
["papel"] = { "item", plural="Papéis", male=true },
["trilho-elétrico"] = { "block", plural="Trilhos Elétricos", male=true },
["sementes-de-abóbora"] = { "item", plural=false },
["trilho"] = { "block", male=true },
["redstone"] = { "item" },
["carne-podre"] = { "item", plural="Carnes Podres" },
["areia"] = { "block" },
["sela"] = { "item", cannot_stack=true },
["salmão-cru"] = { "item", plural="Salmões Crus", male=true },
["olho-de-aranha"] = { "item", plural="Olhos de Aranha", male=true },
["graveto"] = { "item", male=true },
["machado-de-pedra"] = { "item", link="Machado", cannot_stack=true, male=true },
["picareta-de-pedra"] = { "item", link="Picareta", cannot_stack=true },
["linha"] = { "item" },
["tocha"] = { "block" },
["trigo"] = { "item", male=true },
["tábuas"] = { "block", plural=false },
["machado-de-madeira"] = { "item", link="Machado", cannot_stack=true, male=true },
["picareta-de-madeira"] = { "item", link="Picareta", cannot_stack=true },
["botas-de-diamante-encantadas"] = { "item", id="botas-de-diamante", link="Botas de Diamante", note="end-ench-equipment", cannot_stack=true, plural=false },
["peitoral-de-diamante-encantado"] = { "item", id="peitoral-de-diamante", link="Peitoral de Diamante", note="end-ench-equipment", cannot_stack=true, plural="Peitorais de Diamante Encantados", male=true },
["elmo-de-diamante-encantado"] = { "item", id="elmo-de-diamante", link="Elmo de Diamante", note="end-ench-equipment", cannot_stack=true, plural="Elmos de Diamante Encantados", male=true },
["calças-de-diamante-encantadas"] = { "item", id="calças-de-diamante", link="Calças de Diamante", note="end-ench-equipment", cannot_stack=true, plural=false },
["picareta-de-diamante-encantada"] = { "item", id="picareta-de-diamante", link="Picareta de Diamante", note="end-ench-equipment", cannot_stack=true, plural="Picaretas de Diamante Encantadas" },
["pá-de-diamante-encantada"] = { "item", id="pá-de-diamante", link="Diamond Shovel", note="end-ench-equipment", cannot_stack=true, plural="Pás de Diamante Encantadas" },
["espada-de-diamante-encantada"] = { "item", id="espada-de-diamante", link="Espada de Diamante", note="end-ench-equipment", cannot_stack=true, plural="Espadas de Diamantes Encantadas" },
["botas-de-ferro-encantadas"] = { "item", id="botas-de-ferro", link="Botas de Ferro", note="end-ench-equipment", cannot_stack=true, plural=false },
["peitoral-de-ferro-encantado"] = { "item", id="peitoral-de-ferro", link="Peitoral de Ferro", note="end-ench-equipment", cannot_stack=true, plural="Peitorais de Ferro Encantados", male=true },
["elmo-de-ferro-encantado"] = { "item", id="elmo-de-ferro", link="Elmo de Ferro", note="end-ench-equipment", cannot_stack=true, plural="Elmos de Ferro Encantados", male=true },
["calças-de-ferro-encantadas"] = { "item", id="calças-de-ferro", link="Calças de Ferro", note="end-ench-equipment", cannot_stack=true, plural=false },
["picareta-de-ferro-encantada"] = { "item", id="picareta-de-ferro", link="Picareta de Ferro", note="end-ench-equipment", cannot_stack=true, plural="Picaretas de Ferro Encantadas" },
["pá-de-ferro-encantada"] = { "item", id="pá-de-ferro", link="Pá de Ferro", note="end-ench-equipment", cannot_stack=true, plural="Pás de Ferro Encantadas" },
["espada-de-ferro-encantada"] = { "item", id="espada-de-ferro", link="Espada de Ferro", note="end-ench-equipment", cannot_stack=true, plural="Espadas de Ferro Encantadas" },
["vazio"] = { "block", id="ar", link='', title='Nada', plural=false, note="nada" },
},
notes = {
["level-book"] = "<ref group='nota' name='level-book'>As probabilidades de encantamento são as mesmas que as de um encantamento de nível 30 em uma [[mesa de encantementos]], mas a chance de vários encantamentos não é reduzida.</ref>",
["end-ench-equipment"] = "<ref group='nota' name='end-city-enchantment'>As probabilidades de encantamento são as mesmas que as de um [[Mecânicas de encantamento|encantamento]] de nível 20 a nível 39 em uma [[mesa de encantamentos]] que não tenha nível 30 como o máximo e que possa aplicar encantamentos de tesouro.</ref>",
["random-book"] = "<ref group='nota' name='random-book'>Todos os encantamentos são igualmente possíveis, e qualquer nível de encantamento é também igualmente possível.</ref>",
["nada"] = "<ref group='nota' name='nada'>'Nada' não se refere a chance de um baú vazio. Em vez disso, refere-se à chance de um gerador de pilhagem aleatória não adicionar qualquer item de pilhagem ''de primeira''.</ref>",
},
-- 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 = {
["village-blacksmith"] = { -- village_blacksmith.json
header = "[[Vila]]",
link = "ferreiro da [[vila]]",
pools = {
{
rolls = {3,8},
items = {
["diamante"] = {1,3,3},
["barra-de-ferro"] = {1,5,10},
["barra-de-ouro"] = {1,3,5},
["pão"] = {1,3,15},
["maçã"] = {1,3,15},
["picareta-de-ferro"] = {1,1,5},
["espada-de-ferro"] = {1,1,5},
["peitoral-de-ferro"] = {1,1,5},
["elmo-de-ferro"] = {1,1,5},
["calças-de-ferro"] = {1,1,5},
["botas-de-ferro"] = {1,1,5},
["obsidiana"] = {3,7,5},
["muda-de-carvalho"] = {3,7,5},
["armadura-de-ferro-para-cavalo"] = {1,1,1},
["armadura-de-ouro-para-cavalo"] = {1,1,1},
["armadura-de-diamante-para-cavalo"] = {1,1,1},
["sela"] = {1,1,3}
}
},
},
poolsDev = {}
},
["stronghold-altar"] = { -- stronghold_corridor.json
header = "Altar",
superheader = "[[Fortaleza]]",
link = "altar da [[fortaleza]]",
pools = {
{
rolls = {2,3},
items = {
["pérola-do-fim"] = {1,1,10},
["diamante"] = {1,3,3},
["barra-de-ferro"] = {1,5,10},
["barra-de-ouro"] = {1,3,5},
["redstone"] = {4,9,5},
["pão"] = {1,3,15},
["maçã"] = {1,3,15},
["picareta-de-ferro"] = {1,1,5},
["espada-de-ferro"] = {1,1,5},
["peitoral-de-ferro"] = {1,1,5},
["elmo-de-ferro"] = {1,1,5},
["calças-de-ferro"] = {1,1,5},
["botas-de-ferro"] = {1,1,5},
["maçã-dourada"] = {1,1,1},
["sela"] = {1,1,1},
["armadura-de-ferro-para-cavalo"] = {1,1,1},
["armadura-de-ouro-para-cavalo"] = {1,1,1},
["armadura-de-diamante-para-cavalo"] = {1,1,1},
["livro-encantado"] = {1,1,1},
}
},
},
poolsDev = {}
},
["stronghold-library"] = { -- stronghold_library.json
header = "Biblioteca",
superheader = "[[Fortaleza]]",
link = "biblioteca da [[fortaleza]]",
pools = {
{
rolls = {2,10},
items = {
["livro"] = {1,3,20},
["papel"] = {2,7,20},
["mapa-em-branco"] = {1,1,1},
["bússola"] = {1,1,1},
["livro-encantado"] = {1,1,10},
}
},
},
poolsDev = {}
},
["stronghold-storeroom"] = { -- stronghold_crossing.json
header = "Despensa",
superheader = "[[Fortaleza]]",
link = "despensa da [[fortaleza]]",
pools = {
{
rolls = {1,4},
items = {
["barra-de-ferro"] = {1,5,10},
["barra-de-ouro"] = {1,3,5},
["redstone"] = {4,9,5},
["carvão"] = {3,8,10},
["pão"] = {1,3,15},
["maçã"] = {1,3,15},
["picareta-de-ferro"] = {1,1,1},
["livro-encantado"] = {1,1,1},
}
},
},
poolsDev = {}
},
["bonus"] = { -- spawn_bonus_chest.json
header = "[[Baú#Baú bônus|Bônus]]",
link = "[[Baú#Baú bônus|bônus]]",
pools = {
{
rolls = {1,1},
items = {
["machado-de-pedra"] = {1,1,1},
["machado-de-madeira"] = {1,1,3},
}
},
{
rolls = {1,1},
items = {
["picareta-de-pedra"] = {1,1,1},
["picareta-de-madeira"] = {1,1,3}
}
},
{
rolls = {3,3},
items = {
["maçã"] = {1,2,5},
["pão"] = {1,2,3},
["salmão-cru"] = {1,2,3},
}
},
{
rolls = {4,4},
items = {
["graveto"] = {1,12,10},
["tábuas"] = {1,12,10},
["madeira-de-carvalho"] = {1,3,10},
["madeira-de-acácia"] = {1,3,10},
}
},
},
poolsDev = {}
},
["dungeon"] = { -- simple_dungeon.json
header = "[[Calabouço]]",
link = "[[calabouço]]",
pools = {
{
rolls = {1,3},
items = {
["sela"] = {1,1,20},
["maçã-dourada"] = {1,1,15},
["maçã-do-notch"] = {1,1,2},
["disco-13"] = {1,1,15},
["disco-cat"] = {1,1,15},
["etiqueta"] = {1,1,20},
["armadura-de-ferro-para-cavalo"] = {1,1,10},
["armadura-de-ouro-para-cavalo"] = {1,1,15},
["armadura-de-diamante-para-cavalo"] = {1,1,5},
["livro-encantado-rnd"] = {1,1,10},
}
},
{
rolls = {1,4},
items = {
["barra-de-ferro"] = {1,4,10},
["barra-de-ouro"] = {1,4,5},
["pão"] = {1,1,20},
["trigo"] = {1,4,20},
["balde"] = {1,1,10},
["redstone"] = {1,4,15},
["carvão"] = {1,4,15},
["sementes-de-melancia"] = {2,4,10},
["sementes-de-abóbora"] = {2,4,10},
["sementes-de-beterraba"] = {2,4,10},
}
},
{
rolls = {3,3},
items = {
["osso"] = {1,8,10},
["pólvora"] = {1,8,10},
["carne-podre"] = {1,8,10},
["linha"] = {1,8,10},
}
},
},
poolsDev = {}
},
["mineshaft"] = { -- abandoned_mineshaft.json
chest_type = "carrinho com baú",
header = "[[Mina abandonada]]",
link = "[[minas abandonadas]]",
pools = {
{
rolls = {1,1},
items = {
["maçã-dourada"] = {1,1,20},
["maçã-do-notch"] = {1,1,1},
["etiqueta"] = {1,1,30},
["livro-encantado-rnd"] = {1,1,10},
["picareta-de-ferro"] = {1,1,5},
["vazio"] = {1,1,5},
}
},
{
rolls = {2,4},
items = {
["barra-de-ferro"] = {1,5,10},
["barra-de-ouro"] = {1,3,5},
["redstone"] = {4,9,5},
["lápis-lazúli"] = {4,9,5},
["diamante"] = {1,2,3},
["carvão"] = {3,8,10},
["pão"] = {1,3,15},
["sementes-de-melancia"] = {2,4,10},
["sementes-de-abóbora"] = {2,4,10},
["sementes-de-beterraba"] = {2,4,10},
}
},
{
rolls = {3,3},
items = {
["trilho"] = {4,8,20},
["trilho-elétrico"] = {1,4,5},
["trilho-detector"] = {1,4,5},
["trilho-ativador"] = {1,4,5},
["tocha"] = {1,16,15},
}
},
},
poolsDev = {}
},
["nether-fortress"] = { -- nether_bridge.json
header = "[[Fortaleza do Nether|Fortaleza]]<br>[[Fortaleza do Nether|do Nether]]",
link = "[[fortaleza do Nether]]",
pools = {
{
rolls = {2,4},
items = {
["diamante"] = {1,3,5},
["barra-de-ferro"] = {1,5,5},
["barra-de-ouro"] = {1,3,15},
["espada-de-ouro"] = {1,1,5},
["peitoral-de-ouro"] = {1,1,5},
["isqueiro"] = {1,1,5},
["fungo-do-nether"] = {3,7,5},
["sela"] = {1,1,10},
["armadura-de-ouro-para-cavalo"] = {1,1,8},
["armadura-de-ferro-para-cavalo"] = {1,1,5},
["armadura-de-diamante-para-cavalo"] = {1,1,3},
["obsidiana"] = {2,4,2},
}
},
},
poolsDev = {}
},
["desert-temple"] = { -- desert_pyramid.json
header = "[[Templo do deserto]]",
link = "[[templo do deserto]]",
pools = {
{
rolls = {2,4},
items = {
["diamante"] = {1,3,5},
["barra-de-ferro"] = {1,5,15},
["barra-de-ouro"] = {2,7,15},
["esmeralda"] = {1,3,15},
["osso"] = {4,6,25},
["olho-de-aranha"] = {1,3,25},
["carne-podre"] = {3,7,25},
["sela"] = {1,1,20},
["armadura-de-ferro-para-cavalo"] = {1,1,15},
["armadura-de-ouro-para-cavalo"] = {1,1,10},
["armadura-de-diamante-para-cavalo"] = {1,1,5},
["livro-encantado-rnd"] = {1,1,20},
["maçã-dourada"] = {1,1,20},
["maçã-do-notch"] = {1,1,2},
["vazio"] = {1,1,15},
}
},
{
rolls = {4,4},
items = {
["osso"] = {1,8,10},
["pólvora"] = {1,8,10},
["carne-podre"] = {1,8,10},
["linha"] = {1,8,10},
["areia"] = {1,8,10},
}
},
},
poolsDev = {}
},
["jungle-temple"] = { -- jungle_temple.json
header = "[[Templo da selva]]",
link = "[[templo da selva]]",
pools = {
{
rolls = {2,6},
items = {
["diamante"] = {1,3,3},
["barra-de-ferro"] = {1,5,10},
["barra-de-ouro"] = {2,7,15},
["esmeralda"] = {1,3,2},
["armadura-de-ferro-para-cavalo"] = {1,1,1},
["armadura-de-ouro-para-cavalo"] = {1,1,1},
["armadura-de-diamante-para-cavalo"] = {1,1,1},
["sela"] = {1,1,3},
["livro-encantado"] = {1,1,1},
["osso"] = {4,6,20},
["carne-podre"] = {3,7,16}
}
},
},
poolsDev = {}
},
["jungle-temple-dispenser"] = { -- jungle_temple_dispenser.json
chest_type = "dispenser",
link = "[[templo da selva]]",
pools = {
{
rolls = {1,2},
items = {
["flecha"] = {2,7,30}
}
},
},
poolsDev = {}
},
["end-city"] = { -- end_city_treasure.json
header = "[[Cidade do Fim]]",
link = "[[Cidade do Fim]]",
pools = {
{
rolls = {2,6},
items = {
["diamante"] = {2,7,5},
["barra-de-ferro"] = {4,8,10},
["barra-de-ouro"] = {2,7,15},
["esmeralda"] = {2,6,2},
["sementes-de-beterraba"] = {1,10,5},
["sela"] = {1,1,3},
["armadura-de-ferro-para-cavalo"] = {1,1,1},
["armadura-de-ouro-para-cavalo"] = {1,1,1},
["armadura-de-diamante-para-cavalo"] = {1,1,1},
["espada-de-diamante-encantada"] = {1,1,3},
["botas-de-diamante-encantadas"] = {1,1,3},
["peitoral-de-diamante-encantado"] = {1,1,3},
["calças-de-diamante-encantadas"] = {1,1,3},
["elmo-de-diamante-encantado"] = {1,1,3},
["picareta-de-diamante-encantada"] = {1,1,3},
["pá-de-diamante-encantada"] = {1,1,3},
["espada-de-ferro-encantada"] = {1,1,3},
["botas-de-ferro-encantadas"] = {1,1,3},
["peitoral-de-ferro-encantado"] = {1,1,3},
["calças-de-ferro-encantadas"] = {1,1,3},
["elmo-de-ferro-encantado"] = {1,1,3},
["picareta-de-ferro-encantada"] = {1,1,3},
["pá-de-ferro-encantada"] = {1,1,3},
}
},
},
poolsDev = {}
},
["igloo"] = {
header = "[[Iglu]]",
link = "[[iglu]]",
pools = {
{
rolls = {2,8},
items = {
["maçã"] = {1,3,15},
["carvão"] = {1,4,15},
["pepita-de-ouro"] = {1,3,10},
["machado-de-pedra"] = {1,1,2},
["carne-podre"] = {1,1,10},
["esmeralda"] = {1,1,1},
["trigo"] = {2,3,10}
}
},
{
rolls = {1,1},
items = {
["maçã-dourada"] = {1,1,1},
}
},
},
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 = {
["desert"] = "desert-temple",
["jungle"] = "jungle-temple",
["nether"] = "nether-fortress",
["fortress"] = "nether-fortress",
["village"] = "village-blacksmith",
["blacksmith"] = "village-blacksmith",
["altar"] = "stronghold-altar",
["storeroom"] = "stronghold-storeroom",
["library"] = "stronghold-library"
},
-- 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. "nether-fortress"
-- chest-param -> description-string
display_names = {
["nether-fortress"] = "fortaleza do Nether",
["nether"] = "fortaleza do Nether",
["fortress"] = "fortaleza do Nether",
["desert"] = "templo do deserto",
["jungle"] = "templo da selva",
["desert-temple"] = "templo do deserto",
["jungle-temple"] = "templo da selva"
},
-- these descriptions are used:
-- * in column <abbr> titles,
-- * and above the table when only a single column-type is chosen
columns = {
["stacksize"] = 'the size of stacks (or for unstackable items, number) of this item found in this chest.',
["weight"] = 'the weight of this item relative to other items in the chest.',
["items"] = 'the number of items expected per chest, averaged over a large number of chests.',
["chance"] = 'the odds of getting any of this item in a single chest.',
["chests"] = 'the number of chests expected to search, to find any of this item.'
},
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 style='font-style:italic; color:red;'>Module:LootChest: no valid arguments</span>"
end
q.fill_in_chest_derivative_data( chests )
-- construct an ordered list dictating the order of the rows
local ordered_item_rows = q.construct_ordered_item_rows( chests )
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 itemname = args[1]
if p.items[itemname] == nil then
return '<span style="color:red;">unknown item "' .. itemname .. '"</span>'
end
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
local html = {}
if q.tablelength( chances ) > 0 then
table.insert( html, p.base2_sub( itemname, chances ) )
end
if q.tablelength( devChances ) > 0 and q.compare_tables( chances, devChances ) then
table.insert( html, p.current_frame:preprocess( p.dev ) .. q.lcfirst( p.base2_sub( itemname, devChances ) ) )
end
return table.concat( html, ' ' )
end
p.base2_sub = function( itemname, chances )
local html = {}
local item_display_name = ''
local is_male = false
if p.items[itemname].plural ~= nil and p.items[itemname].plural ~= false then
item_display_name = p.items[itemname].plural
else
if p.items[itemname].title ~= nil then
item_display_name = p.items[itemname].title
else
item_display_name = string.gsub( itemname, '-', ' ' )
end
if p.items[itemname].plural == nil or p.items[itemname].plural ~= false then
item_display_name = q.single_item_plural( item_display_name )
end
end
if p.items[itemname].male ~= nil then
is_male = p.items[itemname].male
end
item_display_name = q.capitalize( item_display_name )
table.insert( html, item_display_name )
if is_male then
table.insert( html, ' podem ser encontrados ' )
else
table.insert( html, ' podem ser encontradas ' )
end
local html_stacks = {}
local stack_sep = ', '
local ns = q.tablelength( chances )
local s = 0
for stacksize, chest_details in pairs( chances ) do
s = s + 1
local html_per_stack = { 'em ' }
local c = 0
local nc = q.tablelength( chest_details )
local sep = q.tern( nc > 2, ', ', ' ' )
if nc > 2 and s ~= ns then
stack_sep = '; '
end
for k, chest in pairs( chest_details ) do
c = c + 1
if c == nc and nc > 1 then
table.insert( html_per_stack, 'e ' )
end
if chest.chance == 1 then
table.insert( html_per_stack, " all " )
else
table.insert( html_per_stack, string.format("%.1f", chest.chance*100) )
table.insert( html_per_stack, "% de " )
end
if chest.chest_type == 'carrinho com baú' then
table.insert( html_per_stack, ' [[Carrinho com Baú|carrinhos com baú]] em ' )
table.insert( html_per_stack, p.chests[chest.chest_name].link )
elseif chest.chest_type == 'ejetor' then
table.insert( html_per_stack, ' [[ejetor]]es em ' )
table.insert( html_per_stack, p.chests[chest.chest_name].link )
else
table.insert( html_per_stack, ' baús de ' )
table.insert( html_per_stack, p.chests[chest.chest_name].link )
end
table.insert( html_per_stack, sep )
end
if nc > 2 then
table.insert( html_per_stack, 'tudo ' )
end
table.insert( html_per_stack, 'em ' )
if p.items[itemname].cannot_stack ~= nil then
table.insert( html_per_stack, 'grupos de ' )
else
table.insert( html_per_stack, 'stacks de ' )
end
table.insert( html_per_stack, stacksize )
table.insert( html_stacks, table.concat( html_per_stack ) )
end
local stackwise_summaries = ''
if #html_stacks == 1 then
table.insert( html, html_stacks[1] )
else
for i = 1, #html_stacks - 1 do
table.insert( html, html_stacks[ i ] )
table.insert( html, stack_sep )
end
table.insert( html, 'e ' )
table.insert( html, html_stacks[#html_stacks] )
end
table.insert( html, '.' )
return table.concat( html )
end
p.base2_test = function()
items = {}
for item_name, v in pairs( p.items ) do
table.insert( items, p.base2{ item_name } .. '\n\n' )
end
table.sort( items )
return table.concat(items)
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 "baú" ) } )
end
end
return chances
end,
single_item_plural = function( itemname )
if string.sub( itemname, -2 ) == 'ss'
or string.sub( itemname, -2 ) == 'ch'
or string.sub( itemname, -2 ) == 'sh'
or string.sub( itemname, -1 ) == 's' then
return itemname .. 'es'
end
return itemname .. 's'
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 "baú" )
if chest_type == "baú" or chest_type == "carrinho com baú" 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, "leather" ) ~= nil then e1.material = 1 end
if string.find( e1.itemname, "iron" ) ~= nil then e1.material = 2 end
if string.find( e1.itemname, "gold" ) ~= nil then e1.material = 3 end
if string.find( e1.itemname, "diamond" ) ~= nil then e1.material = 4 end
e1.armor = 0
if string.find( e1.itemname, "helmet" ) ~= nil or string.find( e1.itemname, "cap" ) ~= nil then e1.armor = 1 end
if string.find( e1.itemname, "chestplate" ) ~= nil or string.find( e1.itemname, "tunic" ) ~= nil then e1.armor = 2 end
if string.find( e1.itemname, "leggings" ) ~= nil or string.find( e1.itemname, "pants" ) ~= nil then e1.armor = 3 end
if string.find( e1.itemname, "boots" ) ~= nil then e1.armor = 4 end
end
if e2.material == nil then
e2.material = 0
if string.find( e2.itemname, "leather" ) ~= nil then e2.material = 1 end
if string.find( e2.itemname, "iron" ) ~= nil then e2.material = 2 end
if string.find( e2.itemname, "gold" ) ~= nil then e2.material = 3 end
if string.find( e2.itemname, "diamond" ) ~= nil then e2.material = 4 end
e2.armor = 0
if string.find( e2.itemname, "helmet" ) ~= nil or string.find( e2.itemname, "cap" ) ~= nil then e2.armor = 1 end
if string.find( e2.itemname, "chestplate" ) ~= nil or string.find( e2.itemname, "tunic" ) ~= nil then e2.armor = 2 end
if string.find( e2.itemname, "leggings" ) ~= nil or string.find( e2.itemname, "pants" ) ~= nil then e2.armor = 3 end
if string.find( e2.itemname, "boots" ) ~= 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 = 'frac', 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['stacksize'] == nil and columns['weight'] == 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, "Values represent " )
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 "baú"
local display_name = p.chests[chest_name].display_name
chest_name = chest_name:gsub( "-", " " )
table.insert( html, "Cada " )
table.insert( html, display_name or chest_name )
if chest_type ~= 'baú' and chest_type ~= 'carrinho com baú' then
table.insert( html, " contém " )
else
table.insert( html, " baú contém " )
end
if #allRolls == 1 then
table.insert( html, allRolls[1] )
else
table.insert( html, #allRolls )
table.insert( html, ' groups of ' )
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, 'and ' )
table.insert( html, allRolls[#allRolls] )
end
table.insert( html, " item stacks, with the following distribution: \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['stacksize'] ~= nil then
colspan = colspan - 1 + allRollsSpan
end
if columns['weight'] ~= 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, 'and ' )
table.insert( row, allRolls[#allRolls] )
end
table.insert( row, ' stacks)</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['stacksize'] ~= nil then
table.insert( html, headersort_th_colspan_open )
table.insert( html, p.columns['stacksize'] )
table.insert( html, "'> Stack Size </abbr></th>\n" )
end
if columns['weight'] ~= nil then
table.insert( html, headersort_th_colspan_open )
table.insert( html, p.columns['weight'] )
table.insert( html, "'> Weight" )
table.insert( html, "</abbr></th>\n" )
end
if columns['items'] ~= nil then
table.insert( html, headersort_th_open )
table.insert( html, p.columns['items'] )
table.insert( html, "'> # Items </abbr></th>\n" )
end
if columns['chance'] ~= nil then
table.insert( html, headersort_th_open )
table.insert( html, p.columns['chance'] )
table.insert( html, "'> Chance </abbr></th>\n" )
end
if columns['chests'] ~= nil then
table.insert( html, headersort_th_open )
table.insert( html, p.columns['chests'] )
table.insert( html, "'> # Chests </abbr></th>\n" )
end
end
end
table.insert( html, "</tr><tr>\n" )
end
if use_roll_row then
local rowcols = ( columns['stacksize'] ~= nil and 1 or 0 ) + ( columns['weight'] ~= 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['stacksize'] ~= 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['weight'] ~= 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['items'] ~= nil then
table.insert( html, "<td style='text-align:center;'>" )
table.insert( html, avg_amount )
table.insert( html, "</td>" )
end
if columns['chance'] ~= nil then
table.insert( html, "<td style='text-align:right;'>" )
table.insert( html, chance_any )
table.insert( html, "</td>" )
end
if columns['chests'] ~= 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['stacksize'] ~= nil then
for k = 1, allRollsSpan do
table.insert( html, "<td data-sort-value='0' style='text-align:center;'>—</td>" )
end
end
if columns['weight'] ~= nil then
for k = 1, allRollsSpan do
table.insert( html, "<td data-sort-value='0' style='text-align:center;'>—</td>" )
end
end
if columns['items'] ~= nil then
table.insert( html, "<td data-sort-value='0' style='text-align:center;'>—</td>" )
end
if columns['chance'] ~= nil then
table.insert( html, "<td data-sort-value='0' style='text-align:right;'>—</td>" )
end
if columns['chests'] ~= 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 string.gsub(chest_item,'-',' '),
text=item.title or q.titlecase(string.gsub(chest_item,'-',' ')),
settings= q.tern( item[1] == 'item', 'ItemSprite', 'BlockSprite' )
}
table.insert( html, image )
table.insert( html, spriteCat )
if item.note and p.notes[item.note] then
table.insert( html, p.current_frame:preprocess( p.notes[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 == "and" then
table.insert( buf, word )
else
local first, rest = string.sub( word, 1, 1 ), string.sub( word, 2 )
table.insert( buf, string.upper(first) .. string.lower(rest) )
end
end
return table.concat( buf, " " )
end,
capitalize = function( str )
return ( string.lower(str):gsub( "^%l", string.upper ) )
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