Template:Disambiguation/doc
Template that is used on Disambiguation pages. These are pages that are created to differentiate between multiple other pages with the same or a similar name.
An example of this would be Siren
The below script will search all current Icon Templates in v1.2.2 (except for Synergies, Spellbooks and Currencies) for the given searchTerm
then output an array of the results in valid Icon Template format with expansion icons.
This may result in some duplicates between Icons and Shop Purchases, such as Iron Sieve which is both an Item and Purchase.
let searchTerm = 'Siren';
let lcSearchTerm = searchTerm.toLowerCase();
const search = (obj) => obj.name?.toLowerCase().includes(lcSearchTerm);
const wikiIcon = (obj, icon, extras='') => `*${obj.namespace?.includes('TotH') ? '{{TotH}}' : obj.namespace?.includes('AoD') ? '{{AoD}}' : ''}{{${icon}|${obj.name}${extras}}}`
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')));
results.push(`===Items===`);
game.items.filter(x => x.validSlots === undefined && !(x instanceof OpenableItem) && !(x instanceof BoneItem) && !(x instanceof FoodItem) && search(x)).forEach(item => results.push(wikiIcon(item, 'ItemIcon')));
results.push(`===Openables===`);
game.items.openables.filter(x => search(x)).forEach(item => results.push(wikiIcon(item, 'ItemIcon')));
results.push(`===Bones===`);
game.items.bones.filter(x => search(x)).forEach(item => results.push(wikiIcon(item, 'ItemIcon')));
results.push(`===Food===`);
game.items.food.filter(x => search(x)).forEach(item => results.push(wikiIcon(item, 'ItemIcon')));
results.push(`===Combat===`);
game.monsters.filter(x => search(x)).forEach(monster => results.push(wikiIcon(monster, 'MonsterIcon')));
game.combatAreas.filter(x => search(x)).forEach(area => results.push(wikiIcon(area, 'ZoneIcon')));
game.slayerAreas.filter(x => search(x)).forEach(area => results.push(wikiIcon(area, 'ZoneIcon')));
game.dungeons.filter(x => search(x)).forEach(area => results.push(wikiIcon(area, 'ZoneIcon')));
results.push(`===Spells===`);
game.standardSpells.filter(x => search(x)).forEach(spell => results.push(wikiIcon(spell, 'SpellIcon'))); // In v1.3, these are
game.ancientSpells.filter(x => search(x)).forEach(spell => results.push(wikiIcon(spell, 'SpellIcon'))); // condensed into
game.archaicSpells.filter(x => search(x)).forEach(spell => results.push(wikiIcon(spell, 'SpellIcon'))); // game.attackSpells
game.curseSpells.filter(x => search(x)).forEach(spell => results.push(wikiIcon(spell, 'SpellIcon')));
game.auroraSpells.filter(x => search(x)).forEach(spell => results.push(wikiIcon(spell, 'SpellIcon')));
results.push(`===Purchases===`);
game.shop.purchases.filter(x => search(x)).forEach(purchase => results.push(wikiIcon(purchase, 'UpgradeIcon')));
results.push(`===Prayers===`);
game.prayers.filter(x => search(x)).forEach(prayer => results.push(wikiIcon(prayer, 'PrayerIcon')));
results.push(`===Township===`);
game.township.buildings.filter(x => search(x)).forEach(building => results.push(wikiIcon(building, 'TownshipIcon')));
game.township.seasons.filter(x => search(x)).forEach(season => results.push(wikiIcon(season, 'TownshipIcon')));
game.township.biomes.filter(x => search(x)).forEach(biome => results.push(wikiIcon(biome, 'TownshipIcon')));
game.township.resources.filter(x => search(x)).forEach(resource => results.push(wikiIcon(resource, 'TownshipIcon')));
results.push(`===Others===`);
game.skills.filter(x => search(x)).forEach(skill => results.push(wikiIcon(skill, 'Skill')));
game.pets.filter(x => search(x)).forEach(pet => results.push(wikiIcon(pet, 'PetIcon')));
game.astrology.actions.filter(x => search(x)).forEach(constellation => results.push(wikiIcon(constellation, 'ConstellationIcon')));
game.agility.actions.filter(x => search(x)).forEach(obstacle => results.push(wikiIcon(obstacle, 'AgilityIcon')));
game.thieving.actions.filter(x => search(x)).forEach(npc => results.push(wikiIcon(npc, 'Icon', '|type=thieving')));
if (cloudManager.hasAoDEntitlementAndIsEnabled)
game.cartography.worldMaps.getObjectByID('melvorAoD:Melvor').pointsOfInterest.filter(x => search(x)).forEach(poi => results.push(wikiIcon(poi, 'POIIcon')));
let outputString = ``;
results.forEach((str) => { outputString += `${str}\n` });
console.log(outputString);