rename the functions I created 2 minutes ago.

This commit is contained in:
Olivier Gagnon 2021-12-08 19:03:33 -05:00
parent 6eba92b36c
commit 5a15df9ce7
2 changed files with 107 additions and 9 deletions

@ -175,7 +175,7 @@ export function NetscriptFormulas(player: IPlayer, workerScript: WorkerScript, h
}
return upg.getCost(level);
},
hacknetServerCost: function (n: any, mult: any): any {
hacknetServerCost: function (n: any, mult: any = 1): any {
checkFormulasAccess("hacknetServers.hacknetServerCost");
return HScalculateServerCost(n, mult);
},

@ -3316,27 +3316,73 @@ interface SkillsFormulas {
}
/**
* Hacking formulas
* @public
*/
interface HackingFormulas {
hackChance(server: number, player: number): number;
hackExp(server: number, player: number): number;
hackPercent(server: number, player: number): number;
growPercent(server: number, threads: number, player: number, cores?: number): number;
hackTime(server: number, player: number): number;
growTime(server: number, player: number): number;
weakenTime(server: number, player: number): number;
/**
* Calculate hack chance.
* @param server - Server info from {@link NS.getServer | getServer}
* @param player - Player info from {@link NS.getPlayer | getPlayer}
* @returns The calculated hack chance.
*/
hackChance(server: Server, player: Player): number;
hackExp(server: Server, player: Player): number;
hackPercent(server: Server, player: Player): number;
growPercent(server: Server, threads: number, player: Player, cores?: number): number;
hackTime(server: Server, player: Player): number;
growTime(server: Server, player: Player): number;
weakenTime(server: Server, player: Player): number;
}
/**
* @public
*/
interface HacknetNodesFormulas {
/**
* Calculate money gain rate.
* @param level - level of the node.
* @param ram - ram of the node.
* @param cores - cores of the node.
* @param mult - player production mult (default to 1)
* @returns The calculated money gain rate.
*/
moneyGainRate(level: number, ram: number, cores: number, mult?: number): number;
/**
* Calculate cost of upgrading hacknet node level.
* @param startingLevel - starting level
* @param extraLevels - amount of level to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
levelUpgradeCost(startingLevel: number, extraLevels?: number, costMult?: number): number;
/**
* Calculate cost of upgrading hacknet node ram.
* @param startingRam - starting ram
* @param extraLevels - amount of level of ram to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
ramUpgradeCost(startingRam: number, extraLevels?: number, costMult?: number): number;
/**
* Calculate cost of upgrading hacknet node cores.
* @param startingCore - starting cores
* @param extraCores - amount of cores to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
coreUpgradeCost(startingCore: number, extraCores?: number, costMult?: number): number;
/**
* Calculate the cost of a hacknet node.
* @param n - number of the hacknet node
* @param mult - player cost reduction (defaults to 1)
* @returns The calculated cost.
*/
hacknetNodeCost(n: number, mult: number): number;
/**
* All constants used by the game.
* @returns An object with all hacknet node constants used by the game.
*/
constants(): number;
}
@ -3345,13 +3391,65 @@ interface HacknetNodesFormulas {
* @public
*/
interface HacknetServersFormulas {
/**
* Calculate hash gain rate.
* @param level - level of the server.
* @param ramUsed - ramUsed of the server.
* @param maxRam - maxRam of the server.
* @param cores - cores of the server.
* @param mult - player production mult (default to 1)
* @returns The calculated hash gain rate.
*/
hashGainRate(level: number, ramUsed: number, maxRam: number, cores: number, mult?: number): number;
/**
* Calculate cost of upgrading hacknet server level.
* @param startingLevel - starting level
* @param extraLevels - amount of level to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
levelUpgradeCost(startingLevel: number, extraLevels?: number, costMult?: number): number;
/**
* Calculate cost of upgrading hacknet server ram.
* @param startingRam - starting ram
* @param extraLevels - amount of level of ram to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
ramUpgradeCost(startingRam: number, extraLevels?: number, costMult?: number): number;
/**
* Calculate cost of upgrading hacknet server cores.
* @param startingCore - starting cores
* @param extraCores - amount of cores to purchase (defaults to 1)
* @param costMult - player cost reduction (default to 1)
* @returns The calculated cost.
*/
coreUpgradeCost(startingCore: number, extraCores?: number, costMult?: number): number;
/**
* Calculate cost of upgrading hacknet server cache.
* @param startingCache - starting cache level
* @param extraCache - amount of levels of cache to purchase (defaults to 1)
* @returns The calculated cost.
*/
cacheUpgradeCost(startingCache: number, extraCache?: number): number;
/**
* Calculate hash cost of an upgrade.
* @param upgName - name of the upgrade
* @param level - level of the upgrade
* @returns The calculated hash cost.
*/
hashUpgradeCost(upgName: number, level: number): number;
hacknetServerCost(n: number, mult: number): number;
/**
* Calculate the cost of a hacknet server.
* @param n - number of the hacknet server
* @param mult - player cost reduction (defaults to 1)
* @returns The calculated cost.
*/
hacknetServerCost(n: number, mult?: number): number;
/**
* All constants used by the game.
* @returns An object with all hacknet server constants used by the game.
*/
constants(): any;
}