mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-22 17:23:00 +02:00
prettify, sorry for the big ass commit
This commit is contained in:
@@ -10,219 +10,219 @@ import { CityName } from "../../Locations/data/CityNames";
|
||||
|
||||
import { MoneySourceTracker } from "../../utils/MoneySourceTracker";
|
||||
import {
|
||||
Reviver,
|
||||
Generic_toJSON,
|
||||
Generic_fromJSON,
|
||||
Reviver,
|
||||
Generic_toJSON,
|
||||
Generic_fromJSON,
|
||||
} from "../../../utils/JSONReviver";
|
||||
|
||||
import Decimal from "decimal.js";
|
||||
|
||||
export function PlayerObject() {
|
||||
//Skills and stats
|
||||
this.hacking_skill = 1;
|
||||
//Skills and stats
|
||||
this.hacking_skill = 1;
|
||||
|
||||
//Combat stats
|
||||
this.hp = 10;
|
||||
this.max_hp = 10;
|
||||
this.strength = 1;
|
||||
this.defense = 1;
|
||||
this.dexterity = 1;
|
||||
this.agility = 1;
|
||||
//Combat stats
|
||||
this.hp = 10;
|
||||
this.max_hp = 10;
|
||||
this.strength = 1;
|
||||
this.defense = 1;
|
||||
this.dexterity = 1;
|
||||
this.agility = 1;
|
||||
|
||||
//Labor stats
|
||||
this.charisma = 1;
|
||||
//Labor stats
|
||||
this.charisma = 1;
|
||||
|
||||
//Special stats
|
||||
this.intelligence = 0;
|
||||
//Special stats
|
||||
this.intelligence = 0;
|
||||
|
||||
//Hacking multipliers
|
||||
this.hacking_chance_mult = 1;
|
||||
this.hacking_speed_mult = 1;
|
||||
this.hacking_money_mult = 1;
|
||||
this.hacking_grow_mult = 1;
|
||||
//Hacking multipliers
|
||||
this.hacking_chance_mult = 1;
|
||||
this.hacking_speed_mult = 1;
|
||||
this.hacking_money_mult = 1;
|
||||
this.hacking_grow_mult = 1;
|
||||
|
||||
//Experience and multipliers
|
||||
this.hacking_exp = 0;
|
||||
this.strength_exp = 0;
|
||||
this.defense_exp = 0;
|
||||
this.dexterity_exp = 0;
|
||||
this.agility_exp = 0;
|
||||
this.charisma_exp = 0;
|
||||
this.intelligence_exp= 0;
|
||||
//Experience and multipliers
|
||||
this.hacking_exp = 0;
|
||||
this.strength_exp = 0;
|
||||
this.defense_exp = 0;
|
||||
this.dexterity_exp = 0;
|
||||
this.agility_exp = 0;
|
||||
this.charisma_exp = 0;
|
||||
this.intelligence_exp = 0;
|
||||
|
||||
this.hacking_mult = 1;
|
||||
this.strength_mult = 1;
|
||||
this.defense_mult = 1;
|
||||
this.dexterity_mult = 1;
|
||||
this.agility_mult = 1;
|
||||
this.charisma_mult = 1;
|
||||
this.hacking_mult = 1;
|
||||
this.strength_mult = 1;
|
||||
this.defense_mult = 1;
|
||||
this.dexterity_mult = 1;
|
||||
this.agility_mult = 1;
|
||||
this.charisma_mult = 1;
|
||||
|
||||
this.hacking_exp_mult = 1;
|
||||
this.strength_exp_mult = 1;
|
||||
this.defense_exp_mult = 1;
|
||||
this.dexterity_exp_mult = 1;
|
||||
this.agility_exp_mult = 1;
|
||||
this.charisma_exp_mult = 1;
|
||||
this.hacking_exp_mult = 1;
|
||||
this.strength_exp_mult = 1;
|
||||
this.defense_exp_mult = 1;
|
||||
this.dexterity_exp_mult = 1;
|
||||
this.agility_exp_mult = 1;
|
||||
this.charisma_exp_mult = 1;
|
||||
|
||||
this.company_rep_mult = 1;
|
||||
this.faction_rep_mult = 1;
|
||||
this.company_rep_mult = 1;
|
||||
this.faction_rep_mult = 1;
|
||||
|
||||
//Money
|
||||
this.money = new Decimal(1000);
|
||||
//Money
|
||||
this.money = new Decimal(1000);
|
||||
|
||||
//IP Address of Starting (home) computer
|
||||
this.homeComputer = "";
|
||||
//IP Address of Starting (home) computer
|
||||
this.homeComputer = "";
|
||||
|
||||
//Location information
|
||||
this.city = CityName.Sector12;
|
||||
this.location = "";
|
||||
//Location information
|
||||
this.city = CityName.Sector12;
|
||||
this.location = "";
|
||||
|
||||
// Jobs that the player holds
|
||||
// Map of company name (key) -> name of company position (value. Just the name, not the CompanyPosition object)
|
||||
// The CompanyPosition name must match a key value in CompanyPositions
|
||||
this.jobs = {};
|
||||
// Jobs that the player holds
|
||||
// Map of company name (key) -> name of company position (value. Just the name, not the CompanyPosition object)
|
||||
// The CompanyPosition name must match a key value in CompanyPositions
|
||||
this.jobs = {};
|
||||
|
||||
// Company at which player is CURRENTLY working (only valid when the player is actively working)
|
||||
this.companyName = ""; // Name of Company. Must match a key value in Companies map
|
||||
// Company at which player is CURRENTLY working (only valid when the player is actively working)
|
||||
this.companyName = ""; // Name of Company. Must match a key value in Companies map
|
||||
|
||||
// Servers
|
||||
this.currentServer = ""; //IP address of Server currently being accessed through terminal
|
||||
this.purchasedServers = []; //IP Addresses of purchased servers
|
||||
// Servers
|
||||
this.currentServer = ""; //IP address of Server currently being accessed through terminal
|
||||
this.purchasedServers = []; //IP Addresses of purchased servers
|
||||
|
||||
// Hacknet Nodes/Servers
|
||||
this.hacknetNodes = []; // Note: For Hacknet Servers, this array holds the IP addresses of the servers
|
||||
this.hashManager = new HashManager();
|
||||
// Hacknet Nodes/Servers
|
||||
this.hacknetNodes = []; // Note: For Hacknet Servers, this array holds the IP addresses of the servers
|
||||
this.hashManager = new HashManager();
|
||||
|
||||
//Factions
|
||||
this.factions = []; //Names of all factions player has joined
|
||||
this.factionInvitations = []; //Outstanding faction invitations
|
||||
//Factions
|
||||
this.factions = []; //Names of all factions player has joined
|
||||
this.factionInvitations = []; //Outstanding faction invitations
|
||||
|
||||
//Augmentations
|
||||
this.queuedAugmentations = [];
|
||||
this.augmentations = [];
|
||||
//Augmentations
|
||||
this.queuedAugmentations = [];
|
||||
this.augmentations = [];
|
||||
|
||||
this.sourceFiles = [];
|
||||
this.sourceFiles = [];
|
||||
|
||||
//Crime statistics
|
||||
this.numPeopleKilled = 0;
|
||||
this.karma = 0;
|
||||
//Crime statistics
|
||||
this.numPeopleKilled = 0;
|
||||
this.karma = 0;
|
||||
|
||||
this.crime_money_mult = 1;
|
||||
this.crime_success_mult = 1;
|
||||
this.crime_money_mult = 1;
|
||||
this.crime_success_mult = 1;
|
||||
|
||||
//Flags/variables for working (Company, Faction, Creating Program, Taking Class)
|
||||
this.isWorking = false;
|
||||
this.focus = false;
|
||||
this.workType = "";
|
||||
//Flags/variables for working (Company, Faction, Creating Program, Taking Class)
|
||||
this.isWorking = false;
|
||||
this.focus = false;
|
||||
this.workType = "";
|
||||
|
||||
this.currentWorkFactionName = "";
|
||||
this.currentWorkFactionDescription = "";
|
||||
this.currentWorkFactionName = "";
|
||||
this.currentWorkFactionDescription = "";
|
||||
|
||||
this.workHackExpGainRate = 0;
|
||||
this.workStrExpGainRate = 0;
|
||||
this.workDefExpGainRate = 0;
|
||||
this.workDexExpGainRate = 0;
|
||||
this.workAgiExpGainRate = 0;
|
||||
this.workChaExpGainRate = 0;
|
||||
this.workRepGainRate = 0;
|
||||
this.workMoneyGainRate = 0;
|
||||
this.workMoneyLossRate = 0;
|
||||
this.workHackExpGainRate = 0;
|
||||
this.workStrExpGainRate = 0;
|
||||
this.workDefExpGainRate = 0;
|
||||
this.workDexExpGainRate = 0;
|
||||
this.workAgiExpGainRate = 0;
|
||||
this.workChaExpGainRate = 0;
|
||||
this.workRepGainRate = 0;
|
||||
this.workMoneyGainRate = 0;
|
||||
this.workMoneyLossRate = 0;
|
||||
|
||||
this.workHackExpGained = 0;
|
||||
this.workStrExpGained = 0;
|
||||
this.workDefExpGained = 0;
|
||||
this.workDexExpGained = 0;
|
||||
this.workAgiExpGained = 0;
|
||||
this.workChaExpGained = 0;
|
||||
this.workRepGained = 0;
|
||||
this.workMoneyGained = 0;
|
||||
this.workHackExpGained = 0;
|
||||
this.workStrExpGained = 0;
|
||||
this.workDefExpGained = 0;
|
||||
this.workDexExpGained = 0;
|
||||
this.workAgiExpGained = 0;
|
||||
this.workChaExpGained = 0;
|
||||
this.workRepGained = 0;
|
||||
this.workMoneyGained = 0;
|
||||
|
||||
this.createProgramName = "";
|
||||
this.createProgramReqLvl = 0;
|
||||
this.createProgramName = "";
|
||||
this.createProgramReqLvl = 0;
|
||||
|
||||
this.className = "";
|
||||
this.className = "";
|
||||
|
||||
this.crimeType = "";
|
||||
this.crimeType = "";
|
||||
|
||||
this.timeWorked = 0; //in ms
|
||||
this.timeWorkedCreateProgram = 0;
|
||||
this.timeNeededToCompleteWork = 0;
|
||||
this.timeWorked = 0; //in ms
|
||||
this.timeWorkedCreateProgram = 0;
|
||||
this.timeNeededToCompleteWork = 0;
|
||||
|
||||
this.work_money_mult = 1;
|
||||
this.work_money_mult = 1;
|
||||
|
||||
//Hacknet Node multipliers
|
||||
this.hacknet_node_money_mult = 1;
|
||||
this.hacknet_node_purchase_cost_mult = 1;
|
||||
this.hacknet_node_ram_cost_mult = 1;
|
||||
this.hacknet_node_core_cost_mult = 1;
|
||||
this.hacknet_node_level_cost_mult = 1;
|
||||
//Hacknet Node multipliers
|
||||
this.hacknet_node_money_mult = 1;
|
||||
this.hacknet_node_purchase_cost_mult = 1;
|
||||
this.hacknet_node_ram_cost_mult = 1;
|
||||
this.hacknet_node_core_cost_mult = 1;
|
||||
this.hacknet_node_level_cost_mult = 1;
|
||||
|
||||
//Stock Market
|
||||
this.hasWseAccount = false;
|
||||
this.hasTixApiAccess = false;
|
||||
this.has4SData = false;
|
||||
this.has4SDataTixApi = false;
|
||||
//Stock Market
|
||||
this.hasWseAccount = false;
|
||||
this.hasTixApiAccess = false;
|
||||
this.has4SData = false;
|
||||
this.has4SDataTixApi = false;
|
||||
|
||||
//Gang
|
||||
this.gang = 0;
|
||||
//Gang
|
||||
this.gang = 0;
|
||||
|
||||
//Corporation
|
||||
this.corporation = 0;
|
||||
//Corporation
|
||||
this.corporation = 0;
|
||||
|
||||
//Bladeburner
|
||||
this.bladeburner = 0;
|
||||
this.bladeburner_max_stamina_mult = 1;
|
||||
this.bladeburner_stamina_gain_mult = 1;
|
||||
this.bladeburner_analysis_mult = 1; //Field Analysis Only
|
||||
this.bladeburner_success_chance_mult = 1;
|
||||
//Bladeburner
|
||||
this.bladeburner = 0;
|
||||
this.bladeburner_max_stamina_mult = 1;
|
||||
this.bladeburner_stamina_gain_mult = 1;
|
||||
this.bladeburner_analysis_mult = 1; //Field Analysis Only
|
||||
this.bladeburner_success_chance_mult = 1;
|
||||
|
||||
// Sleeves & Re-sleeving
|
||||
this.sleeves = [];
|
||||
this.resleeves = [];
|
||||
this.sleevesFromCovenant = 0; // # of Duplicate sleeves purchased from the covenant
|
||||
// Sleeves & Re-sleeving
|
||||
this.sleeves = [];
|
||||
this.resleeves = [];
|
||||
this.sleevesFromCovenant = 0; // # of Duplicate sleeves purchased from the covenant
|
||||
|
||||
//bitnode
|
||||
this.bitNodeN = 1;
|
||||
//bitnode
|
||||
this.bitNodeN = 1;
|
||||
|
||||
//Flags for determining whether certain "thresholds" have been achieved
|
||||
this.firstFacInvRecvd = false;
|
||||
this.firstAugPurchased = false;
|
||||
this.firstTimeTraveled = false;
|
||||
this.firstProgramAvailable = false;
|
||||
//Flags for determining whether certain "thresholds" have been achieved
|
||||
this.firstFacInvRecvd = false;
|
||||
this.firstAugPurchased = false;
|
||||
this.firstTimeTraveled = false;
|
||||
this.firstProgramAvailable = false;
|
||||
|
||||
//Used to store the last update time.
|
||||
this.lastUpdate = 0;
|
||||
this.totalPlaytime = 0;
|
||||
this.playtimeSinceLastAug = 0;
|
||||
this.playtimeSinceLastBitnode = 0;
|
||||
//Used to store the last update time.
|
||||
this.lastUpdate = 0;
|
||||
this.totalPlaytime = 0;
|
||||
this.playtimeSinceLastAug = 0;
|
||||
this.playtimeSinceLastBitnode = 0;
|
||||
|
||||
// Keep track of where money comes from
|
||||
this.moneySourceA = new MoneySourceTracker(); // Where money comes from since last-installed Augmentation
|
||||
this.moneySourceB = new MoneySourceTracker(); // Where money comes from for this entire BitNode run
|
||||
// Keep track of where money comes from
|
||||
this.moneySourceA = new MoneySourceTracker(); // Where money comes from since last-installed Augmentation
|
||||
this.moneySourceB = new MoneySourceTracker(); // Where money comes from for this entire BitNode run
|
||||
|
||||
// Production since last Augmentation installation
|
||||
this.scriptProdSinceLastAug = 0;
|
||||
// Production since last Augmentation installation
|
||||
this.scriptProdSinceLastAug = 0;
|
||||
|
||||
this.exploits = [];
|
||||
this.exploits = [];
|
||||
}
|
||||
|
||||
// Apply player methods to the prototype using Object.assign()
|
||||
Object.assign(
|
||||
PlayerObject.prototype,
|
||||
generalMethods,
|
||||
serverMethods,
|
||||
bladeburnerMethods,
|
||||
corporationMethods,
|
||||
gangMethods,
|
||||
augmentationMethods,
|
||||
PlayerObject.prototype,
|
||||
generalMethods,
|
||||
serverMethods,
|
||||
bladeburnerMethods,
|
||||
corporationMethods,
|
||||
gangMethods,
|
||||
augmentationMethods,
|
||||
);
|
||||
|
||||
PlayerObject.prototype.toJSON = function() {
|
||||
return Generic_toJSON("PlayerObject", this);
|
||||
}
|
||||
PlayerObject.prototype.toJSON = function () {
|
||||
return Generic_toJSON("PlayerObject", this);
|
||||
};
|
||||
|
||||
PlayerObject.fromJSON = function(value) {
|
||||
return Generic_fromJSON(PlayerObject, value.data);
|
||||
}
|
||||
PlayerObject.fromJSON = function (value) {
|
||||
return Generic_fromJSON(PlayerObject, value.data);
|
||||
};
|
||||
|
||||
Reviver.constructors.PlayerObject = PlayerObject;
|
||||
|
||||
@@ -5,16 +5,23 @@ import { IPlayer } from "../IPlayer";
|
||||
|
||||
import { Augmentation } from "../../Augmentation/Augmentation";
|
||||
|
||||
export function hasAugmentation(this: IPlayer, aug: string | Augmentation): boolean {
|
||||
const augName: string = (aug instanceof Augmentation) ? aug.name : aug;
|
||||
export function hasAugmentation(
|
||||
this: IPlayer,
|
||||
aug: string | Augmentation,
|
||||
): boolean {
|
||||
const augName: string = aug instanceof Augmentation ? aug.name : aug;
|
||||
|
||||
for (const owned of this.augmentations) {
|
||||
if (owned.name === augName) { return true; }
|
||||
for (const owned of this.augmentations) {
|
||||
if (owned.name === augName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
for (const owned of this.queuedAugmentations) {
|
||||
if (owned.name === augName) { return true; }
|
||||
for (const owned of this.queuedAugmentations) {
|
||||
if (owned.name === augName) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -2,16 +2,25 @@ import { Bladeburner } from "../../Bladeburner/Bladeburner";
|
||||
import { SourceFileFlags } from "../../SourceFile/SourceFileFlags";
|
||||
|
||||
export function canAccessBladeburner() {
|
||||
if (this.bitNodeN === 8) { return false; }
|
||||
|
||||
return (this.bitNodeN === 6) || (this.bitNodeN === 7) || (SourceFileFlags[6] > 0) || (SourceFileFlags[7] > 0);
|
||||
if (this.bitNodeN === 8) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
this.bitNodeN === 6 ||
|
||||
this.bitNodeN === 7 ||
|
||||
SourceFileFlags[6] > 0 ||
|
||||
SourceFileFlags[7] > 0
|
||||
);
|
||||
}
|
||||
|
||||
export function inBladeburner() {
|
||||
if (this.bladeburner == null) { return false; }
|
||||
return (this.bladeburner instanceof Bladeburner);
|
||||
if (this.bladeburner == null) {
|
||||
return false;
|
||||
}
|
||||
return this.bladeburner instanceof Bladeburner;
|
||||
}
|
||||
|
||||
export function startBladeburner() {
|
||||
this.bladeburner = new Bladeburner(this);
|
||||
this.bladeburner = new Bladeburner(this);
|
||||
}
|
||||
|
||||
@@ -2,18 +2,20 @@ import { Corporation } from "../../Corporation/Corporation";
|
||||
import { SourceFileFlags } from "../../SourceFile/SourceFileFlags";
|
||||
|
||||
export function canAccessCorporation() {
|
||||
return this.bitNodeN === 3 || (SourceFileFlags[3] > 0);
|
||||
return this.bitNodeN === 3 || SourceFileFlags[3] > 0;
|
||||
}
|
||||
|
||||
export function hasCorporation() {
|
||||
if (this.corporation == null) { return false; }
|
||||
return (this.corporation instanceof Corporation);
|
||||
if (this.corporation == null) {
|
||||
return false;
|
||||
}
|
||||
return this.corporation instanceof Corporation;
|
||||
}
|
||||
|
||||
export function startCorporation(corpName, additionalShares=0) {
|
||||
this.corporation = new Corporation({
|
||||
name: corpName,
|
||||
});
|
||||
export function startCorporation(corpName, additionalShares = 0) {
|
||||
this.corporation = new Corporation({
|
||||
name: corpName,
|
||||
});
|
||||
|
||||
this.corporation.totalShares += additionalShares;
|
||||
this.corporation.totalShares += additionalShares;
|
||||
}
|
||||
|
||||
@@ -7,41 +7,49 @@ import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
const GangKarmaRequirement = -54000;
|
||||
|
||||
export function canAccessGang() {
|
||||
if (this.bitNodeN === 2) { return true; }
|
||||
if (SourceFileFlags[2] <= 0) { return false; }
|
||||
if (this.bitNodeN === 2) {
|
||||
return true;
|
||||
}
|
||||
if (SourceFileFlags[2] <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (this.karma <= BitNodeMultipliers.GangKarmaRequirement*GangKarmaRequirement);
|
||||
return (
|
||||
this.karma <= BitNodeMultipliers.GangKarmaRequirement * GangKarmaRequirement
|
||||
);
|
||||
}
|
||||
|
||||
export function getGangFaction() {
|
||||
const fac = Factions[this.gang.facName];
|
||||
if (fac == null) {
|
||||
throw new Error(`Gang has invalid faction name: ${this.gang.facName}`);
|
||||
}
|
||||
const fac = Factions[this.gang.facName];
|
||||
if (fac == null) {
|
||||
throw new Error(`Gang has invalid faction name: ${this.gang.facName}`);
|
||||
}
|
||||
|
||||
return fac;
|
||||
return fac;
|
||||
}
|
||||
|
||||
export function getGangName() {
|
||||
return this.inGang() ? this.gang.facName : "";
|
||||
return this.inGang() ? this.gang.facName : "";
|
||||
}
|
||||
|
||||
export function hasGangWith(facName) {
|
||||
return this.inGang() && this.gang.facName === facName;
|
||||
return this.inGang() && this.gang.facName === facName;
|
||||
}
|
||||
|
||||
export function inGang() {
|
||||
if (this.gang == null || this.gang == undefined) { return false; }
|
||||
if (this.gang == null || this.gang == undefined) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (this.gang instanceof Gang);
|
||||
return this.gang instanceof Gang;
|
||||
}
|
||||
|
||||
export function startGang(factionName, hacking) {
|
||||
this.gang = new Gang(factionName, hacking);
|
||||
this.gang = new Gang(factionName, hacking);
|
||||
|
||||
const fac = Factions[factionName];
|
||||
if (fac == null) {
|
||||
throw new Error(`Invalid faction name when creating gang: ${factionName}`);
|
||||
}
|
||||
fac.playerReputation = 0;
|
||||
const fac = Factions[factionName];
|
||||
if (fac == null) {
|
||||
throw new Error(`Invalid faction name when creating gang: ${factionName}`);
|
||||
}
|
||||
fac.playerReputation = 0;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -9,52 +9,56 @@ import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
||||
import { Server } from "../../Server/Server";
|
||||
import { HacknetServer } from "../../Hacknet/HacknetServer";
|
||||
import {
|
||||
AddToAllServers,
|
||||
AllServers,
|
||||
createUniqueRandomIp,
|
||||
AddToAllServers,
|
||||
AllServers,
|
||||
createUniqueRandomIp,
|
||||
} from "../../Server/AllServers";
|
||||
import { SpecialServerIps } from "../../Server/SpecialServerIps";
|
||||
|
||||
export function hasTorRouter(this: IPlayer): boolean {
|
||||
return SpecialServerIps.hasOwnProperty("Darkweb Server");
|
||||
return SpecialServerIps.hasOwnProperty("Darkweb Server");
|
||||
}
|
||||
|
||||
export function getCurrentServer(this: IPlayer): Server | HacknetServer | null {
|
||||
return AllServers[this.currentServer];
|
||||
return AllServers[this.currentServer];
|
||||
}
|
||||
|
||||
export function getHomeComputer(this: IPlayer): Server | HacknetServer | null {
|
||||
return AllServers[this.homeComputer];
|
||||
return AllServers[this.homeComputer];
|
||||
}
|
||||
|
||||
export function getUpgradeHomeRamCost(this: IPlayer): number {
|
||||
//Calculate how many times ram has been upgraded (doubled)
|
||||
const currentRam = this.getHomeComputer().maxRam;
|
||||
const numUpgrades = Math.log2(currentRam);
|
||||
//Calculate how many times ram has been upgraded (doubled)
|
||||
const currentRam = this.getHomeComputer().maxRam;
|
||||
const numUpgrades = Math.log2(currentRam);
|
||||
|
||||
//Calculate cost
|
||||
//Have cost increase by some percentage each time RAM has been upgraded
|
||||
const mult = Math.pow(1.58, numUpgrades);
|
||||
const cost = currentRam * CONSTANTS.BaseCostFor1GBOfRamHome * mult * BitNodeMultipliers.HomeComputerRamCost;
|
||||
return cost;
|
||||
//Calculate cost
|
||||
//Have cost increase by some percentage each time RAM has been upgraded
|
||||
const mult = Math.pow(1.58, numUpgrades);
|
||||
const cost =
|
||||
currentRam *
|
||||
CONSTANTS.BaseCostFor1GBOfRamHome *
|
||||
mult *
|
||||
BitNodeMultipliers.HomeComputerRamCost;
|
||||
return cost;
|
||||
}
|
||||
|
||||
export function createHacknetServer(this: IPlayer): HacknetServer {
|
||||
const numOwned = this.hacknetNodes.length;
|
||||
const name = `hacknet-node-${numOwned}`;
|
||||
const server = new HacknetServer({
|
||||
adminRights: true,
|
||||
hostname: name,
|
||||
ip: createUniqueRandomIp(),
|
||||
// player: this,
|
||||
});
|
||||
this.hacknetNodes.push(server.ip);
|
||||
const numOwned = this.hacknetNodes.length;
|
||||
const name = `hacknet-node-${numOwned}`;
|
||||
const server = new HacknetServer({
|
||||
adminRights: true,
|
||||
hostname: name,
|
||||
ip: createUniqueRandomIp(),
|
||||
// player: this,
|
||||
});
|
||||
this.hacknetNodes.push(server.ip);
|
||||
|
||||
// Configure the HacknetServer to actually act as a Server
|
||||
AddToAllServers(server);
|
||||
const homeComputer = this.getHomeComputer();
|
||||
homeComputer.serversOnNetwork.push(server.ip);
|
||||
server.serversOnNetwork.push(homeComputer.ip);
|
||||
// Configure the HacknetServer to actually act as a Server
|
||||
AddToAllServers(server);
|
||||
const homeComputer = this.getHomeComputer();
|
||||
homeComputer.serversOnNetwork.push(server.ip);
|
||||
server.serversOnNetwork.push(homeComputer.ip);
|
||||
|
||||
return server;
|
||||
return server;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user