mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-20 06:33:49 +01:00
rename augmentation to static augmentation
This commit is contained in:
parent
07afda8fbb
commit
c3a3994658
@ -1,5 +1,5 @@
|
|||||||
import { Augmentation } from "./Augmentation";
|
import { Augmentation } from "./Augmentation";
|
||||||
import { Augmentations } from "./Augmentations";
|
import { StaticAugmentations } from "./StaticAugmentations";
|
||||||
import { PlayerOwnedAugmentation, IPlayerOwnedAugmentation } from "./PlayerOwnedAugmentation";
|
import { PlayerOwnedAugmentation, IPlayerOwnedAugmentation } from "./PlayerOwnedAugmentation";
|
||||||
import { AugmentationNames } from "./data/AugmentationNames";
|
import { AugmentationNames } from "./data/AugmentationNames";
|
||||||
|
|
||||||
@ -23,7 +23,7 @@ import {
|
|||||||
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
|
||||||
import { Router } from "../ui/GameRoot";
|
import { Router } from "../ui/GameRoot";
|
||||||
|
|
||||||
export function AddToAugmentations(aug: Augmentation): void {
|
export function AddToStaticAugmentations(aug: Augmentation): void {
|
||||||
const name = aug.name;
|
const name = aug.name;
|
||||||
Augmentations[name] = aug;
|
Augmentations[name] = aug;
|
||||||
}
|
}
|
||||||
@ -44,6 +44,7 @@ export function getNextNeuroFluxLevel(): number {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return currLevel + 1;
|
return currLevel + 1;
|
||||||
|
StaticAugmentations[name] = aug;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createAugmentations(): void {
|
function createAugmentations(): void {
|
||||||
@ -67,7 +68,7 @@ function resetFactionAugmentations(): void {
|
|||||||
|
|
||||||
function initAugmentations(): void {
|
function initAugmentations(): void {
|
||||||
resetFactionAugmentations();
|
resetFactionAugmentations();
|
||||||
clearObject(Augmentations);
|
clearObject(StaticAugmentations);
|
||||||
createAugmentations();
|
createAugmentations();
|
||||||
updateAugmentationCosts();
|
updateAugmentationCosts();
|
||||||
Player.reapplyAllAugmentations();
|
Player.reapplyAllAugmentations();
|
||||||
@ -127,17 +128,17 @@ function resetAugmentation(aug: Augmentation): void {
|
|||||||
aug.addToFactions(aug.factions);
|
aug.addToFactions(aug.factions);
|
||||||
const name = aug.name;
|
const name = aug.name;
|
||||||
if (augmentationExists(name)) {
|
if (augmentationExists(name)) {
|
||||||
delete Augmentations[name];
|
delete StaticAugmentations[name];
|
||||||
}
|
}
|
||||||
AddToAugmentations(aug);
|
AddToStaticAugmentations(aug);
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyAugmentation(aug: IPlayerOwnedAugmentation, reapply = false): void {
|
function applyAugmentation(aug: IPlayerOwnedAugmentation, reapply = false): void {
|
||||||
const augObj = Augmentations[aug.name];
|
const staticAugmentation = StaticAugmentations[aug.name];
|
||||||
|
|
||||||
// Apply multipliers
|
// Apply multipliers
|
||||||
for (const mult of Object.keys(augObj.mults)) {
|
for (const mult of Object.keys(staticAugmentation.mults)) {
|
||||||
const v = Player.getMult(mult) * augObj.mults[mult];
|
const v = Player.getMult(mult) * staticAugmentation.mults[mult];
|
||||||
Player.setMult(mult, v);
|
Player.setMult(mult, v);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -183,7 +184,7 @@ function installAugmentations(force?: boolean): boolean {
|
|||||||
}
|
}
|
||||||
for (let i = 0; i < Player.queuedAugmentations.length; ++i) {
|
for (let i = 0; i < Player.queuedAugmentations.length; ++i) {
|
||||||
const ownedAug = Player.queuedAugmentations[i];
|
const ownedAug = Player.queuedAugmentations[i];
|
||||||
const aug = Augmentations[ownedAug.name];
|
const aug = StaticAugmentations[ownedAug.name];
|
||||||
if (aug == null) {
|
if (aug == null) {
|
||||||
console.error(`Invalid augmentation: ${ownedAug.name}`);
|
console.error(`Invalid augmentation: ${ownedAug.name}`);
|
||||||
continue;
|
continue;
|
||||||
@ -213,7 +214,7 @@ function installAugmentations(force?: boolean): boolean {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function augmentationExists(name: string): boolean {
|
function augmentationExists(name: string): boolean {
|
||||||
return Augmentations.hasOwnProperty(name);
|
return StaticAugmentations.hasOwnProperty(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isRepeatableAug(aug: Augmentation): boolean {
|
export function isRepeatableAug(aug: Augmentation): boolean {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Augmentation } from "./Augmentation";
|
import { Augmentation } from "./Augmentation";
|
||||||
import { IMap } from "../types";
|
import { IMap } from "../types";
|
||||||
|
|
||||||
export const Augmentations: IMap<Augmentation> = {};
|
export const StaticAugmentations: IMap<Augmentation> = {};
|
@ -22,7 +22,7 @@ import { Settings } from "../../Settings/Settings";
|
|||||||
import { ConfirmationModal } from "../../ui/React/ConfirmationModal";
|
import { ConfirmationModal } from "../../ui/React/ConfirmationModal";
|
||||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||||
import { AugmentationNames } from "../data/AugmentationNames";
|
import { AugmentationNames } from "../data/AugmentationNames";
|
||||||
import { Augmentations } from "../Augmentations";
|
import { StaticAugmentations } from "../StaticAugmentations";
|
||||||
import { CONSTANTS } from "../../Constants";
|
import { CONSTANTS } from "../../Constants";
|
||||||
import { formatNumber } from "../../utils/StringHelperFunctions";
|
import { formatNumber } from "../../utils/StringHelperFunctions";
|
||||||
import { Info } from "@mui/icons-material";
|
import { Info } from "@mui/icons-material";
|
||||||
@ -39,7 +39,9 @@ const NeuroFluxDisplay = ({ player }: NFGDisplayProps): React.ReactElement => {
|
|||||||
<Typography variant="h5" color={Settings.theme.info}>
|
<Typography variant="h5" color={Settings.theme.info}>
|
||||||
NeuroFlux Governor - Level {level}
|
NeuroFlux Governor - Level {level}
|
||||||
</Typography>
|
</Typography>
|
||||||
<Typography color={Settings.theme.info}>{Augmentations[AugmentationNames.NeuroFluxGovernor].stats}</Typography>
|
<Typography color={Settings.theme.info}>
|
||||||
|
{StaticAugmentations[AugmentationNames.NeuroFluxGovernor].stats}
|
||||||
|
</Typography>
|
||||||
</Paper>
|
</Paper>
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<></>
|
||||||
|
@ -13,7 +13,7 @@ import React, { useState } from "react";
|
|||||||
import { OwnedAugmentationsOrderSetting } from "../../Settings/SettingEnums";
|
import { OwnedAugmentationsOrderSetting } from "../../Settings/SettingEnums";
|
||||||
import { Settings } from "../../Settings/Settings";
|
import { Settings } from "../../Settings/Settings";
|
||||||
import { use } from "../../ui/Context";
|
import { use } from "../../ui/Context";
|
||||||
import { Augmentations } from "../Augmentations";
|
import { StaticAugmentations } from "../StaticAugmentations";
|
||||||
import { AugmentationNames } from "../data/AugmentationNames";
|
import { AugmentationNames } from "../data/AugmentationNames";
|
||||||
|
|
||||||
export function InstalledAugmentations(): React.ReactElement {
|
export function InstalledAugmentations(): React.ReactElement {
|
||||||
@ -77,7 +77,7 @@ export function InstalledAugmentations(): React.ReactElement {
|
|||||||
</Typography>
|
</Typography>
|
||||||
<Typography sx={{ maxHeight: 350, overflowY: "scroll" }}>
|
<Typography sx={{ maxHeight: 350, overflowY: "scroll" }}>
|
||||||
{(() => {
|
{(() => {
|
||||||
const aug = Augmentations[selectedAug.name];
|
const aug = StaticAugmentations[selectedAug.name];
|
||||||
|
|
||||||
const info = typeof aug.info === "string" ? <span>{aug.info}</span> : aug.info;
|
const info = typeof aug.info === "string" ? <span>{aug.info}</span> : aug.info;
|
||||||
const tooltip = (
|
const tooltip = (
|
||||||
|
@ -8,7 +8,7 @@ import { BitNodeMultipliers } from "../../BitNode/BitNodeMultipliers";
|
|||||||
import { Player } from "../../Player";
|
import { Player } from "../../Player";
|
||||||
import { Settings } from "../../Settings/Settings";
|
import { Settings } from "../../Settings/Settings";
|
||||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||||
import { Augmentations } from "../Augmentations";
|
import { StaticAugmentations } from "../StaticAugmentations";
|
||||||
|
|
||||||
interface IAugmentedStats {
|
interface IAugmentedStats {
|
||||||
[index: string]: number;
|
[index: string]: number;
|
||||||
@ -17,7 +17,7 @@ interface IAugmentedStats {
|
|||||||
function calculateAugmentedStats(): IAugmentedStats {
|
function calculateAugmentedStats(): IAugmentedStats {
|
||||||
const augP: IAugmentedStats = {};
|
const augP: IAugmentedStats = {};
|
||||||
for (const aug of Player.queuedAugmentations) {
|
for (const aug of Player.queuedAugmentations) {
|
||||||
const augObj = Augmentations[aug.name];
|
const augObj = StaticAugmentations[aug.name];
|
||||||
for (const mult of Object.keys(augObj.mults)) {
|
for (const mult of Object.keys(augObj.mults)) {
|
||||||
const v = augP[mult] ? augP[mult] : 1;
|
const v = augP[mult] ? augP[mult] : 1;
|
||||||
augP[mult] = v * augObj.mults[mult];
|
augP[mult] = v * augObj.mults[mult];
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
import { List, ListItemText, Paper, Tooltip, Typography } from "@mui/material";
|
import { List, ListItemText, Paper, Tooltip, Typography } from "@mui/material";
|
||||||
import * as React from "react";
|
import * as React from "react";
|
||||||
import { Player } from "../../Player";
|
import { Player } from "../../Player";
|
||||||
import { Augmentations } from "../Augmentations";
|
import { StaticAugmentations } from "../StaticAugmentations";
|
||||||
import { AugmentationNames } from "../data/AugmentationNames";
|
import { AugmentationNames } from "../data/AugmentationNames";
|
||||||
|
|
||||||
export function PurchasedAugmentations(): React.ReactElement {
|
export function PurchasedAugmentations(): React.ReactElement {
|
||||||
@ -23,7 +23,7 @@ export function PurchasedAugmentations(): React.ReactElement {
|
|||||||
let displayName = ownedAug.name;
|
let displayName = ownedAug.name;
|
||||||
|
|
||||||
if (ownedAug.name === AugmentationNames.NeuroFluxGovernor && i !== nfgIndex) continue;
|
if (ownedAug.name === AugmentationNames.NeuroFluxGovernor && i !== nfgIndex) continue;
|
||||||
const aug = Augmentations[ownedAug.name];
|
const aug = StaticAugmentations[ownedAug.name];
|
||||||
|
|
||||||
let level = null;
|
let level = null;
|
||||||
if (ownedAug.name === AugmentationNames.NeuroFluxGovernor) {
|
if (ownedAug.name === AugmentationNames.NeuroFluxGovernor) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Augmentations } from "../Augmentation/Augmentations";
|
import { StaticAugmentations } from "../Augmentation/StaticAugmentations";
|
||||||
import { Augmentation } from "../Augmentation/Augmentation";
|
import { Augmentation } from "../Augmentation/Augmentation";
|
||||||
import { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation";
|
import { PlayerOwnedAugmentation } from "../Augmentation/PlayerOwnedAugmentation";
|
||||||
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
||||||
@ -57,7 +57,7 @@ export function hasAugmentationPrereqs(aug: Augmentation): boolean {
|
|||||||
let hasPrereqs = true;
|
let hasPrereqs = true;
|
||||||
if (aug.prereqs && aug.prereqs.length > 0) {
|
if (aug.prereqs && aug.prereqs.length > 0) {
|
||||||
for (let i = 0; i < aug.prereqs.length; ++i) {
|
for (let i = 0; i < aug.prereqs.length; ++i) {
|
||||||
const prereqAug = Augmentations[aug.prereqs[i]];
|
const prereqAug = StaticAugmentations[aug.prereqs[i]];
|
||||||
if (prereqAug == null) {
|
if (prereqAug == null) {
|
||||||
console.error(`Invalid prereq Augmentation ${aug.prereqs[i]}`);
|
console.error(`Invalid prereq Augmentation ${aug.prereqs[i]}`);
|
||||||
continue;
|
continue;
|
||||||
@ -162,7 +162,7 @@ export function processPassiveFactionRepGain(numCycles: number): void {
|
|||||||
export const getFactionAugmentationsFiltered = (player: IPlayer, faction: Faction): string[] => {
|
export const getFactionAugmentationsFiltered = (player: IPlayer, faction: Faction): string[] => {
|
||||||
// If player has a gang with this faction, return (almost) all augmentations
|
// If player has a gang with this faction, return (almost) all augmentations
|
||||||
if (player.hasGangWith(faction.name)) {
|
if (player.hasGangWith(faction.name)) {
|
||||||
let augs = Object.values(Augmentations);
|
let augs = Object.values(StaticAugmentations);
|
||||||
|
|
||||||
// Remove special augs
|
// Remove special augs
|
||||||
augs = augs.filter((a) => !a.isSpecial);
|
augs = augs.filter((a) => !a.isSpecial);
|
||||||
|
@ -5,7 +5,7 @@ import React, { useState } from "react";
|
|||||||
|
|
||||||
import { PurchaseableAugmentation } from "./PurchaseableAugmentation";
|
import { PurchaseableAugmentation } from "./PurchaseableAugmentation";
|
||||||
|
|
||||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
import { StaticAugmentations } from "../../Augmentation/StaticAugmentations";
|
||||||
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||||
import { Faction } from "../Faction";
|
import { Faction } from "../Faction";
|
||||||
import { PurchaseAugmentationsOrderSetting } from "../../Settings/SettingEnums";
|
import { PurchaseAugmentationsOrderSetting } from "../../Settings/SettingEnums";
|
||||||
@ -63,8 +63,8 @@ export function AugmentationsPage(props: IProps): React.ReactElement {
|
|||||||
function getAugsSortedByCost(): string[] {
|
function getAugsSortedByCost(): string[] {
|
||||||
const augs = getAugs();
|
const augs = getAugs();
|
||||||
augs.sort((augName1, augName2) => {
|
augs.sort((augName1, augName2) => {
|
||||||
const aug1 = Augmentations[augName1],
|
const aug1 = StaticAugmentations[augName1],
|
||||||
aug2 = Augmentations[augName2];
|
aug2 = StaticAugmentations[augName2];
|
||||||
if (aug1 == null || aug2 == null) {
|
if (aug1 == null || aug2 == null) {
|
||||||
throw new Error("Invalid Augmentation Names");
|
throw new Error("Invalid Augmentation Names");
|
||||||
}
|
}
|
||||||
@ -78,16 +78,16 @@ export function AugmentationsPage(props: IProps): React.ReactElement {
|
|||||||
function getAugsSortedByPurchasable(): string[] {
|
function getAugsSortedByPurchasable(): string[] {
|
||||||
const augs = getAugs();
|
const augs = getAugs();
|
||||||
function canBuy(augName: string): boolean {
|
function canBuy(augName: string): boolean {
|
||||||
const aug = Augmentations[augName];
|
|
||||||
const repCost = aug.baseRepRequirement;
|
const repCost = aug.baseRepRequirement;
|
||||||
|
const aug = StaticAugmentations[augName];
|
||||||
const hasReq = props.faction.playerReputation >= repCost;
|
const hasReq = props.faction.playerReputation >= repCost;
|
||||||
const hasRep = hasAugmentationPrereqs(aug);
|
const hasRep = hasAugmentationPrereqs(aug);
|
||||||
const hasCost = aug.baseCost !== 0 && player.money > aug.baseCost;
|
const hasCost = aug.baseCost !== 0 && player.money > aug.baseCost;
|
||||||
return hasCost && hasReq && hasRep;
|
return hasCost && hasReq && hasRep;
|
||||||
}
|
}
|
||||||
const buy = augs.filter(canBuy).sort((augName1, augName2) => {
|
const buy = augs.filter(canBuy).sort((augName1, augName2) => {
|
||||||
const aug1 = Augmentations[augName1],
|
const aug1 = StaticAugmentations[augName1],
|
||||||
aug2 = Augmentations[augName2];
|
aug2 = StaticAugmentations[augName2];
|
||||||
if (aug1 == null || aug2 == null) {
|
if (aug1 == null || aug2 == null) {
|
||||||
throw new Error("Invalid Augmentation Names");
|
throw new Error("Invalid Augmentation Names");
|
||||||
}
|
}
|
||||||
@ -97,8 +97,8 @@ export function AugmentationsPage(props: IProps): React.ReactElement {
|
|||||||
const cantBuy = augs
|
const cantBuy = augs
|
||||||
.filter((aug) => !canBuy(aug))
|
.filter((aug) => !canBuy(aug))
|
||||||
.sort((augName1, augName2) => {
|
.sort((augName1, augName2) => {
|
||||||
const aug1 = Augmentations[augName1],
|
const aug1 = StaticAugmentations[augName1],
|
||||||
aug2 = Augmentations[augName2];
|
aug2 = StaticAugmentations[augName2];
|
||||||
if (aug1 == null || aug2 == null) {
|
if (aug1 == null || aug2 == null) {
|
||||||
throw new Error("Invalid Augmentation Names");
|
throw new Error("Invalid Augmentation Names");
|
||||||
}
|
}
|
||||||
@ -111,8 +111,8 @@ export function AugmentationsPage(props: IProps): React.ReactElement {
|
|||||||
function getAugsSortedByReputation(): string[] {
|
function getAugsSortedByReputation(): string[] {
|
||||||
const augs = getAugs();
|
const augs = getAugs();
|
||||||
augs.sort((augName1, augName2) => {
|
augs.sort((augName1, augName2) => {
|
||||||
const aug1 = Augmentations[augName1],
|
const aug1 = StaticAugmentations[augName1],
|
||||||
aug2 = Augmentations[augName2];
|
aug2 = StaticAugmentations[augName2];
|
||||||
if (aug1 == null || aug2 == null) {
|
if (aug1 == null || aug2 == null) {
|
||||||
throw new Error("Invalid Augmentation Names");
|
throw new Error("Invalid Augmentation Names");
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ import React, { useState } from "react";
|
|||||||
import { hasAugmentationPrereqs, purchaseAugmentation } from "../FactionHelpers";
|
import { hasAugmentationPrereqs, purchaseAugmentation } from "../FactionHelpers";
|
||||||
import { PurchaseAugmentationModal } from "./PurchaseAugmentationModal";
|
import { PurchaseAugmentationModal } from "./PurchaseAugmentationModal";
|
||||||
|
|
||||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
import { StaticAugmentations } from "../../Augmentation/StaticAugmentations";
|
||||||
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||||
import { Faction } from "../Faction";
|
import { Faction } from "../Faction";
|
||||||
import { IPlayer } from "../../PersonObjects/IPlayer";
|
import { IPlayer } from "../../PersonObjects/IPlayer";
|
||||||
@ -35,7 +35,7 @@ interface IReqProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function Requirements(props: IReqProps): React.ReactElement {
|
function Requirements(props: IReqProps): React.ReactElement {
|
||||||
const aug = Augmentations[props.augName];
|
const aug = StaticAugmentations[props.augName];
|
||||||
if (!props.hasReq) {
|
if (!props.hasReq) {
|
||||||
return (
|
return (
|
||||||
<TableCell key={1} colSpan={2}>
|
<TableCell key={1} colSpan={2}>
|
||||||
@ -75,7 +75,7 @@ interface IProps {
|
|||||||
|
|
||||||
export function PurchaseableAugmentation(props: IProps): React.ReactElement {
|
export function PurchaseableAugmentation(props: IProps): React.ReactElement {
|
||||||
const [open, setOpen] = useState(false);
|
const [open, setOpen] = useState(false);
|
||||||
const aug = Augmentations[props.augName];
|
const aug = StaticAugmentations[props.augName];
|
||||||
if (aug == null) throw new Error(`aug ${props.augName} does not exists`);
|
if (aug == null) throw new Error(`aug ${props.augName} does not exists`);
|
||||||
|
|
||||||
if (aug == null) {
|
if (aug == null) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { Augmentations } from "../Augmentation/Augmentations";
|
import { StaticAugmentations } from "../Augmentation/StaticAugmentations";
|
||||||
import { hasAugmentationPrereqs } from "../Faction/FactionHelpers";
|
import { hasAugmentationPrereqs } from "../Faction/FactionHelpers";
|
||||||
import { CityName } from "../Locations/data/CityNames";
|
import { CityName } from "../Locations/data/CityNames";
|
||||||
import { getRamCost } from "../Netscript/RamCostGenerator";
|
import { getRamCost } from "../Netscript/RamCostGenerator";
|
||||||
@ -28,10 +28,10 @@ export function NetscriptGrafting(player: IPlayer, workerScript: WorkerScript, h
|
|||||||
updateRam("getAugmentationGraftPrice");
|
updateRam("getAugmentationGraftPrice");
|
||||||
const augName = helper.string("getAugmentationGraftPrice", "augName", _augName);
|
const augName = helper.string("getAugmentationGraftPrice", "augName", _augName);
|
||||||
checkGraftingAPIAccess("getAugmentationGraftPrice");
|
checkGraftingAPIAccess("getAugmentationGraftPrice");
|
||||||
if (!getGraftingAvailableAugs(player).includes(augName) || !Augmentations.hasOwnProperty(augName)) {
|
if (!getGraftingAvailableAugs(player).includes(augName) || !StaticAugmentations.hasOwnProperty(augName)) {
|
||||||
throw helper.makeRuntimeErrorMsg("grafting.getAugmentationGraftPrice", `Invalid aug: ${augName}`);
|
throw helper.makeRuntimeErrorMsg("grafting.getAugmentationGraftPrice", `Invalid aug: ${augName}`);
|
||||||
}
|
}
|
||||||
const craftableAug = new GraftableAugmentation(Augmentations[augName]);
|
const craftableAug = new GraftableAugmentation(StaticAugmentations[augName]);
|
||||||
return craftableAug.cost;
|
return craftableAug.cost;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -39,10 +39,10 @@ export function NetscriptGrafting(player: IPlayer, workerScript: WorkerScript, h
|
|||||||
updateRam("getAugmentationGraftTime");
|
updateRam("getAugmentationGraftTime");
|
||||||
const augName = helper.string("getAugmentationGraftTime", "augName", _augName);
|
const augName = helper.string("getAugmentationGraftTime", "augName", _augName);
|
||||||
checkGraftingAPIAccess("getAugmentationGraftTime");
|
checkGraftingAPIAccess("getAugmentationGraftTime");
|
||||||
if (!getGraftingAvailableAugs(player).includes(augName) || !Augmentations.hasOwnProperty(augName)) {
|
if (!getGraftingAvailableAugs(player).includes(augName) || !StaticAugmentations.hasOwnProperty(augName)) {
|
||||||
throw helper.makeRuntimeErrorMsg("grafting.getAugmentationGraftTime", `Invalid aug: ${augName}`);
|
throw helper.makeRuntimeErrorMsg("grafting.getAugmentationGraftTime", `Invalid aug: ${augName}`);
|
||||||
}
|
}
|
||||||
const craftableAug = new GraftableAugmentation(Augmentations[augName]);
|
const craftableAug = new GraftableAugmentation(StaticAugmentations[augName]);
|
||||||
return craftableAug.time;
|
return craftableAug.time;
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -64,7 +64,7 @@ export function NetscriptGrafting(player: IPlayer, workerScript: WorkerScript, h
|
|||||||
"You must be in New Tokyo to begin grafting an Augmentation.",
|
"You must be in New Tokyo to begin grafting an Augmentation.",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (!getGraftingAvailableAugs(player).includes(augName) || !Augmentations.hasOwnProperty(augName)) {
|
if (!getGraftingAvailableAugs(player).includes(augName) || !StaticAugmentations.hasOwnProperty(augName)) {
|
||||||
workerScript.log("grafting.graftAugmentation", () => `Invalid aug: ${augName}`);
|
workerScript.log("grafting.graftAugmentation", () => `Invalid aug: ${augName}`);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -75,7 +75,7 @@ export function NetscriptGrafting(player: IPlayer, workerScript: WorkerScript, h
|
|||||||
workerScript.log("graftAugmentation", () => txt);
|
workerScript.log("graftAugmentation", () => txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
const craftableAug = new GraftableAugmentation(Augmentations[augName]);
|
const craftableAug = new GraftableAugmentation(StaticAugmentations[augName]);
|
||||||
if (player.money < craftableAug.cost) {
|
if (player.money < craftableAug.cost) {
|
||||||
workerScript.log("grafting.graftAugmentation", () => `You don't have enough money to craft ${augName}`);
|
workerScript.log("grafting.graftAugmentation", () => `You don't have enough money to craft ${augName}`);
|
||||||
return false;
|
return false;
|
||||||
|
@ -3,7 +3,7 @@ import { IPlayer } from "../PersonObjects/IPlayer";
|
|||||||
import { purchaseAugmentation, joinFaction, getFactionAugmentationsFiltered } from "../Faction/FactionHelpers";
|
import { purchaseAugmentation, joinFaction, getFactionAugmentationsFiltered } from "../Faction/FactionHelpers";
|
||||||
import { startWorkerScript } from "../NetscriptWorker";
|
import { startWorkerScript } from "../NetscriptWorker";
|
||||||
import { Augmentation } from "../Augmentation/Augmentation";
|
import { Augmentation } from "../Augmentation/Augmentation";
|
||||||
import { Augmentations } from "../Augmentation/Augmentations";
|
import { StaticAugmentations } from "../Augmentation/StaticAugmentations";
|
||||||
import { augmentationExists, installAugmentations } from "../Augmentation/AugmentationHelpers";
|
import { augmentationExists, installAugmentations } from "../Augmentation/AugmentationHelpers";
|
||||||
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
||||||
import { killWorkerScript } from "../Netscript/killWorkerScript";
|
import { killWorkerScript } from "../Netscript/killWorkerScript";
|
||||||
@ -56,7 +56,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
|||||||
throw _ctx.helper.makeRuntimeErrorMsg(`Invalid augmentation: '${name}'`);
|
throw _ctx.helper.makeRuntimeErrorMsg(`Invalid augmentation: '${name}'`);
|
||||||
}
|
}
|
||||||
|
|
||||||
return Augmentations[name];
|
return StaticAugmentations[name];
|
||||||
};
|
};
|
||||||
|
|
||||||
const getFaction = function (_ctx: NetscriptContext, name: string): Faction {
|
const getFaction = function (_ctx: NetscriptContext, name: string): Faction {
|
||||||
|
@ -5,7 +5,7 @@ import { FactionWorkType } from "../Faction/FactionWorkTypeEnum";
|
|||||||
import { SleeveTaskType } from "../PersonObjects/Sleeve/SleeveTaskTypesEnum";
|
import { SleeveTaskType } from "../PersonObjects/Sleeve/SleeveTaskTypesEnum";
|
||||||
import { WorkerScript } from "../Netscript/WorkerScript";
|
import { WorkerScript } from "../Netscript/WorkerScript";
|
||||||
import { findSleevePurchasableAugs } from "../PersonObjects/Sleeve/SleeveHelpers";
|
import { findSleevePurchasableAugs } from "../PersonObjects/Sleeve/SleeveHelpers";
|
||||||
import { Augmentations } from "../Augmentation/Augmentations";
|
import { StaticAugmentations } from "../Augmentation/StaticAugmentations";
|
||||||
import { CityName } from "../Locations/data/CityNames";
|
import { CityName } from "../Locations/data/CityNames";
|
||||||
import { findCrime } from "../Crime/CrimeHelpers";
|
import { findCrime } from "../Crime/CrimeHelpers";
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
|||||||
throw helper.makeRuntimeErrorMsg("sleeve.purchaseSleeveAug", `Sleeve shock too high: Sleeve ${sleeveNumber}`);
|
throw helper.makeRuntimeErrorMsg("sleeve.purchaseSleeveAug", `Sleeve shock too high: Sleeve ${sleeveNumber}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const aug = Augmentations[augName];
|
const aug = StaticAugmentations[augName];
|
||||||
if (!aug) {
|
if (!aug) {
|
||||||
throw helper.makeRuntimeErrorMsg("sleeve.purchaseSleeveAug", `Invalid aug: ${augName}`);
|
throw helper.makeRuntimeErrorMsg("sleeve.purchaseSleeveAug", `Invalid aug: ${augName}`);
|
||||||
}
|
}
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
import { StaticAugmentations } from "../../Augmentation/StaticAugmentations";
|
||||||
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||||
import { IPlayer } from "../IPlayer";
|
import { IPlayer } from "../IPlayer";
|
||||||
|
|
||||||
export const getGraftingAvailableAugs = (player: IPlayer): string[] => {
|
export const getGraftingAvailableAugs = (player: IPlayer): string[] => {
|
||||||
const augs: string[] = [];
|
const augs: string[] = [];
|
||||||
|
|
||||||
for (const [augName, aug] of Object.entries(Augmentations)) {
|
for (const [augName, aug] of Object.entries(StaticAugmentations)) {
|
||||||
if (augName === AugmentationNames.NeuroFluxGovernor || augName === AugmentationNames.TheRedPill || aug.isSpecial)
|
if (augName === AugmentationNames.NeuroFluxGovernor || augName === AugmentationNames.TheRedPill || aug.isSpecial)
|
||||||
continue;
|
continue;
|
||||||
augs.push(augName);
|
augs.push(augName);
|
||||||
|
@ -2,7 +2,7 @@ import { Construction, CheckBox, CheckBoxOutlineBlank } from "@mui/icons-materia
|
|||||||
import { Box, Button, Container, List, ListItemButton, Paper, Typography } from "@mui/material";
|
import { Box, Button, Container, List, ListItemButton, Paper, Typography } from "@mui/material";
|
||||||
import React, { useState } from "react";
|
import React, { useState } from "react";
|
||||||
import { Augmentation } from "../../../Augmentation/Augmentation";
|
import { Augmentation } from "../../../Augmentation/Augmentation";
|
||||||
import { Augmentations } from "../../../Augmentation/Augmentations";
|
import { StaticAugmentations } from "../../../Augmentation/StaticAugmentations";
|
||||||
import { AugmentationNames } from "../../../Augmentation/data/AugmentationNames";
|
import { AugmentationNames } from "../../../Augmentation/data/AugmentationNames";
|
||||||
import { CONSTANTS } from "../../../Constants";
|
import { CONSTANTS } from "../../../Constants";
|
||||||
import { hasAugmentationPrereqs } from "../../../Faction/FactionHelpers";
|
import { hasAugmentationPrereqs } from "../../../Faction/FactionHelpers";
|
||||||
@ -54,7 +54,7 @@ export const GraftingRoot = (): React.ReactElement => {
|
|||||||
const player = use.Player();
|
const player = use.Player();
|
||||||
const router = use.Router();
|
const router = use.Router();
|
||||||
|
|
||||||
for (const aug of Object.values(Augmentations)) {
|
for (const aug of Object.values(StaticAugmentations)) {
|
||||||
const name = aug.name;
|
const name = aug.name;
|
||||||
const graftableAug = new GraftableAugmentation(aug);
|
const graftableAug = new GraftableAugmentation(aug);
|
||||||
GraftableAugmentations[name] = graftableAug;
|
GraftableAugmentations[name] = graftableAug;
|
||||||
@ -62,7 +62,7 @@ export const GraftingRoot = (): React.ReactElement => {
|
|||||||
|
|
||||||
const [selectedAug, setSelectedAug] = useState(getGraftingAvailableAugs(player)[0]);
|
const [selectedAug, setSelectedAug] = useState(getGraftingAvailableAugs(player)[0]);
|
||||||
const [graftOpen, setGraftOpen] = useState(false);
|
const [graftOpen, setGraftOpen] = useState(false);
|
||||||
|
const selectedAugmentation = StaticAugmentations[selectedAug];
|
||||||
return (
|
return (
|
||||||
<Container disableGutters maxWidth="lg" sx={{ mx: 0 }}>
|
<Container disableGutters maxWidth="lg" sx={{ mx: 0 }}>
|
||||||
<Button onClick={() => router.toLocation(Locations[LocationName.NewTokyoVitaLife])}>Back</Button>
|
<Button onClick={() => router.toLocation(Locations[LocationName.NewTokyoVitaLife])}>Back</Button>
|
||||||
@ -136,22 +136,25 @@ export const GraftingRoot = (): React.ReactElement => {
|
|||||||
)}
|
)}
|
||||||
{/* Use formula so the displayed creation time is accurate to player bonus */}
|
{/* Use formula so the displayed creation time is accurate to player bonus */}
|
||||||
</Typography>
|
</Typography>
|
||||||
{Augmentations[selectedAug].prereqs.length > 0 && (
|
{selectedAugmentation.prereqs.length > 0 && (
|
||||||
<AugPreReqsChecklist player={player} aug={Augmentations[selectedAug]} />
|
<AugPreReqsChecklist player={player} aug={selectedAugmentation} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<br />
|
<br />
|
||||||
<Typography sx={{ maxHeight: 305, overflowY: "scroll" }}>
|
<Typography sx={{ maxHeight: 305, overflowY: "scroll" }}>
|
||||||
{(() => {
|
{(() => {
|
||||||
const aug = Augmentations[selectedAug];
|
const info =
|
||||||
|
typeof selectedAugmentation.info === "string" ? (
|
||||||
const info = typeof aug.info === "string" ? <span>{aug.info}</span> : aug.info;
|
<span>{selectedAugmentation.info}</span>
|
||||||
|
) : (
|
||||||
|
selectedAugmentation.info
|
||||||
|
);
|
||||||
const tooltip = (
|
const tooltip = (
|
||||||
<>
|
<>
|
||||||
{info}
|
{info}
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
{aug.stats}
|
{selectedAugmentation.stats}
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
return tooltip;
|
return tooltip;
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
import { IPlayer } from "../IPlayer";
|
import { IPlayer } from "../IPlayer";
|
||||||
import { PlayerObject } from "./PlayerObject";
|
import { PlayerObject } from "./PlayerObject";
|
||||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
|
||||||
import { applyAugmentation } from "../../Augmentation/AugmentationHelpers";
|
import { applyAugmentation } from "../../Augmentation/AugmentationHelpers";
|
||||||
import { PlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation";
|
import { PlayerOwnedAugmentation } from "../../Augmentation/PlayerOwnedAugmentation";
|
||||||
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||||
@ -1374,7 +1373,7 @@ export function craftAugmentationWork(this: IPlayer, numCycles: number): boolean
|
|||||||
export function finishGraftAugmentationWork(this: IPlayer, cancelled: boolean): string {
|
export function finishGraftAugmentationWork(this: IPlayer, cancelled: boolean): string {
|
||||||
const augName = this.graftAugmentationName;
|
const augName = this.graftAugmentationName;
|
||||||
if (cancelled === false) {
|
if (cancelled === false) {
|
||||||
applyAugmentation(Augmentations[augName]);
|
applyAugmentation({ name: augName, level: 1 });
|
||||||
|
|
||||||
if (!this.hasAugmentation(AugmentationNames.CongruityImplant)) {
|
if (!this.hasAugmentation(AugmentationNames.CongruityImplant)) {
|
||||||
this.entropy += 1;
|
this.entropy += 1;
|
||||||
|
@ -4,7 +4,7 @@ import { Sleeve } from "./Sleeve";
|
|||||||
import { IPlayer } from "../IPlayer";
|
import { IPlayer } from "../IPlayer";
|
||||||
|
|
||||||
import { Augmentation } from "../../Augmentation/Augmentation";
|
import { Augmentation } from "../../Augmentation/Augmentation";
|
||||||
import { Augmentations } from "../../Augmentation/Augmentations";
|
import { StaticAugmentations } from "../../Augmentation/StaticAugmentations";
|
||||||
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||||
import { Faction } from "../../Faction/Faction";
|
import { Faction } from "../../Faction/Faction";
|
||||||
import { Factions } from "../../Faction/Factions";
|
import { Factions } from "../../Faction/Factions";
|
||||||
@ -68,8 +68,8 @@ export function findSleevePurchasableAugs(sleeve: Sleeve, p: IPlayer): Augmentat
|
|||||||
if (p.inGang()) {
|
if (p.inGang()) {
|
||||||
const fac = p.getGangFaction();
|
const fac = p.getGangFaction();
|
||||||
|
|
||||||
for (const augName of Object.keys(Augmentations)) {
|
for (const augName of Object.keys(StaticAugmentations)) {
|
||||||
const aug = Augmentations[augName];
|
const aug = StaticAugmentations[augName];
|
||||||
if (!isAvailableForSleeve(aug)) {
|
if (!isAvailableForSleeve(aug)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -93,7 +93,7 @@ export function findSleevePurchasableAugs(sleeve: Sleeve, p: IPlayer): Augmentat
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (const augName of fac.augmentations) {
|
for (const augName of fac.augmentations) {
|
||||||
const aug: Augmentation = Augmentations[augName];
|
const aug: Augmentation = StaticAugmentations[augName];
|
||||||
if (!isAvailableForSleeve(aug)) {
|
if (!isAvailableForSleeve(aug)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
import { Sleeve } from "../Sleeve";
|
import { Sleeve } from "../Sleeve";
|
||||||
import { findSleevePurchasableAugs } from "../SleeveHelpers";
|
import { findSleevePurchasableAugs } from "../SleeveHelpers";
|
||||||
import { Augmentations } from "../../../Augmentation/Augmentations";
|
import { StaticAugmentations } from "../../../Augmentation/StaticAugmentations";
|
||||||
import { Augmentation } from "../../../Augmentation/Augmentation";
|
import { Augmentation } from "../../../Augmentation/Augmentation";
|
||||||
import { Money } from "../../../ui/React/Money";
|
import { Money } from "../../../ui/React/Money";
|
||||||
import { Modal } from "../../../ui/React/Modal";
|
import { Modal } from "../../../ui/React/Modal";
|
||||||
@ -93,7 +93,7 @@ export function SleeveAugmentationsModal(props: IProps): React.ReactElement {
|
|||||||
<Typography sx={{ mx: 1 }}>Owned Augmentations:</Typography>
|
<Typography sx={{ mx: 1 }}>Owned Augmentations:</Typography>
|
||||||
<Box display="grid" sx={{ gridTemplateColumns: "repeat(5, 1fr)", m: 1 }}>
|
<Box display="grid" sx={{ gridTemplateColumns: "repeat(5, 1fr)", m: 1 }}>
|
||||||
{ownedAugNames.map((augName) => {
|
{ownedAugNames.map((augName) => {
|
||||||
const aug = Augmentations[augName];
|
const aug = StaticAugmentations[augName];
|
||||||
const info = typeof aug.info === "string" ? <span>{aug.info}</span> : aug.info;
|
const info = typeof aug.info === "string" ? <span>{aug.info}</span> : aug.info;
|
||||||
const tooltip = (
|
const tooltip = (
|
||||||
<>
|
<>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { FactionNames } from "./Faction/data/FactionNames";
|
import { FactionNames } from "./Faction/data/FactionNames";
|
||||||
import { CityName } from "./Locations/data/CityNames";
|
import { CityName } from "./Locations/data/CityNames";
|
||||||
import { Augmentations } from "./Augmentation/Augmentations";
|
import { StaticAugmentations } from "./Augmentation/StaticAugmentations";
|
||||||
import { augmentationExists, initAugmentations } from "./Augmentation/AugmentationHelpers";
|
import { augmentationExists, initAugmentations } from "./Augmentation/AugmentationHelpers";
|
||||||
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
|
import { AugmentationNames } from "./Augmentation/data/AugmentationNames";
|
||||||
import { initBitNodeMultipliers } from "./BitNode/BitNode";
|
import { initBitNodeMultipliers } from "./BitNode/BitNode";
|
||||||
@ -225,9 +225,9 @@ export function prestigeSourceFile(flume: boolean): void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Delete all Augmentations
|
// Delete all Augmentations
|
||||||
for (const name of Object.keys(Augmentations)) {
|
for (const name of Object.keys(StaticAugmentations)) {
|
||||||
if (Augmentations.hasOwnProperty(name)) {
|
if (StaticAugmentations.hasOwnProperty(name)) {
|
||||||
delete Augmentations[name];
|
delete StaticAugmentations[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user