Anonymous

Template:Disambiguation/doc: Difference between revisions

From Melvor Idle
Fixed foods being duplicated. Added the starting 2 headers for equipment table template
m (Fixed combat areas being doubled)
(Fixed foods being duplicated. Added the starting 2 headers for equipment table template)
Line 8: Line 8:
<syntaxhighlight lang="javascript" line>
<syntaxhighlight lang="javascript" line>
// Settings //
// Settings //
let searchTerm = 'Siren'; // The proper capitalization of the search term
let searchTerm = 'Sand'; // The proper capitalization of the search term
let returnEquipmentTemplate = false; // returns a template for {{EquipmentTableFromList}} instead
let returnEquipmentTemplate = false; // returns a template for {{EquipmentTableFromList}} instead
// End of Settings //
// End of Settings //
Line 28: Line 28:
}
}
let results = [];
let results = [];
if (returnEquipmentTemplate) results.push(`{{V|${gameVersion.substr(1)}}}\n\n{{EquipmentTableFromList`);
if (returnEquipmentTemplate) results.push(`{{V|${gameVersion.substr(1)}}}\n\n==${searchTerm} Equipment==\n===Weapons===\n{{EquipmentTableFromList`);
if (!returnEquipmentTemplate) results.push(`{{Disam}}{{V|${gameVersion.substr(1)}}}\n`, `'''${searchTerm}''' may refer to:`);
if (!returnEquipmentTemplate) results.push(`{{Disam}}{{V|${gameVersion.substr(1)}}}\n`, `'''${searchTerm}''' may refer to:`);
pushResults({arr: game.items.weapons.filter(x => search(x)), header: '===Equipment===', iconType: 'ItemIcon'});
pushResults({arr: game.items.weapons.filter(x => search(x) && !x.name.includes('Arrow')), header: '===Equipment===', iconType: 'ItemIcon'});
pushResults({arr: game.items.equipment.filter(x => search(x) && !(x instanceof WeaponItem) && !x.validSlots.includes('Quiver')), header: '===Equipment===', iconType: 'ItemIcon'});
pushResults({arr: game.items.equipment.filter(x => search(x) && !(x instanceof WeaponItem) && !x.name.includes('Arrow')), header: '===Equipment===', iconType: 'ItemIcon'});
pushResults({arr: game.items.equipment.filter(x => search(x) && x.validSlots.includes('Quiver')), header: '===Equipment===', iconType: 'ItemIcon'});
pushResults({arr: game.items.equipment.filter(x => search(x) && x.name.includes('Arrow')), header: '===Equipment===', iconType: 'ItemIcon'});
pushResults({arr: game.items.filter(x => x.validSlots === undefined && !(x instanceof OpenableItem) && !(x instanceof BoneItem) && !(x instanceof FoodItem) && search(x)), header: '===Items===', iconType: 'ItemIcon'});
pushResults({arr: game.items.filter(x => x.validSlots === undefined && !(x instanceof OpenableItem) && !(x instanceof BoneItem) && !(x instanceof FoodItem) && search(x)), header: '===Items===', iconType: 'ItemIcon'});
pushResults({arr: game.items.openables.filter(x => search(x)), header: '===Openables===', iconType: 'ItemIcon'});
pushResults({arr: game.items.openables.filter(x => search(x)), header: '===Openables===', iconType: 'ItemIcon'});
pushResults({arr: game.items.bones.filter(x => search(x)), header: '===Bones===', iconType: 'ItemIcon'});
pushResults({arr: game.items.bones.filter(x => search(x)), header: '===Bones===', iconType: 'ItemIcon'});
pushResults({arr: game.items.food.filter(x => search(x)), header: '===Food===', iconType: 'ItemIcon'});
pushResults({arr: game.items.food.filter(x => search(x)), header: '===Food===', iconType: 'ItemIcon'});
pushResults({arr: game.items.food.filter(x => search(x)), header: '===Food===', iconType: 'ItemIcon'});
pushResults({arr: game.monsters.filter(x => search(x)), header: '===Combat===', iconType: 'MonsterIcon'});
pushResults({arr: game.monsters.filter(x => search(x)), header: '===Combat===', iconType: 'MonsterIcon'});