Template:AdventureAbyssalUnlockTable/doc: Difference between revisions

m
Remove unnecessary array of strings; Cleaned up code a bit
No edit summary
m (Remove unnecessary array of strings; Cleaned up code a bit)
 
Line 2: Line 2:


<syntaxhighlight lang="javascript" line>
<syntaxhighlight lang="javascript" line>
let results = [`<noinclude>{{/doc}}[[Category:Manual Tables]]</noinclude>\n{| class="wikitable sortable stickyHeader"\n|-class="headerRow-0"\n!|Unlock!!Cost!!Cumulative Cost`];
let results = `<noinclude>{{/doc}}[[Category:Manual Tables]]</noinclude>\n{| class="wikitable stickyHeader"\n|- class="headerRow-0"\n! Unlock\n! Cost \n! Cumulative Cost`;
let totalCost = 0, cost = 0, id = 0;
let totalCost = 0, cost = 0, id = 0;
while (cost < 1000000000) {
while (cost < 1000000000) {
cost = game.gamemodes.allObjects[3].abyssalLevelCapCost.getCosts(game, id, 1)._currencies.get(game.abyssalPieces);
cost = game.gamemodes.getObjectByID('melvorF:Adventure').abyssalLevelCapCost.getCosts(game, id, 1)._currencies.get(game.abyssalPieces);
totalCost += cost;
totalCost += cost;
results.push(`|${id+1}${cost === 1000000000 ? '+' : ''}||{{AP|${cost}}}||{{AP|${totalCost}}}`);
results += `\n|-\n| ${id + 1}${cost === 1000000000 ? '+' : ''}`;
results += `\n| {{AP|${cost}}}`;
results += `\n| {{AP|${totalCost}}}`;
id++;
id++;
}
}
let output = ``;results.forEach((alias, i) => output += alias + (i === results.length - 1 ? '\n|}' : '\n|-\n'));console.log(output);
results += '\n|}';console.log(results);
self.nw?.Clipboard.get().set ? self.nw?.Clipboard?.get().set(output, 'text') : copy(output);
self.nw?.Clipboard.get().set ? self.nw?.Clipboard?.get().set(results, 'text') : copy(results);
</syntaxhighlight>
</syntaxhighlight>