Remove some redundant typing

This commit is contained in:
Snarling 2022-09-20 07:23:35 -04:00
parent db835862d7
commit 6e3a6be106
14 changed files with 26 additions and 244 deletions

@ -1,33 +1,5 @@
import { CityName } from "./../../Locations/data/CityNames";
export const BladeburnerConstants: {
CityNames: string[];
CyclesPerSecond: number;
StaminaGainPerSecond: number;
BaseStaminaLoss: number;
MaxStaminaToGainFactor: number;
DifficultyToTimeFactor: number;
DiffMultExponentialFactor: number;
DiffMultLinearFactor: number;
EffAgiLinearFactor: number;
EffDexLinearFactor: number;
EffAgiExponentialFactor: number;
EffDexExponentialFactor: number;
BaseRecruitmentTimeNeeded: number;
PopulationThreshold: number;
PopulationExponent: number;
ChaosThreshold: number;
BaseStatGain: number;
BaseIntGain: number;
ActionCountGrowthPeriod: number;
RankToFactionRepFactor: number;
RankNeededForFaction: number;
ContractSuccessesPerLevel: number;
OperationSuccessesPerLevel: number;
RanksPerSkillPoint: number;
ContractBaseMoneyGain: number;
HrcHpGain: number;
HrcStaminaGain: number;
} = {
export const BladeburnerConstants = {
CityNames: [
CityName.Aevum,
CityName.Chongqing,

@ -1,19 +1,4 @@
export const SkillNames: {
BladesIntuition: string;
Cloak: string;
Marksman: string;
WeaponProficiency: string;
ShortCircuit: string;
DigitalObserver: string;
Tracer: string;
Overclock: string;
Reaper: string;
EvasiveSystem: string;
Datamancer: string;
CybersEdge: string;
HandsOfMidas: string;
Hyperdrive: string;
} = {
export const SkillNames = {
BladesIntuition: "Blade's Intuition",
Cloak: "Cloak",
Marksman: "Marksman",

@ -1,39 +1,7 @@
import { CityName } from "./../../Locations/data/CityNames";
const CyclesPerMarketCycle = 50;
const AllCorporationStates = ["START", "PURCHASE", "PRODUCTION", "SALE", "EXPORT"];
export const CorporationConstants: {
INITIALSHARES: number;
SHARESPERPRICEUPDATE: number;
IssueNewSharesCooldown: number;
SellSharesCooldown: number;
CyclesPerMarketCycle: number;
CyclesPerIndustryStateCycle: number;
SecsPerMarketCycle: number;
Cities: string[];
WarehouseInitialCost: number;
WarehouseInitialSize: number;
WarehouseUpgradeBaseCost: number;
OfficeInitialCost: number;
OfficeInitialSize: number;
OfficeUpgradeBaseCost: number;
BribeThreshold: number;
BribeToRepRatio: number;
ProductProductionCostRatio: number;
DividendMaxRate: number;
EmployeeSalaryMultiplier: number;
CyclesPerEmployeeRaise: number;
EmployeeRaiseAmount: number;
BaseMaxProducts: number;
AllCorporationStates: string[];
AllMaterials: string[];
AllIndustryTypes: string[];
AllUnlocks: string[];
AllUpgrades: string[];
AllResearch: string[];
FundingRoundShares: number[];
FundingRoundMultiplier: number[];
ValuationLength: number;
} = {
export const CorporationConstants = {
INITIALSHARES: 1e9, //Total number of shares you have at your company
SHARESPERPRICEUPDATE: 1e6, //When selling large number of shares, price is dynamically updated for every batch of this amount
IssueNewSharesCooldown: 216e3, // 12 Hour in terms of game cycles

@ -2,10 +2,7 @@ import React, { useContext } from "react";
import { Corporation } from "../Corporation";
import { Industry } from "../Industry";
export const Context: {
Corporation: React.Context<Corporation>;
Division: React.Context<Industry>;
} = {
export const Context = {
Corporation: React.createContext<Corporation>({} as Corporation),
Division: React.createContext<Industry>({} as Industry),
};

@ -1,8 +1,4 @@
export const StanekConstants: {
RAMBonus: number;
BaseSize: number;
MaxSize: number;
} = {
export const StanekConstants = {
RAMBonus: 0.1,
BaseSize: 9,
MaxSize: 25,

@ -25,9 +25,8 @@ import { GangMember } from "./GangMember";
import { WorkerScript } from "../Netscript/WorkerScript";
import { Player } from "../Player";
import { PowerMultiplier } from "./data/power";
import { IGang } from "./IGang";
export class Gang implements IGang {
export class Gang {
facName: string;
members: GangMember[];
wanted: number;

@ -4,7 +4,7 @@ import { GangMemberUpgrade } from "./GangMemberUpgrade";
import { GangMemberUpgrades } from "./GangMemberUpgrades";
import { IAscensionResult } from "./IAscensionResult";
import { Player } from "../Player";
import { IGang } from "./IGang";
import { Gang } from "./Gang";
import { Generic_fromJSON, Generic_toJSON, IReviverValue, Reviver } from "../utils/JSONReviver";
import {
calculateRespectGain,
@ -111,7 +111,7 @@ export class GangMember {
return GangMemberTasks["Unassigned"];
}
calculateRespectGain(gang: IGang): number {
calculateRespectGain(gang: Gang): number {
const task = this.getTask();
const g = {
respect: gang.respect,
@ -121,7 +121,7 @@ export class GangMember {
return calculateRespectGain(g, this, task);
}
calculateWantedLevelGain(gang: IGang): number {
calculateWantedLevelGain(gang: Gang): number {
const task = this.getTask();
const g = {
respect: gang.respect,
@ -131,7 +131,7 @@ export class GangMember {
return calculateWantedLevelGain(g, this, task);
}
calculateMoneyGain(gang: IGang): number {
calculateMoneyGain(gang: Gang): number {
const task = this.getTask();
const g = {
respect: gang.respect,
@ -191,7 +191,7 @@ export class GangMember {
this.calculateAscensionMult(this.cha_asc_points);
}
recordEarnedRespect(numCycles = 1, gang: IGang): void {
recordEarnedRespect(numCycles = 1, gang: Gang): void {
this.earnedRespect += this.calculateRespectGain(gang) * numCycles;
}

@ -1,46 +0,0 @@
import { GangMemberUpgrade } from "./GangMemberUpgrade";
import { GangMember } from "./GangMember";
import { WorkerScript } from "../Netscript/WorkerScript";
import { IAscensionResult } from "./IAscensionResult";
import { IReviverValue } from "src/utils/JSONReviver";
export interface IGang {
facName: string;
members: GangMember[];
wanted: number;
respect: number;
isHackingGang: boolean;
respectGainRate: number;
wantedGainRate: number;
moneyGainRate: number;
storedCycles: number;
storedTerritoryAndPowerCycles: number;
territoryClashChance: number;
territoryWarfareEngaged: boolean;
notifyMemberDeath: boolean;
getPower(): number;
getTerritory(): number;
process(numCycles: number): void;
processGains(numCycles: number): void;
processTerritoryAndPowerGains(numCycles: number): void;
processExperienceGains(numCycles: number): void;
clash(won: boolean): void;
canRecruitMember(): boolean;
getRespectNeededToRecruitMember(): number;
recruitMember(name: string): boolean;
getWantedPenalty(): number;
calculatePower(): number;
killMember(member: GangMember): void;
ascendMember(member: GangMember, workerScript?: WorkerScript): IAscensionResult;
getDiscount(): number;
getAllTaskNames(): string[];
getUpgradeCost(upg: GangMemberUpgrade): number;
toJSON(): IReviverValue;
}

@ -1,13 +1,6 @@
import { FactionNames } from "../../Faction/data/FactionNames";
export const GangConstants: {
GangRespectToReputationRatio: number;
MaximumGangMembers: number;
CyclesPerTerritoryAndPowerUpdate: number;
AscensionMultiplierRatio: number;
Names: string[];
GangKarmaRequirement: number;
} = {
export const GangConstants = {
// Respect is divided by this to get rep gain
GangRespectToReputationRatio: 75,
MaximumGangMembers: 12,

@ -1,10 +1,8 @@
import React, { useContext } from "react";
import { IGang } from "../IGang";
import { Gang } from "../Gang";
export const Context: {
Gang: React.Context<IGang>;
} = {
Gang: React.createContext<IGang>({} as IGang),
export const Context = {
Gang: React.createContext<Gang>({} as Gang),
};
export const useGang = (): IGang => useContext(Context.Gang);
export const useGang = (): Gang => useContext(Context.Gang);

@ -1,23 +1,4 @@
export const HacknetNodeConstants: {
// Constants for Hacknet Node production
MoneyGainPerLevel: number;
// Constants for Hacknet Node purchase/upgrade costs
BaseCost: number;
LevelBaseCost: number;
RamBaseCost: number;
CoreBaseCost: number;
PurchaseNextMult: number;
UpgradeLevelMult: number;
UpgradeRamMult: number;
UpgradeCoreMult: number;
// Constants for max upgrade levels for Hacknet Nodes
MaxLevel: number;
MaxRam: number;
MaxCores: number;
} = {
export const HacknetNodeConstants = {
MoneyGainPerLevel: 1.5,
BaseCost: 1000,
@ -48,29 +29,7 @@ export const PurchaseMultipliers: {
MAX: "MAX",
};
export const HacknetServerConstants: {
// Constants for Hacknet Server stats/production
HashesPerLevel: number;
// Constants for Hacknet Server purchase/upgrade costs
BaseCost: number;
RamBaseCost: number;
CoreBaseCost: number;
CacheBaseCost: number;
PurchaseMult: number; // Multiplier for puchasing an additional Hacknet Server
UpgradeLevelMult: number; // Multiplier for cost when upgrading level
UpgradeRamMult: number; // Multiplier for cost when upgrading RAM
UpgradeCoreMult: number; // Multiplier for cost when buying another core
UpgradeCacheMult: number; // Multiplier for cost when upgrading cache
MaxServers: number; // Max number of Hacknet Servers you can own
// Constants for max upgrade levels for Hacknet Server
MaxLevel: number;
MaxRam: number;
MaxCores: number;
MaxCache: number;
} = {
export const HacknetServerConstants = {
HashesPerLevel: 0.001,
BaseCost: 50e3,

@ -39,43 +39,7 @@ enum iTutorialSteps {
End,
}
const ITutorial: {
currStep: iTutorialSteps;
isRunning: boolean;
stepIsDone: {
[iTutorialSteps.Start]: boolean;
[iTutorialSteps.NSSelection]: boolean;
[iTutorialSteps.GoToCharacterPage]: boolean;
[iTutorialSteps.CharacterPage]: boolean;
[iTutorialSteps.CharacterGoToTerminalPage]: boolean;
[iTutorialSteps.TerminalIntro]: boolean;
[iTutorialSteps.TerminalHelp]: boolean;
[iTutorialSteps.TerminalLs]: boolean;
[iTutorialSteps.TerminalScan]: boolean;
[iTutorialSteps.TerminalScanAnalyze1]: boolean;
[iTutorialSteps.TerminalScanAnalyze2]: boolean;
[iTutorialSteps.TerminalConnect]: boolean;
[iTutorialSteps.TerminalAnalyze]: boolean;
[iTutorialSteps.TerminalNuke]: boolean;
[iTutorialSteps.TerminalManualHack]: boolean;
[iTutorialSteps.TerminalHackingMechanics]: boolean;
[iTutorialSteps.TerminalGoHome]: boolean;
[iTutorialSteps.TerminalCreateScript]: boolean;
[iTutorialSteps.TerminalTypeScript]: boolean;
[iTutorialSteps.TerminalFree]: boolean;
[iTutorialSteps.TerminalRunScript]: boolean;
[iTutorialSteps.TerminalGoToActiveScriptsPage]: boolean;
[iTutorialSteps.ActiveScriptsPage]: boolean;
[iTutorialSteps.ActiveScriptsToTerminal]: boolean;
[iTutorialSteps.TerminalTailScript]: boolean;
[iTutorialSteps.GoToHacknetNodesPage]: boolean;
[iTutorialSteps.HacknetNodesIntroduction]: boolean;
[iTutorialSteps.HacknetNodesGoToWorldPage]: boolean;
[iTutorialSteps.WorldDescription]: boolean;
[iTutorialSteps.TutorialPageInfo]: boolean;
[iTutorialSteps.End]: boolean;
};
} = {
const ITutorial = {
currStep: iTutorialSteps.Start,
isRunning: false,
@ -141,7 +105,9 @@ function iTutorialPrevStep(): void {
function iTutorialEnd(): void {
ITutorial.isRunning = false;
ITutorial.currStep = iTutorialSteps.Start;
Player.getHomeComputer().messages.push(LiteratureNames.HackersStartingHandbook);
const messages = Player.getHomeComputer().messages;
const handbook = LiteratureNames.HackersStartingHandbook;
if (!messages.includes(handbook)) messages.push(handbook);
ITutorialEvents.emit();
}

@ -8,13 +8,13 @@ import * as workMethods from "./PlayerObjectWorkMethods";
import { IMap } from "../../types";
import { Sleeve } from "../Sleeve/Sleeve";
import { IPlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile";
import { PlayerOwnedSourceFile } from "../../SourceFile/PlayerOwnedSourceFile";
import { Exploit } from "../../Exploits/Exploit";
import { LocationName } from "../../Locations/data/LocationNames";
import { IPlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation";
import { Corporation } from "../../Corporation/Corporation";
import { IGang } from "../../Gang/IGang";
import { Gang } from "../../Gang/Gang";
import { Bladeburner } from "../../Bladeburner/Bladeburner";
import { HacknetNode } from "../../Hacknet/HacknetNode";
@ -33,7 +33,7 @@ export class PlayerObject extends Person {
// Player-specific properties
bitNodeN = 1; //current bitnode
corporation: Corporation | null = null;
gang: IGang | null = null;
gang: Gang | null = null;
bladeburner: Bladeburner | null = null;
currentServer = "";
factions: string[] = [];
@ -58,7 +58,7 @@ export class PlayerObject extends Person {
scriptProdSinceLastAug = 0;
sleeves: Sleeve[] = [];
sleevesFromCovenant = 0;
sourceFiles: IPlayerOwnedSourceFile[] = [];
sourceFiles: PlayerOwnedSourceFile[] = [];
exploits: Exploit[] = [];
achievements: PlayerAchievement[] = [];
terminalCommandHistory: string[] = [];

@ -10,8 +10,3 @@ export class PlayerOwnedSourceFile {
this.lvl = level;
}
}
export interface IPlayerOwnedSourceFile {
lvl: number;
n: number;
}