Template:Disambiguation/doc: Difference between revisions

From Melvor Idle
mNo edit summary
m (Added expansion icons into output results)
Line 3: Line 3:
An example of this would be [[Siren]]
An example of this would be [[Siren]]


The below script will search all current [[Template:Icon|Icon Templates]] in v1.2.2 (except for Synergies, Spellbooks and Currencies) for the given <code>searchTerm</code> then output an array of the results in valid Icon Template format. Requires a bit of cleanup before it can be used on the Wiki. You can right click + Copy Object on the output array to copy the array. With a good text editor such as Notepad++ or Sublime, you can select multiple lines which makes the cleanup take a few seconds.
The below script will search all current [[Template:Icon|Icon Templates]] in v1.2.2 (except for Synergies, Spellbooks and Currencies) for the given <code>searchTerm</code> then output an array of the results in valid Icon Template format with expansion icons. Requires a bit of cleanup before it can be used on the Wiki. You can right click + Copy Object on the output array to copy the array. With a good text editor such as Notepad++ or Sublime, you can select multiple lines which makes the cleanup take a few seconds.


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.
Line 33: Line 33:
if (cloudManager.hasAoDEntitlementAndIsEnabled)
if (cloudManager.hasAoDEntitlementAndIsEnabled)
game.cartography.worldMaps.getObjectByID('melvorAoD:Melvor').pointsOfInterest.filter(x => search(x)).forEach(poi => results.push({item: poi, icon: 'POIIcon'}));
game.cartography.worldMaps.getObjectByID('melvorAoD:Melvor').pointsOfInterest.filter(x => search(x)).forEach(poi => results.push({item: poi, icon: 'POIIcon'}));
results.map(x => `*{{${x.icon}|${x.item.name}}}`);
results.map(x => `*${x.item.namespace?.includes('TotH') ? '{{TotH}}' : x.item.namespace?.includes('AoD') ? '{{AoD}}' : ''}{{${x.icon}|${x.item.name}}}`);
</syntaxhighlight>
</syntaxhighlight>

Revision as of 00:55, 19 May 2024

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. Requires a bit of cleanup before it can be used on the Wiki. You can right click + Copy Object on the output array to copy the array. With a good text editor such as Notepad++ or Sublime, you can select multiple lines which makes the cleanup take a few seconds.

This may result in some duplicates between Icons and Shop Purchases, such as Iron Sieve which is both an Item and Purchase.

let searchTerm = ''.toLowerCase();

const search = (obj) => obj.name.toLowerCase().includes(searchTerm);
let results = [];
game.items.filter(x => search(x)).forEach(item => results.push({item: item, icon: 'ItemIcon'}));
game.monsters.filter(x => search(x)).forEach(monster => results.push({item: monster, icon: 'MonsterIcon'}));
game.skills.filter(x => search(x)).forEach(skill => results.push({item: skill, icon: 'Skill'}));
game.standardSpells.filter(x => search(x)).forEach(spell => results.push({item: spell, icon: 'SpellIcon'})); // In v1.3, these are
game.ancientSpells.filter(x => search(x)).forEach(spell => results.push({item: spell, icon: 'SpellIcon'})); // condensed into
game.archaicSpells.filter(x => search(x)).forEach(spell => results.push({item: spell, icon: 'SpellIcon'})); // game.attackSpells
game.curseSpells.filter(x => search(x)).forEach(spell => results.push({item: spell, icon: 'SpellIcon'}));
game.auroraSpells.filter(x => search(x)).forEach(spell => results.push({item: spell, icon: 'SpellIcon'}));
game.shop.purchases.filter(x => search(x)).forEach(purchase => results.push({item: purchase, icon: 'UpgradeIcon'}));
game.pets.filter(x => search(x)).forEach(pet => results.push({item: pet, icon: 'PetIcon'}));
game.prayers.filter(x => search(x)).forEach(prayer => results.push({item: prayer, icon: 'PrayerIcon'}));
game.combatAreas.filter(x => search(x)).forEach(area => results.push({item: area, icon: 'ZoneIcon'}));
game.slayerAreas.filter(x => search(x)).forEach(area => results.push({item: area, icon: 'ZoneIcon'}));
game.dungeons.filter(x => search(x)).forEach(area => results.push({item: area, icon: 'ZoneIcon'}));
game.astrology.actions.filter(x => search(x)).forEach(constellation => results.push({item: constellation, icon: 'ConstellationIcon'}));
game.township.buildings.filter(x => search(x)).forEach(building => results.push({item: building, icon: 'TownshipIcon'}));
game.township.seasons.filter(x => search(x)).forEach(season => results.push({item: season, icon: 'TownshipIcon'}));
game.township.biomes.filter(x => search(x)).forEach(biome => results.push({item: biome, icon: 'TownshipIcon'}));
game.township.resources.filter(x => search(x)).forEach(resource => results.push({item: resource, icon: 'TownshipIcon'}));
game.agility.actions.filter(x => search(x)).forEach(obstacle => results.push({item: obstacle, icon: 'AgilityIcon'}));
if (cloudManager.hasAoDEntitlementAndIsEnabled)
	game.cartography.worldMaps.getObjectByID('melvorAoD:Melvor').pointsOfInterest.filter(x => search(x)).forEach(poi => results.push({item: poi, icon: 'POIIcon'}));
results.map(x => `*${x.item.namespace?.includes('TotH') ? '{{TotH}}' : x.item.namespace?.includes('AoD') ? '{{AoD}}' : ''}{{${x.icon}|${x.item.name}}}`);