Anonymous

Template:Disambiguation/doc: Difference between revisions

From Melvor Idle
m
Swapped version and disam templates
(Updated script)
m (Swapped version and disam templates)
Line 7: Line 7:
This may result in some duplicates between Icons and Shop Purchases, such as Iron Sieve which is both an Item and Purchase.
This may result in some duplicates between Icons and Shop Purchases, such as Iron Sieve which is both an Item and Purchase.
<syntaxhighlight lang="javascript" line>
<syntaxhighlight lang="javascript" line>
let searchTerm = 'Mirror';
let searchTerm = 'Siren';
let lcSearchTerm = searchTerm.toLowerCase();
let lcSearchTerm = searchTerm.toLowerCase();
const search = (obj) => obj.name.toLowerCase().includes(lcSearchTerm);
const search = (obj) => obj.name.toLowerCase().includes(lcSearchTerm);
const wikiIcon = (obj, icon) => `*${obj.namespace?.includes('TotH') ? '{{TotH}}' : obj.namespace?.includes('AoD') ? '{{AoD}}' : ''}{{${icon}|${obj.name}}}`
const wikiIcon = (obj, icon) => `*${obj.namespace?.includes('TotH') ? '{{TotH}}' : obj.namespace?.includes('AoD') ? '{{AoD}}' : ''}{{${icon}|${obj.name}}}`
let results = [`{{V|${gameVersion.substr(1)}}}{{Disam}}`, '', `'''${searchTerm}''' may refer to:`, '===Equipment==='];
let results = [`{{Disam}}{{V|${gameVersion.substr(1)}}}`, '', `'''${searchTerm}''' may refer to:`, '===Equipment==='];
game.items.equipment.filter(x => search(x)).forEach(item => results.push(wikiIcon(item, 'ItemIcon')));
game.items.equipment.filter(x => search(x)).forEach(item => results.push(wikiIcon(item, 'ItemIcon')));
results.push(`===Items===`);
results.push(`===Items===`);