2021-09-24 00:47:43 +02:00
|
|
|
import * as augmentationMethods from "./PlayerObjectAugmentationMethods";
|
|
|
|
import * as bladeburnerMethods from "./PlayerObjectBladeburnerMethods";
|
|
|
|
import * as corporationMethods from "./PlayerObjectCorporationMethods";
|
|
|
|
import * as gangMethods from "./PlayerObjectGangMethods";
|
|
|
|
import * as generalMethods from "./PlayerObjectGeneralMethods";
|
|
|
|
import * as serverMethods from "./PlayerObjectServerMethods";
|
|
|
|
|
|
|
|
import { IMap } from "../../types";
|
|
|
|
import { Sleeve } from "../Sleeve/Sleeve";
|
|
|
|
import { IPlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile";
|
|
|
|
import { Exploit } from "../../Exploits/Exploit";
|
|
|
|
import { WorkerScript } from "../../Netscript/WorkerScript";
|
|
|
|
import { CompanyPosition } from "../../Company/CompanyPosition";
|
|
|
|
import { Server } from "../../Server/Server";
|
2021-10-07 22:04:04 +02:00
|
|
|
import { BaseServer } from "../../Server/BaseServer";
|
2021-09-24 00:47:43 +02:00
|
|
|
import { HacknetServer } from "../../Hacknet/HacknetServer";
|
|
|
|
import { Faction } from "../../Faction/Faction";
|
|
|
|
import { Company } from "../../Company/Company";
|
|
|
|
import { Augmentation } from "../../Augmentation/Augmentation";
|
|
|
|
import { IRouter } from "../../ui/Router";
|
|
|
|
import { ICodingContractReward } from "../../CodingContracts";
|
|
|
|
|
|
|
|
import { IPlayer } from "../IPlayer";
|
|
|
|
import { LocationName } from "../../Locations/data/LocationNames";
|
|
|
|
import { IPlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation";
|
|
|
|
import { ICorporation } from "../../Corporation/ICorporation";
|
|
|
|
import { IGang } from "../../Gang/IGang";
|
|
|
|
import { IBladeburner } from "../../Bladeburner/IBladeburner";
|
|
|
|
import { HacknetNode } from "../../Hacknet/HacknetNode";
|
|
|
|
|
|
|
|
import { HashManager } from "../../Hacknet/HashManager";
|
|
|
|
import { CityName } from "../../Locations/data/CityNames";
|
|
|
|
|
|
|
|
import { MoneySourceTracker } from "../../utils/MoneySourceTracker";
|
2021-09-25 20:42:57 +02:00
|
|
|
import { Reviver, Generic_toJSON, Generic_fromJSON } from "../../utils/JSONReviver";
|
2021-12-17 15:35:54 +01:00
|
|
|
import { ISkillProgress } from "../formulas/skill";
|
2022-01-18 17:53:30 +01:00
|
|
|
import { PlayerAchievement } from "../../Achievements/Achievements";
|
|
|
|
import { cyrb53 } from "../../utils/StringHelperFunctions";
|
|
|
|
import { getRandomInt } from "../../utils/helpers/getRandomInt";
|
2022-04-14 17:40:59 +02:00
|
|
|
import { ITaskTracker } from "../ITaskTracker";
|
2022-04-14 21:23:49 +02:00
|
|
|
import { CONSTANTS } from "../../Constants";
|
2022-05-04 22:03:02 +02:00
|
|
|
import { WorkType, ClassType, CrimeType, PlayerFactionWorkType } from "../../utils/WorkType";
|
2021-09-24 00:47:43 +02:00
|
|
|
|
|
|
|
export class PlayerObject implements IPlayer {
|
|
|
|
// Class members
|
|
|
|
augmentations: IPlayerOwnedAugmentation[];
|
|
|
|
bitNodeN: number;
|
|
|
|
city: CityName;
|
|
|
|
companyName: string;
|
|
|
|
corporation: ICorporation | null;
|
|
|
|
gang: IGang | null;
|
|
|
|
bladeburner: IBladeburner | null;
|
|
|
|
currentServer: string;
|
|
|
|
factions: string[];
|
|
|
|
factionInvitations: string[];
|
|
|
|
hacknetNodes: (HacknetNode | string)[]; // HacknetNode object or IP of Hacknet Server
|
|
|
|
has4SData: boolean;
|
|
|
|
has4SDataTixApi: boolean;
|
|
|
|
hashManager: HashManager;
|
|
|
|
hasTixApiAccess: boolean;
|
|
|
|
hasWseAccount: boolean;
|
|
|
|
hp: number;
|
|
|
|
jobs: IMap<string>;
|
|
|
|
init: () => void;
|
|
|
|
isWorking: boolean;
|
|
|
|
karma: number;
|
|
|
|
numPeopleKilled: number;
|
|
|
|
location: LocationName;
|
|
|
|
max_hp: number;
|
2021-11-12 02:42:19 +01:00
|
|
|
money: number;
|
2021-09-24 00:47:43 +02:00
|
|
|
moneySourceA: MoneySourceTracker;
|
|
|
|
moneySourceB: MoneySourceTracker;
|
|
|
|
playtimeSinceLastAug: number;
|
|
|
|
playtimeSinceLastBitnode: number;
|
|
|
|
purchasedServers: any[];
|
|
|
|
queuedAugmentations: IPlayerOwnedAugmentation[];
|
|
|
|
scriptProdSinceLastAug: number;
|
|
|
|
sleeves: Sleeve[];
|
|
|
|
sleevesFromCovenant: number;
|
|
|
|
sourceFiles: IPlayerOwnedSourceFile[];
|
|
|
|
exploits: Exploit[];
|
2022-01-06 13:04:03 +01:00
|
|
|
achievements: PlayerAchievement[];
|
2022-01-15 12:26:58 +01:00
|
|
|
terminalCommandHistory: string[];
|
2022-01-18 17:53:30 +01:00
|
|
|
identifier: string;
|
2021-09-24 00:47:43 +02:00
|
|
|
lastUpdate: number;
|
2022-01-18 17:53:30 +01:00
|
|
|
lastSave: number;
|
2021-09-24 00:47:43 +02:00
|
|
|
totalPlaytime: number;
|
|
|
|
|
|
|
|
// Stats
|
2021-11-05 22:12:52 +01:00
|
|
|
hacking: number;
|
2021-09-24 00:47:43 +02:00
|
|
|
strength: number;
|
|
|
|
defense: number;
|
|
|
|
dexterity: number;
|
|
|
|
agility: number;
|
|
|
|
charisma: number;
|
|
|
|
intelligence: number;
|
|
|
|
|
|
|
|
// Experience
|
|
|
|
hacking_exp: number;
|
|
|
|
strength_exp: number;
|
|
|
|
defense_exp: number;
|
|
|
|
dexterity_exp: number;
|
|
|
|
agility_exp: number;
|
|
|
|
charisma_exp: number;
|
|
|
|
intelligence_exp: number;
|
|
|
|
|
|
|
|
// Multipliers
|
|
|
|
hacking_chance_mult: number;
|
|
|
|
hacking_speed_mult: number;
|
|
|
|
hacking_money_mult: number;
|
|
|
|
hacking_grow_mult: number;
|
|
|
|
hacking_mult: number;
|
|
|
|
hacking_exp_mult: number;
|
|
|
|
strength_mult: number;
|
|
|
|
strength_exp_mult: number;
|
|
|
|
defense_mult: number;
|
|
|
|
defense_exp_mult: number;
|
|
|
|
dexterity_mult: number;
|
|
|
|
dexterity_exp_mult: number;
|
|
|
|
agility_mult: number;
|
|
|
|
agility_exp_mult: number;
|
|
|
|
charisma_mult: number;
|
|
|
|
charisma_exp_mult: number;
|
|
|
|
hacknet_node_money_mult: number;
|
|
|
|
hacknet_node_purchase_cost_mult: number;
|
|
|
|
hacknet_node_ram_cost_mult: number;
|
|
|
|
hacknet_node_core_cost_mult: number;
|
|
|
|
hacknet_node_level_cost_mult: number;
|
|
|
|
company_rep_mult: number;
|
|
|
|
faction_rep_mult: number;
|
|
|
|
work_money_mult: number;
|
|
|
|
crime_success_mult: number;
|
|
|
|
crime_money_mult: number;
|
|
|
|
bladeburner_max_stamina_mult: number;
|
|
|
|
bladeburner_stamina_gain_mult: number;
|
|
|
|
bladeburner_analysis_mult: number;
|
|
|
|
bladeburner_success_chance_mult: number;
|
|
|
|
|
|
|
|
createProgramReqLvl: number;
|
2022-05-04 22:03:02 +02:00
|
|
|
factionWorkType: PlayerFactionWorkType;
|
2021-09-24 00:47:43 +02:00
|
|
|
createProgramName: string;
|
|
|
|
timeWorkedCreateProgram: number;
|
2022-03-29 20:09:17 +02:00
|
|
|
graftAugmentationName: string;
|
|
|
|
timeWorkedGraftAugmentation: number;
|
2022-05-04 22:03:02 +02:00
|
|
|
crimeType: CrimeType;
|
2021-09-24 00:47:43 +02:00
|
|
|
committingCrimeThruSingFn: boolean;
|
|
|
|
singFnCrimeWorkerScript: WorkerScript | null;
|
|
|
|
timeNeededToCompleteWork: number;
|
|
|
|
focus: boolean;
|
2022-05-04 22:03:02 +02:00
|
|
|
className: ClassType;
|
2021-09-24 00:47:43 +02:00
|
|
|
currentWorkFactionName: string;
|
2022-05-04 22:03:02 +02:00
|
|
|
workType: WorkType;
|
2021-11-12 05:40:48 +01:00
|
|
|
workCostMult: number;
|
|
|
|
workExpMult: number;
|
2021-09-24 00:47:43 +02:00
|
|
|
currentWorkFactionDescription: string;
|
|
|
|
timeWorked: number;
|
|
|
|
workMoneyGained: number;
|
|
|
|
workMoneyGainRate: number;
|
|
|
|
workRepGained: number;
|
|
|
|
workRepGainRate: number;
|
|
|
|
workHackExpGained: number;
|
|
|
|
workHackExpGainRate: number;
|
|
|
|
workStrExpGained: number;
|
|
|
|
workStrExpGainRate: number;
|
|
|
|
workDefExpGained: number;
|
|
|
|
workDefExpGainRate: number;
|
|
|
|
workDexExpGained: number;
|
|
|
|
workDexExpGainRate: number;
|
|
|
|
workAgiExpGained: number;
|
|
|
|
workAgiExpGainRate: number;
|
|
|
|
workChaExpGained: number;
|
|
|
|
workChaExpGainRate: number;
|
|
|
|
workMoneyLossRate: number;
|
|
|
|
|
2022-03-29 20:09:17 +02:00
|
|
|
entropy: number;
|
2022-03-19 19:15:31 +01:00
|
|
|
|
2021-09-24 00:47:43 +02:00
|
|
|
// Methods
|
|
|
|
work: (numCycles: number) => boolean;
|
|
|
|
workPartTime: (numCycles: number) => boolean;
|
|
|
|
workForFaction: (numCycles: number) => boolean;
|
|
|
|
applyForAgentJob: (sing?: boolean) => boolean;
|
|
|
|
applyForBusinessConsultantJob: (sing?: boolean) => boolean;
|
|
|
|
applyForBusinessJob: (sing?: boolean) => boolean;
|
|
|
|
applyForEmployeeJob: (sing?: boolean) => boolean;
|
|
|
|
applyForItJob: (sing?: boolean) => boolean;
|
|
|
|
applyForJob: (entryPosType: CompanyPosition, sing?: boolean) => boolean;
|
|
|
|
applyForNetworkEngineerJob: (sing?: boolean) => boolean;
|
|
|
|
applyForPartTimeEmployeeJob: (sing?: boolean) => boolean;
|
|
|
|
applyForPartTimeWaiterJob: (sing?: boolean) => boolean;
|
|
|
|
applyForSecurityEngineerJob: (sing?: boolean) => boolean;
|
|
|
|
applyForSecurityJob: (sing?: boolean) => boolean;
|
|
|
|
applyForSoftwareConsultantJob: (sing?: boolean) => boolean;
|
|
|
|
applyForSoftwareJob: (sing?: boolean) => boolean;
|
|
|
|
applyForWaiterJob: (sing?: boolean) => boolean;
|
|
|
|
canAccessBladeburner: () => boolean;
|
|
|
|
canAccessCorporation: () => boolean;
|
|
|
|
canAccessGang: () => boolean;
|
2022-03-19 05:22:21 +01:00
|
|
|
canAccessGrafting: () => boolean;
|
2021-09-24 00:47:43 +02:00
|
|
|
canAfford: (cost: number) => boolean;
|
|
|
|
gainHackingExp: (exp: number) => void;
|
|
|
|
gainStrengthExp: (exp: number) => void;
|
|
|
|
gainDefenseExp: (exp: number) => void;
|
|
|
|
gainDexterityExp: (exp: number) => void;
|
|
|
|
gainAgilityExp: (exp: number) => void;
|
|
|
|
gainCharismaExp: (exp: number) => void;
|
|
|
|
gainIntelligenceExp: (exp: number) => void;
|
2022-04-14 17:40:59 +02:00
|
|
|
gainStats: (retValue: ITaskTracker) => void;
|
2021-10-27 20:18:33 +02:00
|
|
|
gainMoney: (money: number, source: string) => void;
|
2021-10-07 22:04:04 +02:00
|
|
|
getCurrentServer: () => BaseServer;
|
2021-09-24 00:47:43 +02:00
|
|
|
getGangFaction: () => Faction;
|
|
|
|
getGangName: () => string;
|
|
|
|
getHomeComputer: () => Server;
|
|
|
|
getNextCompanyPosition: (company: Company, entryPosType: CompanyPosition) => CompanyPosition | null;
|
|
|
|
getUpgradeHomeRamCost: () => number;
|
2021-10-13 21:48:34 +02:00
|
|
|
getUpgradeHomeCoresCost: () => number;
|
2021-09-24 00:47:43 +02:00
|
|
|
gotoLocation: (to: LocationName) => boolean;
|
2021-10-27 03:22:40 +02:00
|
|
|
hasAugmentation: (aug: string | Augmentation, installed?: boolean) => boolean;
|
2021-09-24 00:47:43 +02:00
|
|
|
hasCorporation: () => boolean;
|
|
|
|
hasGangWith: (facName: string) => boolean;
|
|
|
|
hasTorRouter: () => boolean;
|
|
|
|
hasProgram: (program: string) => boolean;
|
|
|
|
inBladeburner: () => boolean;
|
|
|
|
inGang: () => boolean;
|
2022-04-20 23:03:25 +02:00
|
|
|
isAwareOfGang: () => boolean;
|
2021-09-24 00:47:43 +02:00
|
|
|
isQualified: (company: Company, position: CompanyPosition) => boolean;
|
2021-10-27 20:18:33 +02:00
|
|
|
loseMoney: (money: number, source: string) => void;
|
2021-09-24 22:02:38 +02:00
|
|
|
reapplyAllAugmentations: (resetMultipliers?: boolean) => void;
|
2021-09-24 00:47:43 +02:00
|
|
|
reapplyAllSourceFiles: () => void;
|
|
|
|
regenerateHp: (amt: number) => void;
|
|
|
|
recordMoneySource: (amt: number, source: string) => void;
|
|
|
|
setMoney: (amt: number) => void;
|
2021-09-25 03:49:49 +02:00
|
|
|
singularityStopWork: () => string;
|
2021-09-24 00:47:43 +02:00
|
|
|
startBladeburner: (p: any) => void;
|
2021-12-10 04:17:22 +01:00
|
|
|
startFactionWork: (faction: Faction) => void;
|
2022-05-04 21:18:12 +02:00
|
|
|
startClass: (costMult: number, expMult: number, className: ClassType) => void;
|
2021-09-24 00:47:43 +02:00
|
|
|
startCorporation: (corpName: string, additionalShares?: number) => void;
|
|
|
|
startCrime: (
|
|
|
|
router: IRouter,
|
2022-05-04 21:48:49 +02:00
|
|
|
crimeType: CrimeType,
|
2021-09-24 00:47:43 +02:00
|
|
|
hackExp: number,
|
|
|
|
strExp: number,
|
|
|
|
defExp: number,
|
|
|
|
dexExp: number,
|
|
|
|
agiExp: number,
|
|
|
|
chaExp: number,
|
|
|
|
money: number,
|
|
|
|
time: number,
|
|
|
|
singParams: any,
|
|
|
|
) => void;
|
2021-12-10 04:17:22 +01:00
|
|
|
startFactionFieldWork: (faction: Faction) => void;
|
|
|
|
startFactionHackWork: (faction: Faction) => void;
|
|
|
|
startFactionSecurityWork: (faction: Faction) => void;
|
2021-09-24 00:47:43 +02:00
|
|
|
startFocusing: () => void;
|
|
|
|
startGang: (facName: string, isHacking: boolean) => void;
|
2021-12-10 04:17:22 +01:00
|
|
|
startWork: (companyName: string) => void;
|
|
|
|
startWorkPartTime: (companyName: string) => void;
|
2021-09-24 00:47:43 +02:00
|
|
|
takeDamage: (amt: number) => boolean;
|
|
|
|
travel: (to: CityName) => boolean;
|
|
|
|
giveExploit: (exploit: Exploit) => void;
|
2022-01-06 13:04:03 +01:00
|
|
|
giveAchievement: (achievementId: string) => void;
|
2021-09-24 00:47:43 +02:00
|
|
|
queryStatFromString: (str: string) => number;
|
|
|
|
getIntelligenceBonus: (weight: number) => number;
|
|
|
|
getCasinoWinnings: () => number;
|
2022-04-28 13:05:56 +02:00
|
|
|
quitJob: (company: string, sing?: boolean) => void;
|
2021-12-19 16:20:02 +01:00
|
|
|
hasJob: () => boolean;
|
2021-10-12 05:14:15 +02:00
|
|
|
process: (router: IRouter, numCycles?: number) => void;
|
2021-09-24 23:07:53 +02:00
|
|
|
createHacknetServer: () => HacknetServer;
|
2022-01-18 15:49:06 +01:00
|
|
|
startCreateProgramWork: (programName: string, time: number, reqLevel: number) => void;
|
2021-09-24 00:47:43 +02:00
|
|
|
queueAugmentation: (augmentationName: string) => void;
|
|
|
|
receiveInvite: (factionName: string) => void;
|
|
|
|
updateSkillLevels: () => void;
|
|
|
|
gainCodingContractReward: (reward: ICodingContractReward, difficulty?: number) => string;
|
|
|
|
stopFocusing: () => void;
|
|
|
|
finishFactionWork: (cancelled: boolean, sing?: boolean) => string;
|
|
|
|
finishClass: (sing?: boolean) => string;
|
|
|
|
finishWork: (cancelled: boolean, sing?: boolean) => string;
|
|
|
|
cancelationPenalty: () => number;
|
|
|
|
finishWorkPartTime: (sing?: boolean) => string;
|
|
|
|
finishCrime: (cancelled: boolean) => string;
|
|
|
|
finishCreateProgramWork: (cancelled: boolean) => string;
|
|
|
|
resetMultipliers: () => void;
|
|
|
|
prestigeAugmentation: () => void;
|
|
|
|
prestigeSourceFile: () => void;
|
|
|
|
calculateSkill: (exp: number, mult?: number) => number;
|
2021-12-17 15:35:54 +01:00
|
|
|
calculateSkillProgress: (exp: number, mult?: number) => ISkillProgress;
|
2022-05-04 20:42:48 +02:00
|
|
|
resetWorkStatus: (generalType?: WorkType, group?: string, workType?: string) => void;
|
2021-09-24 00:47:43 +02:00
|
|
|
getWorkHackExpGain: () => number;
|
|
|
|
getWorkStrExpGain: () => number;
|
|
|
|
getWorkDefExpGain: () => number;
|
|
|
|
getWorkDexExpGain: () => number;
|
|
|
|
getWorkAgiExpGain: () => number;
|
|
|
|
getWorkChaExpGain: () => number;
|
|
|
|
getWorkRepGain: () => number;
|
|
|
|
getWorkMoneyGain: () => number;
|
|
|
|
processWorkEarnings: (cycles: number) => void;
|
|
|
|
hospitalize: () => void;
|
|
|
|
createProgramWork: (numCycles: number) => boolean;
|
|
|
|
takeClass: (numCycles: number) => boolean;
|
|
|
|
commitCrime: (numCycles: number) => boolean;
|
2021-09-25 00:29:25 +02:00
|
|
|
checkForFactionInvitations: () => Faction[];
|
2021-09-24 00:47:43 +02:00
|
|
|
setBitNodeNumber: (n: number) => void;
|
2021-09-24 22:02:38 +02:00
|
|
|
getMult: (name: string) => number;
|
|
|
|
setMult: (name: string, mult: number) => void;
|
2021-09-25 23:21:50 +02:00
|
|
|
canAccessCotMG: () => boolean;
|
2021-10-08 09:16:51 +02:00
|
|
|
sourceFileLvl: (n: number) => number;
|
2022-03-29 20:09:17 +02:00
|
|
|
startGraftAugmentationWork: (augmentationName: string, time: number) => void;
|
|
|
|
graftAugmentationWork: (numCycles: number) => boolean;
|
2022-04-27 03:11:41 +02:00
|
|
|
finishGraftAugmentationWork: (cancelled: boolean, singularity?: boolean) => string;
|
2022-03-19 19:15:31 +01:00
|
|
|
applyEntropy: (stacks?: number) => void;
|
2021-09-24 00:47:43 +02:00
|
|
|
|
|
|
|
constructor() {
|
|
|
|
//Skills and stats
|
2021-11-05 22:12:52 +01:00
|
|
|
this.hacking = 1;
|
2021-09-24 00:47:43 +02:00
|
|
|
|
|
|
|
//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;
|
|
|
|
|
|
|
|
//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;
|
|
|
|
|
|
|
|
//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_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;
|
|
|
|
|
|
|
|
//Money
|
2022-04-14 21:17:46 +02:00
|
|
|
this.money = 1000 + CONSTANTS.Donations;
|
2021-09-24 00:47:43 +02:00
|
|
|
|
|
|
|
//Location information
|
|
|
|
this.city = CityName.Sector12;
|
|
|
|
this.location = LocationName.TravelAgency;
|
|
|
|
|
|
|
|
// 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 ma;
|
|
|
|
|
|
|
|
// Servers
|
2022-03-17 14:50:23 +01:00
|
|
|
this.currentServer = ""; //hostname of Server currently being accessed through termina;
|
|
|
|
this.purchasedServers = []; //hostnames of purchased server;
|
2021-09-24 00:47:43 +02:00
|
|
|
|
|
|
|
// Hacknet Nodes/Servers
|
2022-03-17 14:50:23 +01:00
|
|
|
this.hacknetNodes = []; // Note= For Hacknet Servers, this array holds the hostnames of the server;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.hashManager = new HashManager();
|
|
|
|
|
|
|
|
//Factions
|
|
|
|
this.factions = []; //Names of all factions player has joine;
|
|
|
|
this.factionInvitations = []; //Outstanding faction invitation;
|
|
|
|
|
|
|
|
//Augmentations
|
|
|
|
this.queuedAugmentations = [];
|
|
|
|
this.augmentations = [];
|
|
|
|
|
|
|
|
this.sourceFiles = [];
|
|
|
|
|
|
|
|
//Crime statistics
|
|
|
|
this.numPeopleKilled = 0;
|
|
|
|
this.karma = 0;
|
|
|
|
|
|
|
|
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;
|
2022-05-04 22:03:02 +02:00
|
|
|
this.workType = WorkType.None;
|
2021-11-12 05:40:48 +01:00
|
|
|
this.workCostMult = 1;
|
|
|
|
this.workExpMult = 1;
|
2021-09-24 00:47:43 +02:00
|
|
|
|
|
|
|
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.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;
|
|
|
|
|
2022-03-29 20:09:17 +02:00
|
|
|
this.graftAugmentationName = "";
|
|
|
|
this.timeWorkedGraftAugmentation = 0;
|
2022-03-19 15:31:48 +01:00
|
|
|
|
2022-05-04 22:03:02 +02:00
|
|
|
this.className = ClassType.None;
|
2021-09-24 00:47:43 +02:00
|
|
|
|
2022-05-04 22:03:02 +02:00
|
|
|
this.crimeType = CrimeType.None;
|
2021-09-24 00:47:43 +02:00
|
|
|
|
2021-09-25 08:36:49 +02:00
|
|
|
this.timeWorked = 0; //in m;
|
|
|
|
this.timeWorkedCreateProgram = 0;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.timeNeededToCompleteWork = 0;
|
|
|
|
|
|
|
|
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;
|
|
|
|
|
|
|
|
//Stock Market
|
|
|
|
this.hasWseAccount = false;
|
|
|
|
this.hasTixApiAccess = false;
|
|
|
|
this.has4SData = false;
|
|
|
|
this.has4SDataTixApi = false;
|
|
|
|
|
|
|
|
//Gang
|
|
|
|
this.gang = null;
|
|
|
|
|
|
|
|
//Corporation
|
|
|
|
this.corporation = null;
|
|
|
|
|
|
|
|
//Bladeburner
|
|
|
|
this.bladeburner = null;
|
|
|
|
this.bladeburner_max_stamina_mult = 1;
|
|
|
|
this.bladeburner_stamina_gain_mult = 1;
|
2022-05-03 13:22:05 +02:00
|
|
|
this.bladeburner_analysis_mult = 1; //Field Analysis Only
|
2021-09-25 08:36:49 +02:00
|
|
|
this.bladeburner_success_chance_mult = 1;
|
2021-09-24 00:47:43 +02:00
|
|
|
|
|
|
|
// Sleeves & Re-sleeving
|
|
|
|
this.sleeves = [];
|
2022-05-03 13:22:05 +02:00
|
|
|
this.sleevesFromCovenant = 0; // # of Duplicate sleeves purchased from the covenant
|
2021-09-25 08:36:49 +02:00
|
|
|
//bitnode
|
|
|
|
this.bitNodeN = 1;
|
2021-09-24 00:47:43 +02:00
|
|
|
|
2022-03-29 20:09:17 +02:00
|
|
|
this.entropy = 0;
|
2022-03-19 19:15:31 +01:00
|
|
|
|
2021-09-24 00:47:43 +02:00
|
|
|
//Used to store the last update time.
|
|
|
|
this.lastUpdate = 0;
|
2022-01-18 17:53:30 +01:00
|
|
|
this.lastSave = 0;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.totalPlaytime = 0;
|
2022-01-18 17:53:30 +01:00
|
|
|
|
2021-09-24 00:47:43 +02:00
|
|
|
this.playtimeSinceLastAug = 0;
|
|
|
|
this.playtimeSinceLastBitnode = 0;
|
|
|
|
|
|
|
|
// Keep track of where money comes from
|
2022-05-03 13:22:05 +02:00
|
|
|
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
|
2021-09-25 08:36:49 +02:00
|
|
|
// Production since last Augmentation installation
|
|
|
|
this.scriptProdSinceLastAug = 0;
|
2021-09-24 00:47:43 +02:00
|
|
|
|
|
|
|
this.exploits = [];
|
2022-01-06 13:04:03 +01:00
|
|
|
this.achievements = [];
|
2022-01-15 12:26:58 +01:00
|
|
|
this.terminalCommandHistory = [];
|
2021-09-24 00:47:43 +02:00
|
|
|
|
2022-01-18 17:53:30 +01:00
|
|
|
// Let's get a hash of some semi-random stuff so we have something unique.
|
|
|
|
this.identifier = cyrb53(
|
|
|
|
"I-" +
|
2022-03-29 20:09:17 +02:00
|
|
|
new Date().getTime() +
|
|
|
|
navigator.userAgent +
|
|
|
|
window.innerWidth +
|
|
|
|
window.innerHeight +
|
|
|
|
getRandomInt(100, 999),
|
2022-01-18 17:53:30 +01:00
|
|
|
);
|
|
|
|
|
2021-09-24 00:47:43 +02:00
|
|
|
this.init = generalMethods.init;
|
|
|
|
this.prestigeAugmentation = generalMethods.prestigeAugmentation;
|
|
|
|
this.prestigeSourceFile = generalMethods.prestigeSourceFile;
|
|
|
|
this.receiveInvite = generalMethods.receiveInvite;
|
|
|
|
this.calculateSkill = generalMethods.calculateSkill;
|
2021-12-17 15:35:54 +01:00
|
|
|
this.calculateSkillProgress = generalMethods.calculateSkillProgress;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.updateSkillLevels = generalMethods.updateSkillLevels;
|
|
|
|
this.resetMultipliers = generalMethods.resetMultipliers;
|
|
|
|
this.hasProgram = generalMethods.hasProgram;
|
|
|
|
this.setMoney = generalMethods.setMoney;
|
|
|
|
this.gainMoney = generalMethods.gainMoney;
|
|
|
|
this.loseMoney = generalMethods.loseMoney;
|
|
|
|
this.canAfford = generalMethods.canAfford;
|
|
|
|
this.recordMoneySource = generalMethods.recordMoneySource;
|
|
|
|
this.gainHackingExp = generalMethods.gainHackingExp;
|
|
|
|
this.gainStrengthExp = generalMethods.gainStrengthExp;
|
|
|
|
this.gainDefenseExp = generalMethods.gainDefenseExp;
|
|
|
|
this.gainDexterityExp = generalMethods.gainDexterityExp;
|
|
|
|
this.gainAgilityExp = generalMethods.gainAgilityExp;
|
|
|
|
this.gainCharismaExp = generalMethods.gainCharismaExp;
|
|
|
|
this.gainIntelligenceExp = generalMethods.gainIntelligenceExp;
|
2022-04-14 17:40:59 +02:00
|
|
|
this.gainStats = generalMethods.gainStats;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.queryStatFromString = generalMethods.queryStatFromString;
|
|
|
|
this.resetWorkStatus = generalMethods.resetWorkStatus;
|
|
|
|
this.processWorkEarnings = generalMethods.processWorkEarnings;
|
|
|
|
this.startWork = generalMethods.startWork;
|
|
|
|
this.cancelationPenalty = generalMethods.cancelationPenalty;
|
|
|
|
this.work = generalMethods.work;
|
|
|
|
this.finishWork = generalMethods.finishWork;
|
|
|
|
this.startWorkPartTime = generalMethods.startWorkPartTime;
|
|
|
|
this.workPartTime = generalMethods.workPartTime;
|
|
|
|
this.finishWorkPartTime = generalMethods.finishWorkPartTime;
|
|
|
|
this.startFocusing = generalMethods.startFocusing;
|
|
|
|
this.stopFocusing = generalMethods.stopFocusing;
|
|
|
|
this.startFactionWork = generalMethods.startFactionWork;
|
|
|
|
this.startFactionHackWork = generalMethods.startFactionHackWork;
|
|
|
|
this.startFactionFieldWork = generalMethods.startFactionFieldWork;
|
|
|
|
this.startFactionSecurityWork = generalMethods.startFactionSecurityWork;
|
|
|
|
this.workForFaction = generalMethods.workForFaction;
|
|
|
|
this.finishFactionWork = generalMethods.finishFactionWork;
|
|
|
|
this.getWorkMoneyGain = generalMethods.getWorkMoneyGain;
|
|
|
|
this.getWorkHackExpGain = generalMethods.getWorkHackExpGain;
|
|
|
|
this.getWorkStrExpGain = generalMethods.getWorkStrExpGain;
|
|
|
|
this.getWorkDefExpGain = generalMethods.getWorkDefExpGain;
|
|
|
|
this.getWorkDexExpGain = generalMethods.getWorkDexExpGain;
|
|
|
|
this.getWorkAgiExpGain = generalMethods.getWorkAgiExpGain;
|
|
|
|
this.getWorkChaExpGain = generalMethods.getWorkChaExpGain;
|
|
|
|
this.getWorkRepGain = generalMethods.getWorkRepGain;
|
2021-10-12 05:14:15 +02:00
|
|
|
this.process = generalMethods.process;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.startCreateProgramWork = generalMethods.startCreateProgramWork;
|
|
|
|
this.createProgramWork = generalMethods.createProgramWork;
|
|
|
|
this.finishCreateProgramWork = generalMethods.finishCreateProgramWork;
|
2022-03-29 20:09:17 +02:00
|
|
|
this.startGraftAugmentationWork = generalMethods.startGraftAugmentationWork;
|
|
|
|
this.graftAugmentationWork = generalMethods.craftAugmentationWork;
|
|
|
|
this.finishGraftAugmentationWork = generalMethods.finishGraftAugmentationWork;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.startClass = generalMethods.startClass;
|
|
|
|
this.takeClass = generalMethods.takeClass;
|
|
|
|
this.finishClass = generalMethods.finishClass;
|
|
|
|
this.startCrime = generalMethods.startCrime;
|
|
|
|
this.commitCrime = generalMethods.commitCrime;
|
|
|
|
this.finishCrime = generalMethods.finishCrime;
|
|
|
|
this.singularityStopWork = generalMethods.singularityStopWork;
|
|
|
|
this.takeDamage = generalMethods.takeDamage;
|
|
|
|
this.regenerateHp = generalMethods.regenerateHp;
|
|
|
|
this.hospitalize = generalMethods.hospitalize;
|
|
|
|
this.applyForJob = generalMethods.applyForJob;
|
|
|
|
this.getNextCompanyPosition = generalMethods.getNextCompanyPosition;
|
|
|
|
this.quitJob = generalMethods.quitJob;
|
2021-12-19 16:20:02 +01:00
|
|
|
this.hasJob = generalMethods.hasJob;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.applyForSoftwareJob = generalMethods.applyForSoftwareJob;
|
|
|
|
this.applyForSoftwareConsultantJob = generalMethods.applyForSoftwareConsultantJob;
|
|
|
|
this.applyForItJob = generalMethods.applyForItJob;
|
|
|
|
this.applyForSecurityEngineerJob = generalMethods.applyForSecurityEngineerJob;
|
|
|
|
this.applyForNetworkEngineerJob = generalMethods.applyForNetworkEngineerJob;
|
|
|
|
this.applyForBusinessJob = generalMethods.applyForBusinessJob;
|
|
|
|
this.applyForBusinessConsultantJob = generalMethods.applyForBusinessConsultantJob;
|
|
|
|
this.applyForSecurityJob = generalMethods.applyForSecurityJob;
|
|
|
|
this.applyForAgentJob = generalMethods.applyForAgentJob;
|
|
|
|
this.applyForEmployeeJob = generalMethods.applyForEmployeeJob;
|
|
|
|
this.applyForPartTimeEmployeeJob = generalMethods.applyForPartTimeEmployeeJob;
|
|
|
|
this.applyForWaiterJob = generalMethods.applyForWaiterJob;
|
|
|
|
this.applyForPartTimeWaiterJob = generalMethods.applyForPartTimeWaiterJob;
|
|
|
|
this.isQualified = generalMethods.isQualified;
|
|
|
|
this.reapplyAllAugmentations = generalMethods.reapplyAllAugmentations;
|
|
|
|
this.reapplyAllSourceFiles = generalMethods.reapplyAllSourceFiles;
|
|
|
|
this.checkForFactionInvitations = generalMethods.checkForFactionInvitations;
|
|
|
|
this.setBitNodeNumber = generalMethods.setBitNodeNumber;
|
|
|
|
this.queueAugmentation = generalMethods.queueAugmentation;
|
|
|
|
this.gainCodingContractReward = generalMethods.gainCodingContractReward;
|
|
|
|
this.travel = generalMethods.travel;
|
|
|
|
this.gotoLocation = generalMethods.gotoLocation;
|
2022-03-19 05:22:21 +01:00
|
|
|
this.canAccessGrafting = generalMethods.canAccessGrafting;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.giveExploit = generalMethods.giveExploit;
|
2022-01-06 13:04:03 +01:00
|
|
|
this.giveAchievement = generalMethods.giveAchievement;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.getIntelligenceBonus = generalMethods.getIntelligenceBonus;
|
|
|
|
this.getCasinoWinnings = generalMethods.getCasinoWinnings;
|
|
|
|
this.hasAugmentation = augmentationMethods.hasAugmentation;
|
|
|
|
this.canAccessBladeburner = bladeburnerMethods.canAccessBladeburner;
|
|
|
|
this.inBladeburner = bladeburnerMethods.inBladeburner;
|
|
|
|
this.startBladeburner = bladeburnerMethods.startBladeburner;
|
|
|
|
this.canAccessCorporation = corporationMethods.canAccessCorporation;
|
|
|
|
this.hasCorporation = corporationMethods.hasCorporation;
|
|
|
|
this.startCorporation = corporationMethods.startCorporation;
|
|
|
|
this.canAccessGang = gangMethods.canAccessGang;
|
2022-04-20 23:03:25 +02:00
|
|
|
this.isAwareOfGang = gangMethods.isAwareOfGang;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.getGangFaction = gangMethods.getGangFaction;
|
|
|
|
this.getGangName = gangMethods.getGangName;
|
|
|
|
this.hasGangWith = gangMethods.hasGangWith;
|
|
|
|
this.inGang = gangMethods.inGang;
|
|
|
|
this.startGang = gangMethods.startGang;
|
|
|
|
|
|
|
|
this.hasTorRouter = serverMethods.hasTorRouter;
|
|
|
|
this.getCurrentServer = serverMethods.getCurrentServer;
|
|
|
|
this.getHomeComputer = serverMethods.getHomeComputer;
|
|
|
|
this.getUpgradeHomeRamCost = serverMethods.getUpgradeHomeRamCost;
|
2021-10-13 21:48:34 +02:00
|
|
|
this.getUpgradeHomeCoresCost = serverMethods.getUpgradeHomeCoresCost;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.createHacknetServer = serverMethods.createHacknetServer;
|
2022-05-04 22:03:02 +02:00
|
|
|
this.factionWorkType = PlayerFactionWorkType.None;
|
2021-09-24 00:47:43 +02:00
|
|
|
this.committingCrimeThruSingFn = false;
|
|
|
|
this.singFnCrimeWorkerScript = null;
|
2021-09-24 22:02:38 +02:00
|
|
|
|
|
|
|
this.getMult = generalMethods.getMult;
|
|
|
|
this.setMult = generalMethods.setMult;
|
2021-09-25 23:21:50 +02:00
|
|
|
|
|
|
|
this.canAccessCotMG = generalMethods.canAccessCotMG;
|
2021-10-08 09:16:51 +02:00
|
|
|
this.sourceFileLvl = generalMethods.sourceFileLvl;
|
2022-03-19 19:15:31 +01:00
|
|
|
|
|
|
|
this.applyEntropy = augmentationMethods.applyEntropy;
|
2021-09-24 00:47:43 +02:00
|
|
|
}
|
|
|
|
|
2022-04-14 21:28:13 +02:00
|
|
|
whoAmI(): string {
|
|
|
|
return "Player";
|
|
|
|
}
|
|
|
|
|
2022-04-14 21:49:21 +02:00
|
|
|
/**
|
2021-09-24 00:47:43 +02:00
|
|
|
* Serialize the current object to a JSON save state.
|
|
|
|
*/
|
|
|
|
toJSON(): any {
|
|
|
|
return Generic_toJSON("PlayerObject", this);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initiatizes a PlayerObject object from a JSON save state.
|
|
|
|
*/
|
|
|
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
|
|
static fromJSON(value: any): PlayerObject {
|
|
|
|
return Generic_fromJSON(PlayerObject, value.data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Reviver.constructors.PlayerObject = PlayerObject;
|