diff --git a/src/Constants.ts b/src/Constants.ts index 9688f0416..7dd447c7c 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -109,6 +109,8 @@ export const CONSTANTS: { CodingContractBaseFactionRepGain: number; CodingContractBaseCompanyRepGain: number; CodingContractBaseMoneyGain: number; + AugmentationCraftingCostMult: number; + AugmentationCraftingTimeMult: number; TotalNumBitNodes: number; LatestUpdate: string; } = { @@ -271,6 +273,11 @@ export const CONSTANTS: { CodingContractBaseCompanyRepGain: 4000, CodingContractBaseMoneyGain: 75e6, + // Augmentation crafting multipliers + // TODO: Get these right + AugmentationCraftingCostMult: 1.2, + AugmentationCraftingTimeMult: 1, + // BitNode/Source-File related stuff TotalNumBitNodes: 24, diff --git a/src/PersonObjects/Grafting/CraftableAugmentation.ts b/src/PersonObjects/Grafting/CraftableAugmentation.ts new file mode 100644 index 000000000..5f7785c16 --- /dev/null +++ b/src/PersonObjects/Grafting/CraftableAugmentation.ts @@ -0,0 +1,26 @@ +import { Augmentation } from "../../Augmentation/Augmentation"; +import { CONSTANTS } from "../../Constants"; + +export interface IConstructorParams { + augmentation: Augmentation; + readonly cost: number; + readonly time: number; +} + +export class CraftableAugmentation { + // The augmentation that this craftable corresponds to + augmentation: Augmentation; + + constructor(augmentation: Augmentation) { + this.augmentation = augmentation; + } + + get cost(): number { + return this.augmentation.startingCost * CONSTANTS.AugmentationCraftingCostMult; + } + + get time(): number { + // CONSTANTS.AugmentationCraftingTimeMult + return 15000; + } +} diff --git a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx index 1f58b43d5..9a3b05534 100644 --- a/src/PersonObjects/Grafting/ui/GraftingRoot.tsx +++ b/src/PersonObjects/Grafting/ui/GraftingRoot.tsx @@ -14,13 +14,19 @@ import { } from "@mui/icons-material"; import { use } from "../../../ui/Context"; +import { Money } from "../../../ui/React/Money"; import { Augmentations } from "../../../Augmentation/Augmentations"; import { AugmentationNames } from "../../../Augmentation/data/AugmentationNames" import { Settings } from "../../../Settings/Settings"; -import { CONSTANTS } from "../../../Constants"; +import { IMap } from "../../../types"; +import { convertTimeMsToTimeElapsedString } from "../../../utils/StringHelperFunctions"; import { IPlayer } from "../../IPlayer"; +import { CraftableAugmentation } from "../CraftableAugmentation"; + +const CraftableAugmentations: IMap = {} + const getAvailableAugs = (player: IPlayer): string[] => { const augs: string[] = []; @@ -41,6 +47,13 @@ const getAvailableAugs = (player: IPlayer): string[] => { export const GraftingRoot = (): React.ReactElement => { const player = use.Player(); const router = use.Router(); + + for (const aug of Object.values(Augmentations)) { + const name = aug.name; + const craftableAug = new CraftableAugmentation(aug); + CraftableAugmentations[name] = craftableAug; + } + const [selectedAug, setSelectedAug] = useState(getAvailableAugs(player)[0]); return <> @@ -78,16 +91,22 @@ export const GraftingRoot = (): React.ReactElement => { - Time to Craft: bar + Time to Craft: {convertTimeMsToTimeElapsedString(CraftableAugmentations[selectedAug].time)} {(() => {