Template:TownshipBiomeTable/doc: Difference between revisions
From Melvor Idle
(Created doc) |
(Add data-sort-values) |
||
(One intermediate revision by the same user not shown) | |||
Line 7: | Line 7: | ||
let requirement = biome.abyssalTier > 0 ? game.township.abyssalTierRequirements[biome.abyssalTier] : game.township.populationForTier[biome.tier]; | let requirement = biome.abyssalTier > 0 ? game.township.abyssalTierRequirements[biome.abyssalTier] : game.township.populationForTier[biome.tier]; | ||
let skillType = biome.abyssalTier > 0 ? 'AbyssalSkill' : 'Skill'; | let skillType = biome.abyssalTier > 0 ? 'AbyssalSkill' : 'Skill'; | ||
let population = game.township.populationForTier[biome.tier].population; | |||
results += `\n|-\n| {{TownshipIcon|${biome.name}|notext=true}}` | results += `\n|-\n| {{TownshipIcon|${biome.name}|notext=true}}` | ||
results += `\n| ${biome.name}` | results += `\n| ${biome.name}` | ||
results += `\n| {{${skillType}|Township|notext=true}} ${requirement.level || requirement.abyssalLevel}` | results += `\n|data-sort-value=${requirement.level || (requirement.abyssalLevel + 120)}| {{${skillType}|Township|notext=true}} ${requirement.level || requirement.abyssalLevel}` | ||
results += `\n| ${numberWithCommas( | results += `\n|data-sort-value=${population}| ${numberWithCommas(population)}` | ||
results += `\n| ${requirement.fortification || 0}%` | results += `\n|data-sort-value=${requirement.fortification || 0}| ${requirement.fortification || 0}%` | ||
}); | }); | ||
console.log(results); | results += '\n|}';console.log(results); | ||
self.nw?.Clipboard.get().set ? self.nw?.Clipboard?.get().set(results, 'text') : copy(results); | self.nw?.Clipboard.get().set ? self.nw?.Clipboard?.get().set(results, 'text') : copy(results); | ||
</syntaxhighlight> | </syntaxhighlight> |
Latest revision as of 07:49, 8 October 2024
A script is used to generate the following table. To use, open the game and paste the below into the console. The outputs will be copied to your clipboard automatically. After running the script, 'edit source' on Template:TownshipBiomeTable then Ctrl+A and Ctrl+V. Look over the contents to ensure everything looks fine.
let results = `<noinclude>{{/doc}}[[Category:Manual Tables]]</noinclude>\n{| class="wikitable sortable stickyHeader col-4-right col-5-right"\n|- class="headerRow-0"\n!rowspan="2" colspan="2"| Biome\n!colspan="3"| Requirements\n|- class="headerRow-1"\n! Level\n! {{TownshipIcon|Population}}\n! {{TownshipIcon|Fortification}}`;
game.township.biomes.forEach(biome => {
let requirement = biome.abyssalTier > 0 ? game.township.abyssalTierRequirements[biome.abyssalTier] : game.township.populationForTier[biome.tier];
let skillType = biome.abyssalTier > 0 ? 'AbyssalSkill' : 'Skill';
let population = game.township.populationForTier[biome.tier].population;
results += `\n|-\n| {{TownshipIcon|${biome.name}|notext=true}}`
results += `\n| ${biome.name}`
results += `\n|data-sort-value=${requirement.level || (requirement.abyssalLevel + 120)}| {{${skillType}|Township|notext=true}} ${requirement.level || requirement.abyssalLevel}`
results += `\n|data-sort-value=${population}| ${numberWithCommas(population)}`
results += `\n|data-sort-value=${requirement.fortification || 0}| ${requirement.fortification || 0}%`
});
results += '\n|}';console.log(results);
self.nw?.Clipboard.get().set ? self.nw?.Clipboard?.get().set(results, 'text') : copy(results);