In-game Functions: Difference between revisions

Adding dungeon completions
(→‎Add XP: Added abyssal xp)
(Adding dungeon completions)
Line 300: Line 300:
</syntaxhighlight>
</syntaxhighlight>
The above code will reset all the quick equip items for '''all''' equipment sets.
The above code will reset all the quick equip items for '''all''' equipment sets.
== Dungeon Completions ==
The <code>addDungeonCompletion</code> and <code>setDungeonCompleteCount</code> functions are used to modify a dungeon's completion count.
<syntaxhighlight lang="js">
game.combat.player.manager.addDungeonCompletion(dungeon);
game.combat.player.manager.setDungeonCompleteCount(dungeon, amount);
</syntaxhighlight>
=== Attributes ===
{| class="wikitable"
|-
! Attribute !! Type !! Optional? !! Default Value !! Description
|-
| dungeon || object || No || || The dungeon you wish to add a completion to. Obtained with <syntaxhighlight lang="js" inline>game.dungeons.getObjectByID(dungeonID);</syntaxhighlight> where <code>dungeonID</code> is the ID of the dungeon.
A list of dungeon IDs can be obtained by entering the following into the console: <syntaxhighlight lang="js" inline>console.log(game.dungeons.allObjects.map((a) => a.id + ' - ' + a.name).join('\n'))</syntaxhighlight>.
|-
| amount || number || No || || The amount of dungeons clears you wish to add when using <code>setDungeonCompleteCount</code>. An amount is only required for setDungeonCompleteCount.
|}
=== Examples ===
<syntaxhighlight lang="js">
game.combat.player.manager.addDungeonCompletion(game.dungeons.getObjectByID('melvorF:Into_the_Mist'));
game.combat.player.manager.setDungeonCompleteCount(game.dungeons.getObjectByID('melvorF:Into_the_Mist'), 69420);
</syntaxhighlight>
The first line will add a single completion to {{ZoneIcon|Into the Mist}} while the second line will set the dungeon completions to 69420. Setting a dungeon completion count of 0 or lower will delete all completions from the dungeon.
After modifying the dungeon completion count, run <code>game.queueRequirementRenders();</code> to apply UI updates without having to restart the game.
{{Menu}}
{{Menu}}