From 5d6952dbacf0ffeb2f4a6ac967d94ab58e604f8a Mon Sep 17 00:00:00 2001 From: nickofolas Date: Mon, 7 Mar 2022 20:03:23 -0600 Subject: [PATCH 01/14] First iteration of sleeves UI improvements --- .../Sleeve/ui/SleeveAugmentationsModal.tsx | 116 +++++------ src/PersonObjects/Sleeve/ui/SleeveElem.tsx | 153 +++++++-------- src/PersonObjects/Sleeve/ui/SleeveRoot.tsx | 9 +- src/PersonObjects/Sleeve/ui/StatsElement.tsx | 181 ++++++++++++++++-- src/PersonObjects/Sleeve/ui/TaskSelector.tsx | 8 +- 5 files changed, 289 insertions(+), 178 deletions(-) diff --git a/src/PersonObjects/Sleeve/ui/SleeveAugmentationsModal.tsx b/src/PersonObjects/Sleeve/ui/SleeveAugmentationsModal.tsx index 301137b24..57c402878 100644 --- a/src/PersonObjects/Sleeve/ui/SleeveAugmentationsModal.tsx +++ b/src/PersonObjects/Sleeve/ui/SleeveAugmentationsModal.tsx @@ -50,74 +50,62 @@ export function SleeveAugmentationsModal(props: IProps): React.ReactElement { return ( <> - - You can purchase Augmentations for your Duplicate Sleeves. These Augmentations have the same effect as they - would for you. You can only purchase Augmentations that you have unlocked through Factions. -
-
- When purchasing an Augmentation for a Duplicate Sleeve, they are immediately installed. This means that the - Duplicate Sleeve will immediately lose all of its stat experience. -
- - - {availableAugs.map((aug) => { - return ( - - - - - - - - {aug.name} - - - - - - - - ); - })} - -
+ + + You can purchase Augmentations for your Duplicate Sleeves. These Augmentations have the same effect as they + would for you. You can only purchase Augmentations that you have unlocked through Factions. +
+
+ When purchasing an Augmentation for a Duplicate Sleeve, they are immediately installed. This means that the + Duplicate Sleeve will immediately lose all of its stat experience. +
+ + + + {availableAugs.map((aug) => { + return ( + + + + + + + + {aug.name} + + + + + + + + ); + })} + +
+
+
{ownedAugNames.length > 0 && ( <> - Owned Augmentations: - {ownedAugNames.map((augName) => { - const aug = Augmentations[augName]; - let tooltip = <>; - if (typeof aug.info === "string") { - tooltip = ( - <> - {aug.info} -
-
- {aug.stats} - - ); - } else { - tooltip = ( - <> - {aug.info} -
-
- {aug.stats} - - ); - } + Owned Augmentations: + + {ownedAugNames.map((augName) => { + const aug = Augmentations[augName]; + const info = typeof aug.info === "string" ? {aug.info} : aug.info + const tooltip = (<>{info}

{aug.stats}); - return ( - {tooltip}}> - - {augName} - - - ); - })} + return ( + {tooltip}}> + + {augName} + + + ); + })} +
)} diff --git a/src/PersonObjects/Sleeve/ui/SleeveElem.tsx b/src/PersonObjects/Sleeve/ui/SleeveElem.tsx index 45a3e909d..61c9f5cbc 100644 --- a/src/PersonObjects/Sleeve/ui/SleeveElem.tsx +++ b/src/PersonObjects/Sleeve/ui/SleeveElem.tsx @@ -13,20 +13,16 @@ import { createProgressBarText } from "../../../utils/helpers/createProgressBarT import { SleeveAugmentationsModal } from "./SleeveAugmentationsModal"; import { TravelModal } from "./TravelModal"; -import { Money } from "../../../ui/React/Money"; -import { MoneyRate } from "../../../ui/React/MoneyRate"; import { use } from "../../../ui/Context"; -import { ReputationRate } from "../../../ui/React/ReputationRate"; -import { StatsElement } from "./StatsElement"; +import { StatsElement, EarningsElement } from "./StatsElement"; import { MoreStatsModal } from "./MoreStatsModal"; import { MoreEarningsModal } from "./MoreEarningsModal"; import { TaskSelector } from "./TaskSelector"; import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum"; -import { StatsTable } from "../../../ui/React/StatsTable"; import Typography from "@mui/material/Typography"; import Paper from "@mui/material/Paper"; -import Grid from "@mui/material/Grid"; +import { Box } from "@mui/material"; import Button from "@mui/material/Button"; import Tooltip from "@mui/material/Tooltip"; @@ -141,86 +137,71 @@ export function SleeveElem(props: IProps): React.ReactElement { console.error(`Invalid/Unrecognized taskValue in updateSleeveTaskDescription(): ${abc[0]}`); } - let data: any[][] = []; - if (props.sleeve.currentTask === SleeveTaskType.Crime) { - data = [ - [`Money`, , `(on success)`], - [`Hacking Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.hack), `(2x on success)`], - [`Strength Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.str), `(2x on success)`], - [`Defense Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.def), `(2x on success)`], - [`Dexterity Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.dex), `(2x on success)`], - [`Agility Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.agi), `(2x on success)`], - [`Charisma Exp`, numeralWrapper.formatExp(props.sleeve.gainRatesForTask.cha), `(2x on success)`], - ]; - } else { - data = [ - [`Money:`, ], - [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.hack)} / s`], - [`Strength Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.str)} / s`], - [`Defense Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.def)} / s`], - [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.dex)} / s`], - [`Agility Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.agi)} / s`], - [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.cha)} / s`], - ]; - if (props.sleeve.currentTask === SleeveTaskType.Company || props.sleeve.currentTask === SleeveTaskType.Faction) { - const repGain: number = props.sleeve.getRepGain(player); - data.push([`Reputation:`, ]); - } - } - return ( - <> - - - - - Insufficient funds : ""}> - - - - - Unlocked when sleeve has fully recovered : ""} - > - - - - - - - - {desc} - - {props.sleeve.currentTask === SleeveTaskType.Crime && - createProgressBarText({ - progress: props.sleeve.currentTaskTime / props.sleeve.currentTaskMaxTime, - totalTicks: 25, - })} - - - - - - - - - setStatsOpen(false)} sleeve={props.sleeve} /> - setEarningsOpen(false)} sleeve={props.sleeve} /> - setTravelOpen(false)} - sleeve={props.sleeve} - rerender={props.rerender} - /> - setAugmentationsOpen(false)} - sleeve={props.sleeve} - /> - + + + + + + + + + Insufficient funds : ""}> + + + + + Unlocked when sleeve has fully recovered : ""} + > + + + + + + + + + + + + {desc} + + {props.sleeve.currentTask === SleeveTaskType.Crime && + createProgressBarText({ + progress: props.sleeve.currentTaskTime / props.sleeve.currentTaskMaxTime, + totalTicks: 25, + })} + + + + setStatsOpen(false)} sleeve={props.sleeve} /> + setEarningsOpen(false)} sleeve={props.sleeve} /> + setTravelOpen(false)} + sleeve={props.sleeve} + rerender={props.rerender} + /> + setAugmentationsOpen(false)} + sleeve={props.sleeve} + /> + + + ); } diff --git a/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx b/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx index 808b84723..a41a59e87 100644 --- a/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx +++ b/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx @@ -7,6 +7,7 @@ import { use } from "../../../ui/Context"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; import Link from "@mui/material/Link"; +import { Box } from "@mui/material"; export function SleeveRoot(): React.ReactElement { const player = use.Player(); @@ -41,9 +42,11 @@ export function SleeveRoot(): React.ReactElement { > Documentation - {player.sleeves.map((sleeve, i) => ( - - ))} + + {player.sleeves.map((sleeve, i) => ( + + ))} + setFAQOpen(false)} /> ); diff --git a/src/PersonObjects/Sleeve/ui/StatsElement.tsx b/src/PersonObjects/Sleeve/ui/StatsElement.tsx index 9e51214fc..d348280e6 100644 --- a/src/PersonObjects/Sleeve/ui/StatsElement.tsx +++ b/src/PersonObjects/Sleeve/ui/StatsElement.tsx @@ -1,31 +1,172 @@ import { Sleeve } from "../Sleeve"; import { numeralWrapper } from "../../../ui/numeralFormat"; import React from "react"; +import Typography from "@mui/material/Typography"; +import { + Table, + TableBody, + TableCell, + TableRow, +} from "@mui/material"; -import { StatsTable } from "../../../ui/React/StatsTable"; +import { Settings } from "../../../Settings/Settings"; +import { formatNumber } from "../../../utils/StringHelperFunctions"; +import { characterOverviewStyles as useStyles } from "../../../ui/React/CharacterOverview"; + +import { Money } from "../../../ui/React/Money"; +import { MoneyRate } from "../../../ui/React/MoneyRate"; +import { ReputationRate } from "../../../ui/React/ReputationRate"; +import { SleeveTaskType } from "../SleeveTaskTypesEnum"; +import { use } from "../../../ui/Context"; + +interface ITableRowData { + content?: string; + level?: number; + exp?: number; +} + +export const generateTableRow = ( + name: string, + color: string, + // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types + classes: any, + data: ITableRowData +): React.ReactElement => { + let content; + + if (data.content !== undefined) { + content = data.content; + } else if (data.level !== undefined && data.exp !== undefined) { + content = `${formatNumber(data.level, 0)} (${numeralWrapper.formatExp(data.exp)} exp)`; + } else if (data.level !== undefined && data.exp === undefined) { + content = `${formatNumber(data.level, 0)}`; + } + + return ( + + + {name} + + + + {content} + + + + ) +} interface IProps { sleeve: Sleeve; } export function StatsElement(props: IProps): React.ReactElement { - const rows = [ - [ - "HP: ", - <> - {numeralWrapper.formatHp(props.sleeve.hp)} / {numeralWrapper.formatHp(props.sleeve.max_hp)} - , - ], - ["City: ", <>{props.sleeve.city}], - ["Hacking: ", <>{numeralWrapper.formatSkill(props.sleeve.hacking)}], - ["Strength: ", <>{numeralWrapper.formatSkill(props.sleeve.strength)}], - ["Defense: ", <>{numeralWrapper.formatSkill(props.sleeve.defense)}], - ["Dexterity: ", <>{numeralWrapper.formatSkill(props.sleeve.dexterity)}], - ["Agility: ", <>{numeralWrapper.formatSkill(props.sleeve.agility)}], - ["Charisma: ", <>{numeralWrapper.formatSkill(props.sleeve.charisma)}], - ["Shock: ", <>{numeralWrapper.formatSleeveShock(100 - props.sleeve.shock)}], - ["Sync: ", <>{numeralWrapper.formatSleeveSynchro(props.sleeve.sync)}], - ["Memory: ", <>{numeralWrapper.formatSleeveMemory(props.sleeve.memory)}], - ]; - return ; + const classes = useStyles(); + + return ( + + + {generateTableRow("City", Settings.theme.primary, classes, { + content: props.sleeve.city + })} + {generateTableRow("HP", Settings.theme.hp, classes, { + content: `${numeralWrapper.formatHp(props.sleeve.hp)} / ${numeralWrapper.formatHp(props.sleeve.max_hp)}` + })} + {generateTableRow("Hacking", Settings.theme.hack, classes, { + level: props.sleeve.hacking, + exp: props.sleeve.hacking_exp + })} + {generateTableRow("Strength", Settings.theme.combat, classes, { + level: props.sleeve.strength, + exp: props.sleeve.strength_exp + })} + {generateTableRow("Defense", Settings.theme.combat, classes, { + level: props.sleeve.defense, + exp: props.sleeve.defense_exp + })} + {generateTableRow("Dexterity", Settings.theme.combat, classes, { + level: props.sleeve.dexterity, + exp: props.sleeve.dexterity_exp + })} + {generateTableRow("Agility", Settings.theme.combat, classes, { + level: props.sleeve.agility, + exp: props.sleeve.agility_exp + })} + {generateTableRow("Charisma", Settings.theme.cha, classes, { + level: props.sleeve.charisma, + exp: props.sleeve.charisma_exp + })} + + +
+
+
+ {generateTableRow("Shock", Settings.theme.primary, classes, { + content: numeralWrapper.formatSleeveShock(100 - props.sleeve.shock) + })} + {generateTableRow("Sync", Settings.theme.primary, classes, { + content: numeralWrapper.formatSleeveSynchro(props.sleeve.sync) + })} + {generateTableRow("Memory", Settings.theme.primary, classes, { + content: numeralWrapper.formatSleeveMemory(props.sleeve.memory) + })} +
+
+ ) } + +export function EarningsElement(props: IProps): React.ReactElement { + const classes = useStyles(); + const player = use.Player(); + + let data: any[][] = []; + if (props.sleeve.currentTask === SleeveTaskType.Crime) { + data = [ + [`Money`, <> (on success)], + [`Hacking Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.hack)} (2x on success)`], + [`Strength Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.str)} (2x on success)`], + [`Defense Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.def)} (2x on success)`], + [`Dexterity Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.dex)} (2x on success)`], + [`Agility Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.agi)} (2x on success)`], + [`Charisma Exp`, `${numeralWrapper.formatExp(props.sleeve.gainRatesForTask.cha)} (2x on success)`], + ]; + } else { + data = [ + [`Money:`, ], + [`Hacking Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.hack)} / sec`], + [`Strength Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.str)} / sec`], + [`Defense Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.def)} / sec`], + [`Dexterity Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.dex)} / sec`], + [`Agility Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.agi)} / sec`], + [`Charisma Exp:`, `${numeralWrapper.formatExp(5 * props.sleeve.gainRatesForTask.cha)} / sec`], + ]; + if (props.sleeve.currentTask === SleeveTaskType.Company || props.sleeve.currentTask === SleeveTaskType.Faction) { + const repGain: number = props.sleeve.getRepGain(player); + data.push([`Reputation:`, ]); + } + } + + return ( + + + + + + Earnings + + + + {data.map(([a, b]) => ( + + + {a} + + + {b} + + + ))} + +
+ ) +} \ No newline at end of file diff --git a/src/PersonObjects/Sleeve/ui/TaskSelector.tsx b/src/PersonObjects/Sleeve/ui/TaskSelector.tsx index 724352aaa..bff6af55e 100644 --- a/src/PersonObjects/Sleeve/ui/TaskSelector.tsx +++ b/src/PersonObjects/Sleeve/ui/TaskSelector.tsx @@ -278,7 +278,7 @@ export function TaskSelector(props: IProps): React.ReactElement { return ( <> - {validActions.map((task) => ( {task} @@ -287,8 +287,7 @@ export function TaskSelector(props: IProps): React.ReactElement { {!(details.first.length === 1 && details.first[0] === "------") && ( <> -
- {details.first.map((detail) => ( {detail} @@ -299,8 +298,7 @@ export function TaskSelector(props: IProps): React.ReactElement { )} {!(details2.length === 1 && details2[0] === "------") && ( <> -
- {details2.map((detail) => ( {detail} From 8ce1660f8ad414fa0561a935eb0825c9dc87f006 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 10 Mar 2022 22:21:02 -0600 Subject: [PATCH 02/14] Fix missing newline at EOL --- src/PersonObjects/Sleeve/ui/StatsElement.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PersonObjects/Sleeve/ui/StatsElement.tsx b/src/PersonObjects/Sleeve/ui/StatsElement.tsx index d348280e6..8a3e1197d 100644 --- a/src/PersonObjects/Sleeve/ui/StatsElement.tsx +++ b/src/PersonObjects/Sleeve/ui/StatsElement.tsx @@ -169,4 +169,4 @@ export function EarningsElement(props: IProps): React.ReactElement { ) -} \ No newline at end of file +} From 7b309c2624502eb6fb42ad9e1423f6e2f43ec0fd Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 10 Mar 2022 22:47:18 -0600 Subject: [PATCH 03/14] Refactor sleeve stats row to JSX element --- src/PersonObjects/Sleeve/ui/StatsElement.tsx | 87 +++++++++----------- 1 file changed, 41 insertions(+), 46 deletions(-) diff --git a/src/PersonObjects/Sleeve/ui/StatsElement.tsx b/src/PersonObjects/Sleeve/ui/StatsElement.tsx index 8a3e1197d..d21352fbf 100644 --- a/src/PersonObjects/Sleeve/ui/StatsElement.tsx +++ b/src/PersonObjects/Sleeve/ui/StatsElement.tsx @@ -25,13 +25,14 @@ interface ITableRowData { exp?: number; } -export const generateTableRow = ( - name: string, - color: string, - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - classes: any, - data: ITableRowData -): React.ReactElement => { +interface IStatsRowProps { + name: string; + color: string; + classes: any; + data: ITableRowData; +} + +export const SleeveStatsRow = ({ name, color, classes, data }: IStatsRowProps): React.ReactElement => { let content; if (data.content !== undefined) { @@ -66,50 +67,44 @@ export function StatsElement(props: IProps): React.ReactElement { return ( - {generateTableRow("City", Settings.theme.primary, classes, { - content: props.sleeve.city - })} - {generateTableRow("HP", Settings.theme.hp, classes, { - content: `${numeralWrapper.formatHp(props.sleeve.hp)} / ${numeralWrapper.formatHp(props.sleeve.max_hp)}` - })} - {generateTableRow("Hacking", Settings.theme.hack, classes, { - level: props.sleeve.hacking, - exp: props.sleeve.hacking_exp - })} - {generateTableRow("Strength", Settings.theme.combat, classes, { - level: props.sleeve.strength, - exp: props.sleeve.strength_exp - })} - {generateTableRow("Defense", Settings.theme.combat, classes, { - level: props.sleeve.defense, - exp: props.sleeve.defense_exp - })} - {generateTableRow("Dexterity", Settings.theme.combat, classes, { - level: props.sleeve.dexterity, - exp: props.sleeve.dexterity_exp - })} - {generateTableRow("Agility", Settings.theme.combat, classes, { - level: props.sleeve.agility, - exp: props.sleeve.agility_exp - })} - {generateTableRow("Charisma", Settings.theme.cha, classes, { - level: props.sleeve.charisma, - exp: props.sleeve.charisma_exp - })} + + + + + + + +
- {generateTableRow("Shock", Settings.theme.primary, classes, { - content: numeralWrapper.formatSleeveShock(100 - props.sleeve.shock) - })} - {generateTableRow("Sync", Settings.theme.primary, classes, { - content: numeralWrapper.formatSleeveSynchro(props.sleeve.sync) - })} - {generateTableRow("Memory", Settings.theme.primary, classes, { - content: numeralWrapper.formatSleeveMemory(props.sleeve.memory) - })} + + +
) From 07a61c38a4d0626e6fc5efdac4a6139a5ac28105 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Thu, 10 Mar 2022 23:02:32 -0600 Subject: [PATCH 04/14] Clean up imports --- src/PersonObjects/Sleeve/ui/SleeveElem.tsx | 31 ++++++++++---------- src/PersonObjects/Sleeve/ui/SleeveRoot.tsx | 15 ++++++---- src/PersonObjects/Sleeve/ui/StatsElement.tsx | 11 +++---- 3 files changed, 30 insertions(+), 27 deletions(-) diff --git a/src/PersonObjects/Sleeve/ui/SleeveElem.tsx b/src/PersonObjects/Sleeve/ui/SleeveElem.tsx index 61c9f5cbc..5d73a762d 100644 --- a/src/PersonObjects/Sleeve/ui/SleeveElem.tsx +++ b/src/PersonObjects/Sleeve/ui/SleeveElem.tsx @@ -1,30 +1,29 @@ import React, { useState } from "react"; +import { + Box, + Paper, + Typography, + Button, + Tooltip +} from "@mui/material"; + +import { CONSTANTS } from "../../../Constants"; +import { Crimes } from "../../../Crime/Crimes"; +import { numeralWrapper } from "../../../ui/numeralFormat"; +import { createProgressBarText } from "../../../utils/helpers/createProgressBarText"; +import { use } from "../../../ui/Context"; +import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum"; + import { Sleeve } from "../Sleeve"; import { SleeveTaskType } from "../SleeveTaskTypesEnum"; -import { CONSTANTS } from "../../../Constants"; - -import { Crimes } from "../../../Crime/Crimes"; - -import { numeralWrapper } from "../../../ui/numeralFormat"; - -import { createProgressBarText } from "../../../utils/helpers/createProgressBarText"; - import { SleeveAugmentationsModal } from "./SleeveAugmentationsModal"; import { TravelModal } from "./TravelModal"; -import { use } from "../../../ui/Context"; import { StatsElement, EarningsElement } from "./StatsElement"; import { MoreStatsModal } from "./MoreStatsModal"; import { MoreEarningsModal } from "./MoreEarningsModal"; import { TaskSelector } from "./TaskSelector"; -import { FactionWorkType } from "../../../Faction/FactionWorkTypeEnum"; - -import Typography from "@mui/material/Typography"; -import Paper from "@mui/material/Paper"; -import { Box } from "@mui/material"; -import Button from "@mui/material/Button"; -import Tooltip from "@mui/material/Tooltip"; interface IProps { sleeve: Sleeve; diff --git a/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx b/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx index a41a59e87..c1ea67251 100644 --- a/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx +++ b/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx @@ -1,13 +1,16 @@ import React, { useState, useEffect } from "react"; +import { + Box, + Typography, + Button, + Link +} from "@mui/material"; + +import { use } from "../../../ui/Context"; + import { SleeveElem } from "./SleeveElem"; import { FAQModal } from "./FAQModal"; -import { use } from "../../../ui/Context"; - -import Typography from "@mui/material/Typography"; -import Button from "@mui/material/Button"; -import Link from "@mui/material/Link"; -import { Box } from "@mui/material"; export function SleeveRoot(): React.ReactElement { const player = use.Player(); diff --git a/src/PersonObjects/Sleeve/ui/StatsElement.tsx b/src/PersonObjects/Sleeve/ui/StatsElement.tsx index d21352fbf..c28b898d1 100644 --- a/src/PersonObjects/Sleeve/ui/StatsElement.tsx +++ b/src/PersonObjects/Sleeve/ui/StatsElement.tsx @@ -1,24 +1,25 @@ -import { Sleeve } from "../Sleeve"; -import { numeralWrapper } from "../../../ui/numeralFormat"; import React from "react"; -import Typography from "@mui/material/Typography"; + import { + Typography, Table, TableBody, TableCell, TableRow, } from "@mui/material"; +import { numeralWrapper } from "../../../ui/numeralFormat"; import { Settings } from "../../../Settings/Settings"; import { formatNumber } from "../../../utils/StringHelperFunctions"; import { characterOverviewStyles as useStyles } from "../../../ui/React/CharacterOverview"; - import { Money } from "../../../ui/React/Money"; import { MoneyRate } from "../../../ui/React/MoneyRate"; import { ReputationRate } from "../../../ui/React/ReputationRate"; -import { SleeveTaskType } from "../SleeveTaskTypesEnum"; import { use } from "../../../ui/Context"; +import { Sleeve } from "../Sleeve"; +import { SleeveTaskType } from "../SleeveTaskTypesEnum"; + interface ITableRowData { content?: string; level?: number; From 230d68aab218cacd3232863517ca590162b04fe3 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Sat, 12 Mar 2022 15:49:07 -0600 Subject: [PATCH 05/14] Implement common stats row element --- src/Gang/ui/EquipmentsSubpage.tsx | 16 ++-- src/Gang/ui/GangMemberStats.tsx | 36 ++------- src/PersonObjects/Sleeve/ui/StatsElement.tsx | 82 +++----------------- src/ui/React/StatsRow.tsx | 49 ++++++++++++ 4 files changed, 75 insertions(+), 108 deletions(-) create mode 100644 src/ui/React/StatsRow.tsx diff --git a/src/Gang/ui/EquipmentsSubpage.tsx b/src/Gang/ui/EquipmentsSubpage.tsx index b2f53c0d8..664fe9c13 100644 --- a/src/Gang/ui/EquipmentsSubpage.tsx +++ b/src/Gang/ui/EquipmentsSubpage.tsx @@ -3,7 +3,6 @@ */ import React, { useState } from "react"; import { useGang } from "./Context"; -import { generateTableRow } from "./GangMemberStats"; import Typography from "@mui/material/Typography"; import Button from "@mui/material/Button"; @@ -22,7 +21,7 @@ import { GangMember } from "../GangMember"; import { UpgradeType } from "../data/upgrades"; import { use } from "../../ui/Context"; import { Settings } from "../../Settings/Settings"; -import { characterOverviewStyles as useStyles } from "../../ui/React/CharacterOverview"; +import { StatsRow } from "../../ui/React/StatsRow"; interface INextRevealProps { upgrades: string[]; @@ -91,7 +90,6 @@ interface IPanelProps { } function GangMemberUpgradePanel(props: IPanelProps): React.ReactElement { - const classes = useStyles(); const gang = useGang(); const player = use.Player(); const setRerender = useState(false)[1]; @@ -178,12 +176,12 @@ function GangMemberUpgradePanel(props: IPanelProps): React.ReactElement { > - {generateTableRow("Hacking", props.member.hack, props.member.hack_exp, Settings.theme.hack, classes)} - {generateTableRow("Strength", props.member.str, props.member.str_exp, Settings.theme.combat, classes)} - {generateTableRow("Defense", props.member.def, props.member.def_exp, Settings.theme.combat, classes)} - {generateTableRow("Dexterity", props.member.dex, props.member.dex_exp, Settings.theme.combat, classes)} - {generateTableRow("Agility", props.member.agi, props.member.agi_exp, Settings.theme.combat, classes)} - {generateTableRow("Charisma", props.member.cha, props.member.cha_exp, Settings.theme.cha, classes)} + + + + + +
diff --git a/src/Gang/ui/GangMemberStats.tsx b/src/Gang/ui/GangMemberStats.tsx index 859057837..66fe16582 100644 --- a/src/Gang/ui/GangMemberStats.tsx +++ b/src/Gang/ui/GangMemberStats.tsx @@ -17,36 +17,14 @@ import { import { numeralWrapper } from "../../ui/numeralFormat"; import { GangMember } from "../GangMember"; import { Settings } from "../../Settings/Settings"; -import { formatNumber } from "../../utils/StringHelperFunctions"; import { MoneyRate } from "../../ui/React/MoneyRate"; +import { StatsRow } from "../../ui/React/StatsRow"; import { characterOverviewStyles as useStyles } from "../../ui/React/CharacterOverview"; interface IProps { member: GangMember; } -export const generateTableRow = ( - name: string, - level: number, - exp: number, - color: string, - // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types - classes: any -): React.ReactElement => { - return ( - - - {name} - - - - {formatNumber(level, 0)} ({numeralWrapper.formatExp(exp)} exp) - - - - ) -} - export function GangMemberStats(props: IProps): React.ReactElement { const classes = useStyles(); @@ -102,12 +80,12 @@ export function GangMemberStats(props: IProps): React.ReactElement { > - {generateTableRow("Hacking", props.member.hack, props.member.hack_exp, Settings.theme.hack, classes)} - {generateTableRow("Strength", props.member.str, props.member.str_exp, Settings.theme.combat, classes)} - {generateTableRow("Defense", props.member.def, props.member.def_exp, Settings.theme.combat, classes)} - {generateTableRow("Dexterity", props.member.dex, props.member.dex_exp, Settings.theme.combat, classes)} - {generateTableRow("Agility", props.member.agi, props.member.agi_exp, Settings.theme.combat, classes)} - {generateTableRow("Charisma", props.member.cha, props.member.cha_exp, Settings.theme.cha, classes)} + + + + + +
diff --git a/src/PersonObjects/Sleeve/ui/StatsElement.tsx b/src/PersonObjects/Sleeve/ui/StatsElement.tsx index c28b898d1..901348a8e 100644 --- a/src/PersonObjects/Sleeve/ui/StatsElement.tsx +++ b/src/PersonObjects/Sleeve/ui/StatsElement.tsx @@ -10,7 +10,7 @@ import { import { numeralWrapper } from "../../../ui/numeralFormat"; import { Settings } from "../../../Settings/Settings"; -import { formatNumber } from "../../../utils/StringHelperFunctions"; +import { StatsRow } from "../../../ui/React/StatsRow"; import { characterOverviewStyles as useStyles } from "../../../ui/React/CharacterOverview"; import { Money } from "../../../ui/React/Money"; import { MoneyRate } from "../../../ui/React/MoneyRate"; @@ -20,44 +20,6 @@ import { use } from "../../../ui/Context"; import { Sleeve } from "../Sleeve"; import { SleeveTaskType } from "../SleeveTaskTypesEnum"; -interface ITableRowData { - content?: string; - level?: number; - exp?: number; -} - -interface IStatsRowProps { - name: string; - color: string; - classes: any; - data: ITableRowData; -} - -export const SleeveStatsRow = ({ name, color, classes, data }: IStatsRowProps): React.ReactElement => { - let content; - - if (data.content !== undefined) { - content = data.content; - } else if (data.level !== undefined && data.exp !== undefined) { - content = `${formatNumber(data.level, 0)} (${numeralWrapper.formatExp(data.exp)} exp)`; - } else if (data.level !== undefined && data.exp === undefined) { - content = `${formatNumber(data.level, 0)}`; - } - - return ( - - - {name} - - - - {content} - - - - ) -} - interface IProps { sleeve: Sleeve; } @@ -68,44 +30,24 @@ export function StatsElement(props: IProps): React.ReactElement { return (
- - + - - - - - - + + + + + +
- - - + + +
) diff --git a/src/ui/React/StatsRow.tsx b/src/ui/React/StatsRow.tsx new file mode 100644 index 000000000..ce623ccd3 --- /dev/null +++ b/src/ui/React/StatsRow.tsx @@ -0,0 +1,49 @@ +import React from "react"; + +import { + Typography, + TableCell, + TableRow, +} from "@mui/material"; + +import { numeralWrapper } from "../numeralFormat"; +import { formatNumber } from "../../utils/StringHelperFunctions"; +import { characterOverviewStyles as useStyles } from "./CharacterOverview"; + +interface ITableRowData { + content?: string; + level?: number; + exp?: number; +} + +interface IProps { + name: string; + color: string; + classes?: any; + data: ITableRowData; +} + +export const StatsRow = ({ name, color, classes = useStyles(), data }: IProps): React.ReactElement => { + let content; + + if (data.content !== undefined) { + content = data.content; + } else if (data.level !== undefined && data.exp !== undefined) { + content = `${formatNumber(data.level, 0)} (${numeralWrapper.formatExp(data.exp)} exp)`; + } else if (data.level !== undefined && data.exp === undefined) { + content = `${formatNumber(data.level, 0)}`; + } + + return ( + + + {name} + + + + {content} + + + + ) +} From a205f42d88063e36f117511d7c4c8a06c0db1b46 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Wed, 16 Mar 2022 17:35:04 -0500 Subject: [PATCH 06/14] Finalize (?) sleeves --- src/PersonObjects/Sleeve/ui/SleeveRoot.tsx | 36 +++++++++++----------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx b/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx index c1ea67251..5d553a495 100644 --- a/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx +++ b/src/PersonObjects/Sleeve/ui/SleeveRoot.tsx @@ -4,7 +4,7 @@ import { Box, Typography, Button, - Link + Container } from "@mui/material"; import { use } from "../../../ui/Context"; @@ -27,25 +27,25 @@ export function SleeveRoot(): React.ReactElement { return ( <> - Sleeves - - Duplicate Sleeves are MK-V Synthoids (synthetic androids) into which your consciousness has been copied. In - other words, these Synthoids contain a perfect duplicate of your mind. -
-
- Sleeves can be used to perform different tasks synchronously. -
-
-
+ + Sleeves + + Duplicate Sleeves are MK-V Synthoids (synthetic androids) into which your consciousness has been copied. In + other words, these Synthoids contain a perfect duplicate of your mind. +
+
+ Sleeves can be used to perform different tasks synchronously. +
+
+
+ +
- - Documentation - - + + {player.sleeves.map((sleeve, i) => ( ))} From a032ee16be3b0a5942c0ac85590fe7a3a4bd2266 Mon Sep 17 00:00:00 2001 From: nickofolas Date: Wed, 16 Mar 2022 18:20:23 -0500 Subject: [PATCH 07/14] Update gang territory UI --- src/Gang/ui/TerritoryInfoModal.tsx | 54 +++++++++ src/Gang/ui/TerritorySubpage.tsx | 179 ++++++++++++----------------- 2 files changed, 127 insertions(+), 106 deletions(-) create mode 100644 src/Gang/ui/TerritoryInfoModal.tsx diff --git a/src/Gang/ui/TerritoryInfoModal.tsx b/src/Gang/ui/TerritoryInfoModal.tsx new file mode 100644 index 000000000..3c4c74e16 --- /dev/null +++ b/src/Gang/ui/TerritoryInfoModal.tsx @@ -0,0 +1,54 @@ +import React from "react"; + +import Typography from "@mui/material/Typography"; + +import { Modal } from "../../ui/React/Modal"; + +interface IProps { + open: boolean; + onClose: () => void; +} + +export const TerritoryInfoModal = ({ open, onClose }: IProps): React.ReactElement => { + return ( + + <> + + Clashing + + + Every ~20 seconds, your gang has a chance to 'clash' with other gangs. Your chance to win a clash depends on + your gang's power, which is listed in the display below. Your gang's power slowly accumulates over time. The + accumulation rate is determined by the stats of all Gang members you have assigned to the 'Territory Warfare' + task. Gang members that are not assigned to this task do not contribute to your gang's power. Your gang also + loses a small amount of power whenever you lose a clash. +
+
+ NOTE: Gang members assigned to 'Territory Warfare' can be killed during clashes. This can happen regardless of + whether you win or lose the clash. A gang member being killed results in both respect and power loss for your + gang. +
+
+ + Territory + + + The amount of territory you have affects all aspects of your Gang members' production, including money, respect, + and wanted level. It is very beneficial to have high territory control. +
+
+ To increase your chances of winning territory assign gang members to "Territory Warfare", this will build your + gang power. Then enable "Engage in Territory Warfare" to start fighting over territory. +
+
+ + Territory Clash Chance + + + This percentage represents the chance you have of 'clashing' with with another gang. If you do not wish to + gain/lose territory, then keep this percentage at 0% by not engaging in territory warfare. + + +
+ ); +} diff --git a/src/Gang/ui/TerritorySubpage.tsx b/src/Gang/ui/TerritorySubpage.tsx index 434bf1c3e..9a52ea2ab 100644 --- a/src/Gang/ui/TerritorySubpage.tsx +++ b/src/Gang/ui/TerritorySubpage.tsx @@ -1,133 +1,100 @@ /** * React Component for the territory subpage. */ -import React from "react"; +import React, { useState } from "react"; + +import { + Container, + Button, + Paper, + Box, + Tooltip, + Switch, + FormControlLabel, + Typography +} from "@mui/material"; +import { Help } from "@mui/icons-material"; + import { numeralWrapper } from "../../ui/numeralFormat"; import { formatNumber } from "../../utils/StringHelperFunctions"; -import { AllGangs } from "../AllGangs"; -import { useGang } from "./Context"; -import Typography from "@mui/material/Typography"; -import FormControlLabel from "@mui/material/FormControlLabel"; -import Switch from "@mui/material/Switch"; -import Tooltip from "@mui/material/Tooltip"; -import Box from "@mui/material/Box"; -import Paper from "@mui/material/Paper"; +import { AllGangs } from "../AllGangs"; + +import { useGang } from "./Context"; +import { TerritoryInfoModal } from "./TerritoryInfoModal"; export function TerritorySubpage(): React.ReactElement { const gang = useGang(); const gangNames = Object.keys(AllGangs).filter((g) => g != gang.facName); + const [infoOpen, setInfoOpen] = useState(false); return ( - <> + This page shows how much territory your Gang controls. This statistic is listed as a percentage, which represents how much of the total territory you control. -
-
- Every ~20 seconds, your gang has a chance to 'clash' with other gangs. Your chance to win a clash depends on - your gang's power, which is listed in the display below. Your gang's power slowly accumulates over time. The - accumulation rate is determined by the stats of all Gang members you have assigned to the 'Territory Warfare' - task. Gang members that are not assigned to this task do not contribute to your gang's power. Your gang also - loses a small amount of power whenever you lose a clash. -
-
- NOTE: Gang members assigned to 'Territory Warfare' can be killed during clashes. This can happen regardless of - whether you win or lose the clash. A gang member being killed results in both respect and power loss for your - gang. -
-
- The amount of territory you have affects all aspects of your Gang members' production, including money, respect, - and wanted level. It is very beneficial to have high territory control. -
-
- To increase your chances of winning territory assign gang members to "Territory Warfare", this will build your - gang power. Then enable "Engage in Territory Warfare" to start fighting over territory.
- setInfoOpen(true)} sx={{ my: 1 }}> + + About Gang Territory + + + + + {gang.facName} (Your gang) + + + (gang.territoryWarfareEngaged = event.target.checked)} - /> - } - label={ - - Engaging in Territory Warfare sets your clash chance to 100%. Disengaging will cause your clash chance - to gradually decrease until it reaches 0%. - - } - > + />} + label={ + Engaging in Territory Warfare sets your clash chance to 100%. Disengaging will cause your clash chance + to gradually decrease until it reaches 0%. + }> Engage in Territory Warfare - - } - /> -
- - - This percentage represents the chance you have of 'clashing' with with another gang. If you do not wish to - gain/lose territory, then keep this percentage at 0% by not engaging in territory warfare. - - } - > - - Territory Clash Chance: {numeralWrapper.formatPercentage(gang.territoryClashChance, 3)} - - - -
- } /> +
+ (gang.notifyMemberDeath = event.target.checked)} - /> - } - label={ - - If this is enabled, then you will receive a pop-up notifying you whenever one of your Gang Members dies - in a territory clash. - - } - > + />} + label={ + If this is enabled, then you will receive a pop-up notifying you whenever one of your Gang Members dies + in a territory clash. + }> Notify about Gang Member Deaths - - } - /> -
- +
} /> + - - {gang.facName} - -
- Power: {formatNumber(AllGangs[gang.facName].power, 6)} -
- Territory: {formatTerritory(AllGangs[gang.facName].territory)}% -
-
+ Territory Clash Chance: {numeralWrapper.formatPercentage(gang.territoryClashChance, 3)}
+ Power: {formatNumber(AllGangs[gang.facName].power, 3)}
+ Territory: {formatTerritory(AllGangs[gang.facName].territory)}%
+
+ {gangNames.map((name) => ( ))} - - + + setInfoOpen(false)} /> +
); } function formatTerritory(n: number): string { const v = n * 100; + const precision = 3; if (v <= 0) { - return formatNumber(0, 2); + return formatNumber(0, precision); } else if (v >= 100) { - return formatNumber(100, 2); + return formatNumber(100, precision); } else { - return formatNumber(v, 2); + return formatNumber(v, precision); } } @@ -141,15 +108,15 @@ function OtherGangTerritory(props: ITerritoryProps): React.ReactElement { const power = AllGangs[props.name].power; const clashVictoryChance = playerPower / (power + playerPower); return ( - - {props.name} -
- Power: {formatNumber(power, 6)} -
- Territory: {formatTerritory(AllGangs[props.name].territory)}%
- Chance to win clash with this gang: {numeralWrapper.formatPercentage(clashVictoryChance, 3)} -
-
-
+ + + {props.name} + + + Power: {formatNumber(power, 3)}
+ Territory: {formatTerritory(AllGangs[props.name].territory)}%
+ Clash Win Chance: {numeralWrapper.formatPercentage(clashVictoryChance, 3)} +
+
); } From ea61c36790a885870d1be241c9f963642414efbc Mon Sep 17 00:00:00 2001 From: nickofolas Date: Wed, 16 Mar 2022 18:29:15 -0500 Subject: [PATCH 08/14] Modal content proofreading --- src/Gang/ui/TerritoryInfoModal.tsx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Gang/ui/TerritoryInfoModal.tsx b/src/Gang/ui/TerritoryInfoModal.tsx index 3c4c74e16..cbd8640f0 100644 --- a/src/Gang/ui/TerritoryInfoModal.tsx +++ b/src/Gang/ui/TerritoryInfoModal.tsx @@ -37,15 +37,15 @@ export const TerritoryInfoModal = ({ open, onClose }: IProps): React.ReactElemen and wanted level. It is very beneficial to have high territory control.

- To increase your chances of winning territory assign gang members to "Territory Warfare", this will build your - gang power. Then enable "Engage in Territory Warfare" to start fighting over territory. + To increase your chances of winning territory, assign gang members to "Territory Warfare". This will build your + gang power. Then, enable "Engage in Territory Warfare" to start fighting over territory.
Territory Clash Chance - This percentage represents the chance you have of 'clashing' with with another gang. If you do not wish to + This percentage represents the chance you have of 'clashing' with another gang. If you do not wish to gain/lose territory, then keep this percentage at 0% by not engaging in territory warfare. From e46c67a78ac0f6cc39a0e00753817de714d83648 Mon Sep 17 00:00:00 2001 From: parax Date: Fri, 18 Mar 2022 21:58:18 -0600 Subject: [PATCH 09/14] Added NS functions to buy WSE and TIX --- src/NetscriptFunctions/StockMarket.ts | 46 +++++++++++++++++++++- src/ScriptEditor/NetscriptDefinitions.d.ts | 14 +++++++ src/StockMarket/StockMarketCosts.ts | 8 ++++ 3 files changed, 67 insertions(+), 1 deletion(-) diff --git a/src/NetscriptFunctions/StockMarket.ts b/src/NetscriptFunctions/StockMarket.ts index 6f4408855..ad4677b96 100644 --- a/src/NetscriptFunctions/StockMarket.ts +++ b/src/NetscriptFunctions/StockMarket.ts @@ -8,7 +8,7 @@ import { getBuyTransactionCost, getSellTransactionGain } from "../StockMarket/St import { OrderTypes } from "../StockMarket/data/OrderTypes"; import { PositionTypes } from "../StockMarket/data/PositionTypes"; import { StockSymbols } from "../StockMarket/data/StockSymbols"; -import { getStockMarket4SDataCost, getStockMarket4STixApiCost } from "../StockMarket/StockMarketCosts"; +import { getStockMarket4SDataCost, getStockMarket4STixApiCost, getStockMarketWseCost, getStockMarketTixApiCost } from "../StockMarket/StockMarketCosts"; import { Stock } from "../StockMarket/Stock"; import { TIX } from "../ScriptEditor/NetscriptDefinitions"; @@ -388,5 +388,49 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript workerScript.log("stock.purchase4SMarketDataTixApi", () => "Purchased 4S Market Data TIX API"); return true; }, + purchaseWseAccount: function (): boolean { + helper.updateDynamicRam("PurchaseWseAccount", getRamCost(player, "stock", "purchaseWseAccount")); + checkTixApiAccess("purchaseWseAccount"); + + if (player.hasWseAccount) { + workerScript.log("stock.purchaseWseAccount", () => "Already purchased WSE Account"); + return true; + } + + if (player.money < getStockMarketWseCost()) { + workerScript.log( + "stock.purchaseWseAccount", + () => "Not enough money to purchase WSE Account Access", + ); + return false; + } + + player.hasWseAccount = true; + player.loseMoney(getStockMarketWseCost(), "stock"); + workerScript.log("stock.purchaseWseAccount", () => "Purchased WSE Account Access"); + return true; + }, + purchaseTixApi: function (): boolean { + helper.updateDynamicRam("PurchaseTixApi", getRamCost(player, "stock", "purchaseTixApi")); + checkTixApiAccess("purchaseTixApi"); + + if (player.hasTixApiAccess) { + workerScript.log("stock.purchaseTixApi", () => "Already purchased TIX API"); + return true; + } + + if (player.money < getStockMarketTixApiCost()) { + workerScript.log( + "stock.purchaseTixApi", + () => "Not enough money to purchase TIX API Access", + ); + return false; + } + + player.hasTixApiAccess = true; + player.loseMoney(getStockMarketTixApiCost(), "stock"); + workerScript.log("stock.purchaseTixApi", () => "Purchased TIX API"); + return true; + }, }; } diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index d46b1b0f6..c0c75fb8e 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -1506,6 +1506,20 @@ export interface TIX { * @returns True if you successfully purchased it or if you already have access, false otherwise. */ purchase4SMarketDataTixApi(): boolean; + + /** + * Purchase WSE Account. + * @remarks RAM cost: 2.5 GB + * @returns True if you successfully purchased it or if you already have access, false otherwise. + */ + purchaseWseAccount(): boolean; + + /** + * Purchase TIX API Access + * @remarks RAM cost: 2.5 GB + * @returns True if you successfully purchased it or if you already have access, false otherwise. + */ + purchaseTixApi(): boolean; } /** diff --git a/src/StockMarket/StockMarketCosts.ts b/src/StockMarket/StockMarketCosts.ts index 623f382a2..7021fc6fa 100644 --- a/src/StockMarket/StockMarketCosts.ts +++ b/src/StockMarket/StockMarketCosts.ts @@ -8,3 +8,11 @@ export function getStockMarket4SDataCost(): number { export function getStockMarket4STixApiCost(): number { return CONSTANTS.MarketDataTixApi4SCost * BitNodeMultipliers.FourSigmaMarketDataApiCost; } + +export function getStockMarketWseCost(): number { + return CONSTANTS.WSEAccountCost; +} + +export function getStockMarketTixApiCost(): number { + return CONSTANTS.TIXAPICost; +} \ No newline at end of file From daadecb4e66b2348cff98cbb5855810af8f449f4 Mon Sep 17 00:00:00 2001 From: parax Date: Fri, 18 Mar 2022 22:33:22 -0600 Subject: [PATCH 10/14] Removed requirement to already have WSE access --- src/NetscriptFunctions/StockMarket.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/NetscriptFunctions/StockMarket.ts b/src/NetscriptFunctions/StockMarket.ts index ad4677b96..ee48f9ee6 100644 --- a/src/NetscriptFunctions/StockMarket.ts +++ b/src/NetscriptFunctions/StockMarket.ts @@ -390,7 +390,6 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript }, purchaseWseAccount: function (): boolean { helper.updateDynamicRam("PurchaseWseAccount", getRamCost(player, "stock", "purchaseWseAccount")); - checkTixApiAccess("purchaseWseAccount"); if (player.hasWseAccount) { workerScript.log("stock.purchaseWseAccount", () => "Already purchased WSE Account"); @@ -412,7 +411,6 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript }, purchaseTixApi: function (): boolean { helper.updateDynamicRam("PurchaseTixApi", getRamCost(player, "stock", "purchaseTixApi")); - checkTixApiAccess("purchaseTixApi"); if (player.hasTixApiAccess) { workerScript.log("stock.purchaseTixApi", () => "Already purchased TIX API"); From ac38e715aa8662426ea9b1cb9a07436a96cd5710 Mon Sep 17 00:00:00 2001 From: parax Date: Fri, 18 Mar 2022 22:52:09 -0600 Subject: [PATCH 11/14] Fixed Lint Errors --- src/NetscriptFunctions/StockMarket.ts | 2 +- src/ScriptEditor/NetscriptDefinitions.d.ts | 2 +- src/StockMarket/StockMarketCosts.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/NetscriptFunctions/StockMarket.ts b/src/NetscriptFunctions/StockMarket.ts index ee48f9ee6..eafeb76c9 100644 --- a/src/NetscriptFunctions/StockMarket.ts +++ b/src/NetscriptFunctions/StockMarket.ts @@ -411,7 +411,7 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript }, purchaseTixApi: function (): boolean { helper.updateDynamicRam("PurchaseTixApi", getRamCost(player, "stock", "purchaseTixApi")); - + if (player.hasTixApiAccess) { workerScript.log("stock.purchaseTixApi", () => "Already purchased TIX API"); return true; diff --git a/src/ScriptEditor/NetscriptDefinitions.d.ts b/src/ScriptEditor/NetscriptDefinitions.d.ts index c0c75fb8e..ca5a20644 100644 --- a/src/ScriptEditor/NetscriptDefinitions.d.ts +++ b/src/ScriptEditor/NetscriptDefinitions.d.ts @@ -1517,7 +1517,7 @@ export interface TIX { /** * Purchase TIX API Access * @remarks RAM cost: 2.5 GB - * @returns True if you successfully purchased it or if you already have access, false otherwise. + * @returns True if you successfully purchased it or if you already have access, false otherwise. */ purchaseTixApi(): boolean; } diff --git a/src/StockMarket/StockMarketCosts.ts b/src/StockMarket/StockMarketCosts.ts index 7021fc6fa..a8887298d 100644 --- a/src/StockMarket/StockMarketCosts.ts +++ b/src/StockMarket/StockMarketCosts.ts @@ -15,4 +15,4 @@ export function getStockMarketWseCost(): number { export function getStockMarketTixApiCost(): number { return CONSTANTS.TIXAPICost; -} \ No newline at end of file +} From 458f02051f8628ee4ecd2230db2107407d2802b9 Mon Sep 17 00:00:00 2001 From: parax Date: Fri, 18 Mar 2022 23:52:13 -0600 Subject: [PATCH 12/14] Added functions to RamCostGenerator.ts --- src/Netscript/RamCostGenerator.ts | 2 ++ src/NetscriptFunctions/StockMarket.ts | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Netscript/RamCostGenerator.ts b/src/Netscript/RamCostGenerator.ts index 338cbae7d..70a6c2b0f 100644 --- a/src/Netscript/RamCostGenerator.ts +++ b/src/Netscript/RamCostGenerator.ts @@ -181,6 +181,8 @@ export const RamCosts: IMap = { getForecast: RamCostConstants.ScriptBuySellStockRamCost, purchase4SMarketData: RamCostConstants.ScriptBuySellStockRamCost, purchase4SMarketDataTixApi: RamCostConstants.ScriptBuySellStockRamCost, + purchaseWseAccount: RamCostConstants.ScriptBuySellStockRamCost, + purchaseTixApi: RamCostConstants.ScriptBuySellStockRamCost, }, getPurchasedServerLimit: RamCostConstants.ScriptGetPurchasedServerLimit, getPurchasedServerMaxRam: RamCostConstants.ScriptGetPurchasedServerMaxRam, diff --git a/src/NetscriptFunctions/StockMarket.ts b/src/NetscriptFunctions/StockMarket.ts index eafeb76c9..7e0e64f60 100644 --- a/src/NetscriptFunctions/StockMarket.ts +++ b/src/NetscriptFunctions/StockMarket.ts @@ -410,7 +410,7 @@ export function NetscriptStockMarket(player: IPlayer, workerScript: WorkerScript return true; }, purchaseTixApi: function (): boolean { - helper.updateDynamicRam("PurchaseTixApi", getRamCost(player, "stock", "purchaseTixApi")); + helper.updateDynamicRam("purchaseTixApi", getRamCost(player, "stock", "purchaseTixApi")); if (player.hasTixApiAccess) { workerScript.log("stock.purchaseTixApi", () => "Already purchased TIX API"); From bdb4d96f43c065eba80816bf51109b7cc1c4dc27 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sat, 19 Mar 2022 11:19:59 -0400 Subject: [PATCH 13/14] fix tooltip not dissapearing. --- src/Corporation/ui/IndustryOffice.tsx | 29 ++++++++++++++++----------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/src/Corporation/ui/IndustryOffice.tsx b/src/Corporation/ui/IndustryOffice.tsx index 62c6b2205..af04c7591 100644 --- a/src/Corporation/ui/IndustryOffice.tsx +++ b/src/Corporation/ui/IndustryOffice.tsx @@ -431,17 +431,21 @@ export function IndustryOffice(props: IProps): React.ReactElement { Size: {props.office.employees.length} / {props.office.size} employees - - + + Automatically hires an employee and gives him/her a random name}> - + + + Upgrade the office's size so that it can hold more employees!}> - + + + Throw an office party to increase your employee's morale and happiness} > - + + + )} - From cbeb6d13d3b8ebd9c77662047a9b6430e3407c9a Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sat, 19 Mar 2022 11:37:13 -0400 Subject: [PATCH 14/14] fix misnamed factions --- src/Faction/data/FactionNames.ts | 4 +- .../Player/PlayerObjectGeneralMethods.tsx | 72 +++++++++---------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/Faction/data/FactionNames.ts b/src/Faction/data/FactionNames.ts index bd5a068ac..a343b9509 100644 --- a/src/Faction/data/FactionNames.ts +++ b/src/Faction/data/FactionNames.ts @@ -18,8 +18,8 @@ export enum FactionNames { Aevum = "Aevum", Chongqing = "Chongqing", Ishima = "Ishima", - NewTokyo = "NewTokyo", - Sector12 = "Sector12", + NewTokyo = "New Tokyo", + Sector12 = "Sector-12", Volhaven = "Volhaven", SpeakersForTheDead = "Speakers for the Dead", TheDarkArmy = "The Dark Army", diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index 022819b21..968e50cde 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -932,7 +932,9 @@ export function startFactionSecurityWork(this: IPlayer, faction: Faction): void export function workForFaction(this: IPlayer, numCycles: number): boolean { const faction = Factions[this.currentWorkFactionName]; - if (!faction) { return false; } + if (!faction) { + return false; + } //Constantly update the rep gain rate switch (this.factionWorkType) { @@ -1252,12 +1254,7 @@ export function getWorkRepGain(this: IPlayer): number { // } /* Creating a Program */ -export function startCreateProgramWork( - this: IPlayer, - programName: string, - time: number, - reqLevel: number, -): void { +export function startCreateProgramWork(this: IPlayer, programName: string, time: number, reqLevel: number): void { this.resetWorkStatus(); this.isWorking = true; this.workType = CONSTANTS.WorkTypeCreateProgram; @@ -1510,20 +1507,20 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string { if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) { ws.scriptRef.log( "SUCCESS: Crime successful! Gained " + - numeralWrapper.formatMoney(this.workMoneyGained) + - ", " + - numeralWrapper.formatExp(this.workHackExpGained) + - " hack exp, " + - numeralWrapper.formatExp(this.workStrExpGained) + - " str exp, " + - numeralWrapper.formatExp(this.workDefExpGained) + - " def exp, " + - numeralWrapper.formatExp(this.workDexExpGained) + - " dex exp, " + - numeralWrapper.formatExp(this.workAgiExpGained) + - " agi exp, " + - numeralWrapper.formatExp(this.workChaExpGained) + - " cha exp.", + numeralWrapper.formatMoney(this.workMoneyGained) + + ", " + + numeralWrapper.formatExp(this.workHackExpGained) + + " hack exp, " + + numeralWrapper.formatExp(this.workStrExpGained) + + " str exp, " + + numeralWrapper.formatExp(this.workDefExpGained) + + " def exp, " + + numeralWrapper.formatExp(this.workDexExpGained) + + " dex exp, " + + numeralWrapper.formatExp(this.workAgiExpGained) + + " agi exp, " + + numeralWrapper.formatExp(this.workChaExpGained) + + " cha exp.", ); } } else { @@ -1562,18 +1559,18 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string { if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) { ws.scriptRef.log( "FAIL: Crime failed! Gained " + - numeralWrapper.formatExp(this.workHackExpGained) + - " hack exp, " + - numeralWrapper.formatExp(this.workStrExpGained) + - " str exp, " + - numeralWrapper.formatExp(this.workDefExpGained) + - " def exp, " + - numeralWrapper.formatExp(this.workDexExpGained) + - " dex exp, " + - numeralWrapper.formatExp(this.workAgiExpGained) + - " agi exp, " + - numeralWrapper.formatExp(this.workChaExpGained) + - " cha exp.", + numeralWrapper.formatExp(this.workHackExpGained) + + " hack exp, " + + numeralWrapper.formatExp(this.workStrExpGained) + + " str exp, " + + numeralWrapper.formatExp(this.workDefExpGained) + + " def exp, " + + numeralWrapper.formatExp(this.workDexExpGained) + + " dex exp, " + + numeralWrapper.formatExp(this.workAgiExpGained) + + " agi exp, " + + numeralWrapper.formatExp(this.workChaExpGained) + + " cha exp.", ); } } else { @@ -2000,13 +1997,15 @@ export function isQualified(this: IPlayer, company: Company, position: CompanyPo const reqAgility = position.requiredDexterity > 0 ? position.requiredDexterity + offset : 0; const reqCharisma = position.requiredCharisma > 0 ? position.requiredCharisma + offset : 0; - return this.hacking >= reqHacking && + return ( + this.hacking >= reqHacking && this.strength >= reqStrength && this.defense >= reqDefense && this.dexterity >= reqDexterity && this.agility >= reqAgility && this.charisma >= reqCharisma && - company.playerReputation >= position.requiredReputation; + company.playerReputation >= position.requiredReputation + ); } /********** Reapplying Augmentations and Source File ***********/ @@ -2237,7 +2236,8 @@ export function checkForFactionInvitations(this: IPlayer): Faction[] { //Fulcrum Secret Technologies - If u've unlocked fulcrum secret technolgoies server and have a high rep with the company const fulcrumsecrettechonologiesFac = Factions[FactionNames.FulcrumSecretTechnologies]; const fulcrumSecretServer = GetServer(SpecialServers.FulcrumSecretTechnologies); - if (!(fulcrumSecretServer instanceof Server)) throw new Error(`${FactionNames.FulcrumSecretTechnologies} should be normal server`); + if (!(fulcrumSecretServer instanceof Server)) + throw new Error(`${FactionNames.FulcrumSecretTechnologies} should be normal server`); if (fulcrumSecretServer == null) { console.error(`Could not find ${FactionNames.FulcrumSecretTechnologies} Server`); } else if (