Skip to content

Instantly share code, notes, and snippets.

@DennisCorvers
Last active April 5, 2024 02:42
Show Gist options
  • Save DennisCorvers/055fc3d56000be5160c63748555df26f to your computer and use it in GitHub Desktop.
Save DennisCorvers/055fc3d56000be5160c63748555df26f to your computer and use it in GitHub Desktop.
Melvor Idle - Fresh start account setup
// Script for base test character!
// ===============================
// List of all dungeons to complete once
// This is for progression unlocks like the passive slot.
const dungeonsToComplete = [
'melvorF:Into_the_Mist',
'melvorF:Impending_Darkness',
'melvorD:Volcanic_Cave',
'melvorF:Air_God_Dungeon',
'melvorF:Water_God_Dungeon',
'melvorF:Earth_God_Dungeon',
'melvorF:Fire_God_Dungeon',
];
// Temporarily disable notifyPlayer to improve script performance
let oldNotifyPlayer = notifyPlayer;
notifyPlayer = function() {}
// Complete Tutorial before we start
game.tutorial.completeTutorial();
// Add Money, Slayer Coins, Prayer Points
game.gp.add(1000000000000);
game.slayerCoins.add(1000000000000);
game.combat.player.addPrayerPoints(4000000000);
// 100% Items
game.items.forEach((item) => game.bank.addItem(item, 6969696969, false, true, true));
// Set all skills to 120
game.skills.forEach((x) => {
x.setXP(200000000);
});
// Unlock all astrology constellation bonusses (but doesn't buy them!)
game.masterySkills.forEach((s) => {
if (s.id !== 'melvorD:Astrology')
return;
s.actions.forEach((a) => {
s.addMasteryXP(a, exp.level_to_xp(99)+1);
})
});
// Complete dungeons once for unlocks.
// Disable pet rolls before dungeon clears.
mod.getDevContext().patch(PetManager, 'rollForSkillPet').replace(function(o) {})
game.dungeons.forEach(x => {
if (dungeonsToComplete.includes(x.id)) {
game.combat.player.manager.setDungeonCompleteCount(x, 1);
}
});
// 100% Summoning Marks
game.summoning.actions.forEach((mark) => {
game.summoning.marksUnlocked.set(mark, 61);
game.summoning.renderQueue.markCount.add(mark);
game.summoning.renderQueue.markState.add(mark);
});
game.summoning.renderMarkProgress();
game.summoning.renderMarkState();
// Survey the entire map (but gain no Hex mastery)
// Allows for activation of Hex bonusses without getting the mastery passives.
game.cartography.surveyWholeMap();
// Unlock Township
if (!game.township.townData.townCreated) {
game.township.selectWorship(game.township.worships.getObjectByID('melvorF:Aeris'));
game.township.confirmTownCreation();
}
// Build every building besides the Townhall.
// We don't want to polute the GP gained statistic with Township.
game.township.buildings.forEach((building) => {
if (building.id === 'melvorF:Town_Hall')
return;
let buildingBuilt;
building.biomes.forEach((biome) => {
let qtyToBuild = Math.min(game.township.getBuildingCountRemainingForLevelUp(building, biome), 100);
if (qtyToBuild <= 0) return;
buildingBuilt = true;
game.township.addBuildingToBiome(biome, building, qtyToBuild);
if (biome.getBuildingCount(building) >= building.maxUpgrades) {
townshipUI.performBuildingUpgradedUIChanges(building);
if (building.upgradesTo !== undefined)
game.township.addBuildingToBiome(biome, building.upgradesTo, 0);
}
});
if (!buildingBuilt) return;
// Update everything
game.township.updateBuildingModifierData(building);
game.township.updateForBuildingChange();
townshipUI.updateBuilding(building);
townshipUI.updateBuildingTotalModifierElement(building);
townshipUI.updateTraderStatus();
townshipUI.updateBuildingUpgradeProgressText(building);
townshipUI.updateBuildingUpgradeProgress(building);
game.township.game.township.renderQueue.activeTaskCategory = true;
game.township.tasks.checkForTaskReady(true);
game.township.computeTownStats();
game.township.onBuildingChange();
});
// Complete all Townnship Tasks
game.township.tasks.tasks.forEach((task) => { game.township.tasks.completeTask(task, false, true) });
// Restore notifyPlayer
notifyPlayer = oldNotifyPlayer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment