Skip to content

Commit

Permalink
Tweak to hardcoded bitnode multipliers
Browse files Browse the repository at this point in the history
- Align the starts
- Extract the [bn-1]th element via map expression
- Allow overriding the BN number
  • Loading branch information
alainbryden committed Nov 10, 2024
1 parent b8bf20c commit fb81d04
Showing 1 changed file with 60 additions and 57 deletions.
117 changes: 60 additions & 57 deletions helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -606,65 +606,68 @@ export async function tryGetBitNodeMultipliers_Custom(ns, fnGetNsDataThroughFile
* We still prefer to use the API though, this is just a a fallback, but it may become stale over time.
* @param {NS} ns The nestcript instance passed to your script's main entry point
* @param {(ns: NS, command: string, fName?: string, args?: any, verbose?: any, maxRetries?: number, retryDelayMs?: number) => Promise<any>} fnGetNsDataThroughFile getActiveSourceFiles Helper that allows the user to pass in their chosen implementation of getNsDataThroughFile to minimize RAM usage
* @param {number} bnOverride The bitnode for which to retrieve multipliers. Defaults to the current BN if null.
* @returns {Promise<BitNodeMultipliers>} a mocked BitNodeMultipliers instance with hard-coded values. */
async function getHardCodedBitNodeMultipliers(ns, fnGetNsDataThroughFile) {
let bn = 1;
try { bn = (await fnGetNsDataThroughFile(ns, 'ns.getResetInfo()', '/Temp/reset-info.txt')).currentNode; }
catch { /* We are expected to be fault-tolerant in low-ram conditions */ }
return {
AgilityLevelMultiplier: [1, 1, 1, 1, 1, 1, 1, 1, 0.45, 0.4, 1, 1, 0.7, 0.5][bn - 1],
AugmentationMoneyCost: [1, 1, 3, 1, 2, 1, 3, 1, 1, 5, 2, 1, 1, 1.5][bn - 1],
AugmentationRepCost: [1, 1, 3, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1][bn - 1],
BladeburnerRank: [1, 1, 1, 1, 1, 1, 0.6, 0, 0.9, 0.8, 1, 1, 0.45, 0.6][bn - 1],
BladeburnerSkillCost: [1, 1, 1, 1, 1, 1, 2, 1, 1.2, 1, 1, 1, 2, 2][bn - 1],
CharismaLevelMultiplier: [1, 1, 1, 1, 1, 1, 1, 1, 0.45, 0.4, 1, 1, 1, 1][bn - 1],
ClassGymExpGain: [1, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 1][bn - 1],
CodingContractMoney: [1, 1, 1, 1, 1, 1, 1, 0, 1, 0.5, 0.25, 1, 0.4, 1][bn - 1],
CompanyWorkExpGain: [1, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 1][bn - 1],
CompanyWorkMoney: [1, 1, 0.25, 0.1, 1, 0.5, 0.5, 0, 1, 0.5, 0.5, 1, 0.4, 1][bn - 1],
CompanyWorkRepGain: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.2][bn - 1],
CorporationDivisions: [1, 0.9, 1, 1, 0.75, 0.8, 0.8, 0, 0.8, 0.9, 0.9, 0.5, 0.4, 0.8][bn - 1],
CorporationSoftcap: [1, 0.9, 1, 1, 1, 0.9, 0.9, 0, 0.75, 0.9, 0.9, 0.8, 0.4, 0.9][bn - 1],
CorporationValuation: [1, 1, 1, 1, 0.75, 0.2, 0.2, 0, 0.5, 0.5, 0.1, 1, 0.001, 0.4][bn - 1],
CrimeExpGain: [1, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 1][bn - 1],
CrimeMoney: [1, 3, 0.25, 0.2, 0.5, 0.75, 0.75, 0, 0.5, 0.5, 3, 1, 0.4, 0.75][bn - 1],
CrimeSuccessRate: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.4][bn - 1],
DaedalusAugsRequirement: [30, 30, 30, 30, 30, 35, 35, 30, 30, 30, 30, 31, 30, 30][bn - 1],
DefenseLevelMultiplier: [1, 1, 1, 1, 1, 1, 1, 1, 0.45, 0.4, 1, 1, 0.7, 1][bn - 1],
DexterityLevelMultiplier: [1, 1, 1, 1, 1, 1, 1, 1, 0.45, 0.4, 1, 1, 0.7, 0.5][bn - 1],
FactionPassiveRepGain: [1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1][bn - 1],
FactionWorkExpGain: [1, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 1][bn - 1],
FactionWorkRepGain: [1, 0.5, 1, 0.75, 1, 1, 1, 1, 1, 1, 1, 1, 0.6, 0.2][bn - 1],
FourSigmaMarketDataApiCost: [1, 1, 1, 1, 1, 1, 2, 1, 4, 1, 4, 1, 10, 1][bn - 1],
FourSigmaMarketDataCost: [1, 1, 1, 1, 1, 1, 2, 1, 5, 1, 4, 1, 10, 1][bn - 1],
GangSoftcap: [1, 1, 0.9, 1, 1, 0.7, 0.7, 0, 0.8, 0.9, 1, 0.8, 0.3, 0.7][bn - 1],
GangUniqueAugs: [1, 1, 0.5, 0.5, 0.5, 0.2, 0.2, 0, 0.25, 0.25, 0.75, 1, 0.1, 0.4][bn - 1],
GoPower: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4][bn - 1],
HackExpGain: [1, 1, 1, 0.4, 0.5, 0.25, 0.25, 1, 0.05, 1, 0.5, 1, 0.1, 1][bn - 1],
HackingLevelMultiplier: [1, 0.8, 0.8, 1, 1, 0.35, 0.35, 1, 0.5, 0.35, 0.6, 1, 0.25, 0.4][bn - 1],
HackingSpeedMultiplier: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.3][bn - 1],
HacknetNodeMoney: [1, 1, 0.25, 0.05, 0.2, 0.2, 0.2, 0, 1, 0.5, 0.1, 1, 0.4, 0.25][bn - 1],
HomeComputerRamCost: [1, 1, 1.5, 1, 1, 1, 1, 1, 5, 1.5, 1, 1, 1, 1][bn - 1],
InfiltrationMoney: [1, 3, 1, 1, 1.5, 0.75, 0.75, 0, 1, 0.5, 2.5, 1, 1, 0.75][bn - 1],
InfiltrationRep: [1, 1, 1, 1, 1.5, 1, 1, 1, 1, 1, 2.5, 1, 1, 1][bn - 1],
ManualHackMoney: [1, 1, 1, 1, 1, 1, 1, 0, 1, 0.5, 1, 1, 1, 1][bn - 1],
PurchasedServerCost: [1, 1, 2, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1][bn - 1],
PurchasedServerSoftcap: [1, 1.3, 1.3, 1.2, 1.2, 2, 2, 4, 1, 1.1, 2, 1, 1.6, 1][bn - 1],
PurchasedServerLimit: [1, 1, 1, 1, 1, 1, 1, 1, 0, 0.6, 1, 1, 1, 1][bn - 1],
PurchasedServerMaxRam: [1, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 1, 1, 1, 1][bn - 1],
RepToDonateToFaction: [1, 1, 0.5, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1][bn - 1],
ScriptHackMoney: [1, 1, 0.2, 0.2, 0.15, 0.75, 0.5, 0.3, 0.1, 0.5, 1, 1, 0.2, 0.3][bn - 1],
ScriptHackMoneyGain: [1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1][bn - 1],
ServerGrowthRate: [1, 0.8, 0.2, 1, 1, 1, 1, 1, 1, 1, 0.2, 1, 1, 1][bn - 1],
ServerMaxMoney: [1, 0.08, 0.04, 0.1125, 1, 0.2, 0.2, 1, 0.01, 1, 0.01, 1, 0.3375, 0.7][bn - 1],
ServerStartingMoney: [1, 0.4, 0.2, 0.75, 0.5, 0.5, 0.5, 1, 0.1, 1, 0.1, 1, 0.75, 0.5][bn - 1],
ServerStartingSecurity: [1, 1, 1, 1, 2, 1.5, 1.5, 1, 2.5, 1, 1, 1.5, 3, 1.5][bn - 1],
ServerWeakenRate: [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1][bn - 1],
StrengthLevelMultiplier: [1, 1, 1, 1, 1, 1, 1, 1, 0.45, 0.4, 1, 1, 0.7, 0.5][bn - 1],
StaneksGiftPowerMultiplier: [1, 2, 0.75, 1.5, 1.3, 0.5, 0.9, 1, 0.5, 0.75, 1, 1, 2, 0.5][bn - 1],
StaneksGiftExtraSize: [0, -6, -2, 0, 0, 2, -1, -99, 2, -3, 0, 1, 1, -1][bn - 1],
WorldDaemonDifficulty: [1, 5, 2, 3, 1.5, 2, 2, 1, 2, 2, 1.5, 1, 3, 5][bn - 1]
export async function getHardCodedBitNodeMultipliers(ns, fnGetNsDataThroughFile, bnOverride = null) {
let bn = bnOverride ?? 1;
if (!bnOverride) {
try { bn = (await fnGetNsDataThroughFile(ns, 'ns.getResetInfo()', '/Temp/reset-info.txt')).currentNode; }
catch { /* We are expected to be fault-tolerant in low-ram conditions */ }
}
return Object.fromEntries(Object.entries({
AgilityLevelMultiplier: /* */[1, 1, 1, 1, 1, 1, 1, 1, 0.45, 0.4, 1, 1, 0.7, 0.5],
AugmentationMoneyCost: /* */[1, 1, 3, 1, 2, 1, 3, 1, 1, 5, 2, 1, 1, 1.5],
AugmentationRepCost: /* */[1, 1, 3, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1, 1],
BladeburnerRank: /* */[1, 1, 1, 1, 1, 1, 0.6, 0, 0.9, 0.8, 1, 1, 0.45, 0.6],
BladeburnerSkillCost: /* */[1, 1, 1, 1, 1, 1, 2, 1, 1.2, 1, 1, 1, 2, 2],
CharismaLevelMultiplier: /* */[1, 1, 1, 1, 1, 1, 1, 1, 0.45, 0.4, 1, 1, 1, 1],
ClassGymExpGain: /* */[1, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 1],
CodingContractMoney: /* */[1, 1, 1, 1, 1, 1, 1, 0, 1, 0.5, 0.25, 1, 0.4, 1],
CompanyWorkExpGain: /* */[1, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 1],
CompanyWorkMoney: /* */[1, 1, 0.25, 0.1, 1, 0.5, 0.5, 0, 1, 0.5, 0.5, 1, 0.4, 1],
CompanyWorkRepGain: /* */[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.2],
CorporationDivisions: /* */[1, 0.9, 1, 1, 0.75, 0.8, 0.8, 0, 0.8, 0.9, 0.9, 0.5, 0.4, 0.8],
CorporationSoftcap: /* */[1, 0.9, 1, 1, 1, 0.9, 0.9, 0, 0.75, 0.9, 0.9, 0.8, 0.4, 0.9],
CorporationValuation: /* */[1, 1, 1, 1, 0.75, 0.2, 0.2, 0, 0.5, 0.5, 0.1, 1, 0.001, 0.4],
CrimeExpGain: /* */[1, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 1],
CrimeMoney: /* */[1, 3, 0.25, 0.2, 0.5, 0.75, 0.75, 0, 0.5, 0.5, 3, 1, 0.4, 0.75],
CrimeSuccessRate: /* */[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.4],
DaedalusAugsRequirement: /* */[30, 30, 30, 30, 30, 35, 35, 30, 30, 30, 30, 31, 30, 30],
DefenseLevelMultiplier: /* */[1, 1, 1, 1, 1, 1, 1, 1, 0.45, 0.4, 1, 1, 0.7, 1],
DexterityLevelMultiplier: /* */[1, 1, 1, 1, 1, 1, 1, 1, 0.45, 0.4, 1, 1, 0.7, 0.5],
FactionPassiveRepGain: /* */[1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1],
FactionWorkExpGain: /* */[1, 1, 1, 0.5, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 1],
FactionWorkRepGain: /* */[1, 0.5, 1, 0.75, 1, 1, 1, 1, 1, 1, 1, 1, 0.6, 0.2],
FourSigmaMarketDataApiCost: /* */[1, 1, 1, 1, 1, 1, 2, 1, 4, 1, 4, 1, 10, 1],
FourSigmaMarketDataCost: /* */[1, 1, 1, 1, 1, 1, 2, 1, 5, 1, 4, 1, 10, 1],
GangSoftcap: /* */[1, 1, 0.9, 1, 1, 0.7, 0.7, 0, 0.8, 0.9, 1, 0.8, 0.3, 0.7],
GangUniqueAugs: /* */[1, 1, 0.5, 0.5, 0.5, 0.2, 0.2, 0, 0.25, 0.25, 0.75, 1, 0.1, 0.4],
GoPower: /* */[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4],
HackExpGain: /* */[1, 1, 1, 0.4, 0.5, 0.25, 0.25, 1, 0.05, 1, 0.5, 1, 0.1, 1],
HackingLevelMultiplier: /* */[1, 0.8, 0.8, 1, 1, 0.35, 0.35, 1, 0.5, 0.35, 0.6, 1, 0.25, 0.4],
HackingSpeedMultiplier: /* */[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.3],
HacknetNodeMoney: /* */[1, 1, 0.25, 0.05, 0.2, 0.2, 0.2, 0, 1, 0.5, 0.1, 1, 0.4, 0.25],
HomeComputerRamCost: /* */[1, 1, 1.5, 1, 1, 1, 1, 1, 5, 1.5, 1, 1, 1, 1],
InfiltrationMoney: /* */[1, 3, 1, 1, 1.5, 0.75, 0.75, 0, 1, 0.5, 2.5, 1, 1, 0.75],
InfiltrationRep: /* */[1, 1, 1, 1, 1.5, 1, 1, 1, 1, 1, 2.5, 1, 1, 1],
ManualHackMoney: /* */[1, 1, 1, 1, 1, 1, 1, 0, 1, 0.5, 1, 1, 1, 1],
PurchasedServerCost: /* */[1, 1, 2, 1, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1],
PurchasedServerSoftcap: /* */[1, 1.3, 1.3, 1.2, 1.2, 2, 2, 4, 1, 1.1, 2, 1, 1.6, 1],
PurchasedServerLimit: /* */[1, 1, 1, 1, 1, 1, 1, 1, 0, 0.6, 1, 1, 1, 1],
PurchasedServerMaxRam: /* */[1, 1, 1, 1, 1, 1, 1, 1, 1, 0.5, 1, 1, 1, 1],
RepToDonateToFaction: /* */[1, 1, 0.5, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
ScriptHackMoney: /* */[1, 1, 0.2, 0.2, 0.15, 0.75, 0.5, 0.3, 0.1, 0.5, 1, 1, 0.2, 0.3],
ScriptHackMoneyGain: /* */[1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1],
ServerGrowthRate: /* */[1, 0.8, 0.2, 1, 1, 1, 1, 1, 1, 1, 0.2, 1, 1, 1],
ServerMaxMoney: /* */[1, 0.08, 0.04, 0.1125, 1, 0.2, 0.2, 1, 0.01, 1, 0.01, 1, 0.3375, 0.7],
ServerStartingMoney: /* */[1, 0.4, 0.2, 0.75, 0.5, 0.5, 0.5, 1, 0.1, 1, 0.1, 1, 0.75, 0.5],
ServerStartingSecurity: /* */[1, 1, 1, 1, 2, 1.5, 1.5, 1, 2.5, 1, 1, 1.5, 3, 1.5],
ServerWeakenRate: /* */[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1, 1, 1],
StrengthLevelMultiplier: /* */[1, 1, 1, 1, 1, 1, 1, 1, 0.45, 0.4, 1, 1, 0.7, 0.5],
StaneksGiftPowerMultiplier: /* */[1, 2, 0.75, 1.5, 1.3, 0.5, 0.9, 1, 0.5, 0.75, 1, 1, 2, 0.5],
StaneksGiftExtraSize: /* */[0, -6, -2, 0, 0, 2, -1, -99, 2, -3, 0, 1, 1, -1],
WorldDaemonDifficulty: /* */[1, 5, 2, 3, 1.5, 2, 2, 1, 2, 2, 1.5, 1, 3, 5]
}).map(([mult, values]) => [mult, values[bn - 1]]));
}

/** Returns the number of instances of the current script running on the specified host.
Expand Down

0 comments on commit fb81d04

Please sign in to comment.