Anonymous

Template:Disambiguation/doc: Difference between revisions

From Melvor Idle
m
Newlined version template
m (Added `includeModifiers` in equipment template)
m (Newlined version template)
Line 12: Line 12:
// Settings //
// Settings //
let searchTerm = 'Siren'; // The proper capitalization of the search term
let searchTerm = 'Siren'; // The proper capitalization of the search term
let returnEquipmentTemplate = true; // returns a template for {{EquipmentTableFromList}} instead
let returnEquipmentTemplate = false; // returns a template for {{EquipmentTableFromList}} instead
// End of Settings //
// End of Settings //
const search = (item) => !item.isModded && item.name.toLowerCase().includes(searchTerm.toLowerCase());
const search = (item) => !item.isModded && item.name.toLowerCase().includes(searchTerm.toLowerCase());
Line 30: Line 30:
let results = [];
let results = [];
if (returnEquipmentTemplate) results.push(`{{UserContentVersion|${gameVersion.substr(1)}}}\n\n=${searchTerm} Equipment=\n==Melee Weapons==\n{{EquipmentTableFromList\n\n}}\n==Ranged Weapons & Ammo==\n{{EquipmentTableFromList\n\n}}\n==Armour==\n{{EquipmentTableFromList\n|includeModifiers=false`);
if (returnEquipmentTemplate) results.push(`{{UserContentVersion|${gameVersion.substr(1)}}}\n\n=${searchTerm} Equipment=\n==Melee Weapons==\n{{EquipmentTableFromList\n\n}}\n==Ranged Weapons & Ammo==\n{{EquipmentTableFromList\n\n}}\n==Armour==\n{{EquipmentTableFromList\n|includeModifiers=false`);
if (!returnEquipmentTemplate) results.push(`{{Disam}}{{UserContentVersion|${gameVersion.substr(1)}}}\n`, `'''${searchTerm}''' may refer to:`);
if (!returnEquipmentTemplate) results.push(`{{Disam}}\n{{UserContentVersion|${gameVersion.substr(1)}}}\n`, `'''${searchTerm}''' may refer to:`);
pushResults(game.items.weapons.filter(x => search(x) && !x.validSlots.includes('Quiver')), '==Equipment==', 'ItemIcon');
pushResults(game.items.weapons.filter(x => search(x) && !x.validSlots.includes('Quiver')), '==Equipment==', 'ItemIcon');
pushResults(game.items.equipment.filter(x => search(x) && x.validSlots.includes('Quiver')), '==Equipment==', 'ItemIcon');
pushResults(game.items.equipment.filter(x => search(x) && x.validSlots.includes('Quiver')), '==Equipment==', 'ItemIcon');