Changed skill formatting from numeral to localeStr (#244)

This commit is contained in:
G4mingJon4s 2022-12-04 05:32:39 +01:00 committed by GitHub
parent 633296da15
commit 897a1fbc8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 30 deletions

@ -44,7 +44,7 @@ import { workerScripts } from "./Netscript/WorkerScripts";
import { WorkerScript } from "./Netscript/WorkerScript"; import { WorkerScript } from "./Netscript/WorkerScript";
import { helpers, assertObjectType } from "./Netscript/NetscriptHelpers"; import { helpers, assertObjectType } from "./Netscript/NetscriptHelpers";
import { numeralWrapper } from "./ui/numeralFormat"; import { numeralWrapper } from "./ui/numeralFormat";
import { convertTimeMsToTimeElapsedString } from "./utils/StringHelperFunctions"; import { convertTimeMsToTimeElapsedString, formatNumber } from "./utils/StringHelperFunctions";
import { LogBoxEvents, LogBoxCloserEvents, LogBoxPositionEvents, LogBoxSizeEvents } from "./ui/React/LogBoxManager"; import { LogBoxEvents, LogBoxCloserEvents, LogBoxPositionEvents, LogBoxSizeEvents } from "./ui/React/LogBoxManager";
import { arrayToString } from "./utils/helpers/arrayToString"; import { arrayToString } from "./utils/helpers/arrayToString";
import { isString } from "./utils/helpers/isString"; import { isString } from "./utils/helpers/isString";
@ -1134,10 +1134,7 @@ const base: InternalAPI<NS> = {
if (helpers.failOnHacknetServer(ctx, server)) { if (helpers.failOnHacknetServer(ctx, server)) {
return 1; return 1;
} }
helpers.log( helpers.log(ctx, () => `returned ${formatNumber(server.requiredHackingSkill, 0)} for '${server.hostname}'`);
ctx,
() => `returned ${numeralWrapper.formatSkill(server.requiredHackingSkill)} for '${server.hostname}'`,
);
return server.requiredHackingSkill; return server.requiredHackingSkill;
}, },
getServerMaxMoney: (ctx) => (_hostname) => { getServerMaxMoney: (ctx) => (_hostname) => {

@ -7,7 +7,7 @@ import createStyles from "@mui/styles/createStyles";
import { numeralWrapper } from "../numeralFormat"; import { numeralWrapper } from "../numeralFormat";
import { Reputation } from "./Reputation"; import { Reputation } from "./Reputation";
import { KillScriptsModal } from "./KillScriptsModal"; import { KillScriptsModal } from "./KillScriptsModal";
import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions"; import { convertTimeMsToTimeElapsedString, formatNumber } from "../../utils/StringHelperFunctions";
import Table from "@mui/material/Table"; import Table from "@mui/material/Table";
import TableBody from "@mui/material/TableBody"; import TableBody from "@mui/material/TableBody";
@ -54,9 +54,7 @@ function Intelligence(): React.ReactElement {
<Typography classes={{ root: classes.int }}>Int&nbsp;</Typography> <Typography classes={{ root: classes.int }}>Int&nbsp;</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cell }}> <TableCell align="right" classes={{ root: classes.cell }}>
<Typography classes={{ root: classes.int }}> <Typography classes={{ root: classes.int }}>{formatNumber(Player.skills.intelligence, 0)}</Typography>
{numeralWrapper.formatSkill(Player.skills.intelligence)}
</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cell }}> <TableCell align="right" classes={{ root: classes.cell }}>
<Typography id="overview-int-hook" classes={{ root: classes.int }}> <Typography id="overview-int-hook" classes={{ root: classes.int }}>
@ -350,9 +348,7 @@ export function CharacterOverview({ save, killScripts }: IProps): React.ReactEle
<Typography classes={{ root: classes.hack }}>Hack&nbsp;</Typography> <Typography classes={{ root: classes.hack }}>Hack&nbsp;</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cellNone }}> <TableCell align="right" classes={{ root: classes.cellNone }}>
<Typography classes={{ root: classes.hack }}> <Typography classes={{ root: classes.hack }}>{formatNumber(Player.skills.hacking, 0)}</Typography>
{numeralWrapper.formatSkill(Player.skills.hacking)}
</Typography>
</TableCell> </TableCell>
</TableRow> </TableRow>
<TableRow> <TableRow>
@ -376,9 +372,7 @@ export function CharacterOverview({ save, killScripts }: IProps): React.ReactEle
<Typography classes={{ root: classes.combat }}>Str&nbsp;</Typography> <Typography classes={{ root: classes.combat }}>Str&nbsp;</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cellNone }}> <TableCell align="right" classes={{ root: classes.cellNone }}>
<Typography classes={{ root: classes.combat }}> <Typography classes={{ root: classes.combat }}>{formatNumber(Player.skills.strength, 0)}</Typography>
{numeralWrapper.formatSkill(Player.skills.strength)}
</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cellNone }}> <TableCell align="right" classes={{ root: classes.cellNone }}>
<Typography id="overview-str-hook" classes={{ root: classes.combat }}> <Typography id="overview-str-hook" classes={{ root: classes.combat }}>
@ -397,9 +391,7 @@ export function CharacterOverview({ save, killScripts }: IProps): React.ReactEle
<Typography classes={{ root: classes.combat }}>Def&nbsp;</Typography> <Typography classes={{ root: classes.combat }}>Def&nbsp;</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cellNone }}> <TableCell align="right" classes={{ root: classes.cellNone }}>
<Typography classes={{ root: classes.combat }}> <Typography classes={{ root: classes.combat }}>{formatNumber(Player.skills.defense, 0)}</Typography>
{numeralWrapper.formatSkill(Player.skills.defense)}
</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cellNone }}> <TableCell align="right" classes={{ root: classes.cellNone }}>
<Typography id="overview-def-hook" classes={{ root: classes.combat }}> <Typography id="overview-def-hook" classes={{ root: classes.combat }}>
@ -418,9 +410,7 @@ export function CharacterOverview({ save, killScripts }: IProps): React.ReactEle
<Typography classes={{ root: classes.combat }}>Dex&nbsp;</Typography> <Typography classes={{ root: classes.combat }}>Dex&nbsp;</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cellNone }}> <TableCell align="right" classes={{ root: classes.cellNone }}>
<Typography classes={{ root: classes.combat }}> <Typography classes={{ root: classes.combat }}>{formatNumber(Player.skills.dexterity, 0)}</Typography>
{numeralWrapper.formatSkill(Player.skills.dexterity)}
</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cellNone }}> <TableCell align="right" classes={{ root: classes.cellNone }}>
<Typography id="overview-dex-hook" classes={{ root: classes.combat }}> <Typography id="overview-dex-hook" classes={{ root: classes.combat }}>
@ -439,9 +429,7 @@ export function CharacterOverview({ save, killScripts }: IProps): React.ReactEle
<Typography classes={{ root: classes.combat }}>Agi&nbsp;</Typography> <Typography classes={{ root: classes.combat }}>Agi&nbsp;</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cell }}> <TableCell align="right" classes={{ root: classes.cell }}>
<Typography classes={{ root: classes.combat }}> <Typography classes={{ root: classes.combat }}>{formatNumber(Player.skills.agility, 0)}</Typography>
{numeralWrapper.formatSkill(Player.skills.agility)}
</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cell }}> <TableCell align="right" classes={{ root: classes.cell }}>
<Typography id="overview-agi-hook" classes={{ root: classes.combat }}> <Typography id="overview-agi-hook" classes={{ root: classes.combat }}>
@ -460,9 +448,7 @@ export function CharacterOverview({ save, killScripts }: IProps): React.ReactEle
<Typography classes={{ root: classes.cha }}>Cha&nbsp;</Typography> <Typography classes={{ root: classes.cha }}>Cha&nbsp;</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cellNone }}> <TableCell align="right" classes={{ root: classes.cellNone }}>
<Typography classes={{ root: classes.cha }}> <Typography classes={{ root: classes.cha }}>{formatNumber(Player.skills.charisma, 0)}</Typography>
{numeralWrapper.formatSkill(Player.skills.charisma)}
</Typography>
</TableCell> </TableCell>
<TableCell align="right" classes={{ root: classes.cellNone }}> <TableCell align="right" classes={{ root: classes.cellNone }}>
<Typography id="overview-cha-hook" classes={{ root: classes.cha }}> <Typography id="overview-cha-hook" classes={{ root: classes.cha }}>

@ -27,7 +27,7 @@ import WarningIcon from "@mui/icons-material/Warning";
import { ImportData, saveObject } from "../../SaveObject"; import { ImportData, saveObject } from "../../SaveObject";
import { Settings } from "../../Settings/Settings"; import { Settings } from "../../Settings/Settings";
import { convertTimeMsToTimeElapsedString } from "../../utils/StringHelperFunctions"; import { convertTimeMsToTimeElapsedString, formatNumber } from "../../utils/StringHelperFunctions";
import { numeralWrapper } from "../numeralFormat"; import { numeralWrapper } from "../numeralFormat";
import { ConfirmationModal } from "./ConfirmationModal"; import { ConfirmationModal } from "./ConfirmationModal";
import { pushImportResult } from "../../Electron"; import { pushImportResult } from "../../Electron";
@ -243,8 +243,8 @@ export function ImportSaveRoot(props: IProps): JSX.Element {
<TableRow> <TableRow>
<TableCell>Hacking</TableCell> <TableCell>Hacking</TableCell>
<TableCell>{numeralWrapper.formatSkill(currentData.playerData?.hacking ?? 0)}</TableCell> <TableCell>{formatNumber(currentData.playerData?.hacking ?? 0, 0)}</TableCell>
<TableCell>{numeralWrapper.formatSkill(importData.playerData?.hacking ?? 0)}</TableCell> <TableCell>{formatNumber(importData.playerData?.hacking ?? 0, 0)}</TableCell>
<TableCell> <TableCell>
{importData.playerData?.hacking !== currentData.playerData?.hacking && ( {importData.playerData?.hacking !== currentData.playerData?.hacking && (
<ComparisonIcon <ComparisonIcon