From 4f7199c0bd80de9a0ec6b963b57a03756ee62ea1 Mon Sep 17 00:00:00 2001 From: "tyasuh.taeragan@gmail.com" Date: Fri, 22 Oct 2021 15:30:13 -0400 Subject: [PATCH 1/3] Toasts for Noodles Eaten, Hospitalized. --- src/Hacknet/HacknetServer.ts | 2 ++ src/Locations/ui/SpecialLocation.tsx | 5 +++-- src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx | 9 ++------- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/Hacknet/HacknetServer.ts b/src/Hacknet/HacknetServer.ts index 2736d90de..7ccc4fbec 100644 --- a/src/Hacknet/HacknetServer.ts +++ b/src/Hacknet/HacknetServer.ts @@ -20,6 +20,8 @@ import { createRandomIp } from "../utils/IPAddress"; import { Generic_fromJSON, Generic_toJSON, Reviver } from "../utils/JSONReviver"; + + interface IConstructorParams { adminRights?: boolean; hostname: string; diff --git a/src/Locations/ui/SpecialLocation.tsx b/src/Locations/ui/SpecialLocation.tsx index 70368bd2a..896cf57ca 100644 --- a/src/Locations/ui/SpecialLocation.tsx +++ b/src/Locations/ui/SpecialLocation.tsx @@ -21,6 +21,7 @@ import { LocationName } from "../data/LocationNames"; import { use } from "../../ui/Context"; import { dialogBoxCreate } from "../../ui/React/DialogBox"; +import { SnackbarEvents } from "../../ui/React/Snackbar"; type IProps = { loc: Location; @@ -75,8 +76,8 @@ export function SpecialLocation(props: IProps): React.ReactElement { function renderNoodleBar(): React.ReactElement { function EatNoodles(): void { - dialogBoxCreate(<>You ate some delicious noodles and feel refreshed.); - } + SnackbarEvents.emit("You ate some delicious noodles and feel refreshed", "success"); + } return ; } diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index 5ad736366..166f5509e 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -59,6 +59,7 @@ import { Money } from "../../ui/React/Money"; import React from "react"; import { serverMetadata } from "../../Server/data/servers"; +import { SnackbarEvents } from "../../ui/React/Snackbar"; export function init(this: IPlayer): void { /* Initialize Player's home computer */ @@ -1697,13 +1698,7 @@ export function regenerateHp(this: IPlayer, amt: number): void { export function hospitalize(this: IPlayer): number { const cost = getHospitalizationCost(this); if (Settings.SuppressHospitalizationPopup === false) { - dialogBoxCreate( - <> - You were in critical condition! You were taken to the hospital where luckily they were able to save your life. - You were charged  - - , - ); + SnackbarEvents.emit(`You've been Hospitalized for ${numeralWrapper.formatMoney(cost)}`, "warning"); } this.loseMoney(cost); From b843958110390d86cbfa6337ea52ecc7c58995ab Mon Sep 17 00:00:00 2001 From: "tyasuh.taeragan@gmail.com" Date: Fri, 22 Oct 2021 15:32:44 -0400 Subject: [PATCH 2/3] Typo correction, Toasts to Noodle Bar, Hopsitlized Functions --- src/ui/React/Theme.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/React/Theme.tsx b/src/ui/React/Theme.tsx index ec484206e..1de8608a8 100644 --- a/src/ui/React/Theme.tsx +++ b/src/ui/React/Theme.tsx @@ -302,7 +302,7 @@ export function refreshTheme(): void { border: "1px solid " + Settings.theme.well, }, standardSuccess: { - color: Settings.theme.primaryLight, + color: Settings.theme.primarylight, }, standardError: { color: Settings.theme.errorlight, From 2e7f164b5f251ce457f0d3b9a42cfa0f08ef200e Mon Sep 17 00:00:00 2001 From: "tyasuh.taeragan@gmail.com" Date: Fri, 22 Oct 2021 16:35:05 -0400 Subject: [PATCH 3/3] Prettified --- src/Locations/ui/SpecialLocation.tsx | 62 +++++++++---------- .../Player/PlayerObjectGeneralMethods.tsx | 56 ++++++++--------- 2 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/Locations/ui/SpecialLocation.tsx b/src/Locations/ui/SpecialLocation.tsx index 896cf57ca..bf2e548d0 100644 --- a/src/Locations/ui/SpecialLocation.tsx +++ b/src/Locations/ui/SpecialLocation.tsx @@ -21,7 +21,7 @@ import { LocationName } from "../data/LocationNames"; import { use } from "../../ui/Context"; import { dialogBoxCreate } from "../../ui/React/DialogBox"; -import { SnackbarEvents } from "../../ui/React/Snackbar"; +import { SnackbarEvents } from "../../ui/React/Snackbar"; type IProps = { loc: Location; @@ -77,7 +77,7 @@ export function SpecialLocation(props: IProps): React.ReactElement { function renderNoodleBar(): React.ReactElement { function EatNoodles(): void { SnackbarEvents.emit("You ate some delicious noodles and feel refreshed", "success"); - } + } return ; } @@ -112,35 +112,35 @@ export function SpecialLocation(props: IProps): React.ReactElement { function renderCotMG(): React.ReactElement { // prettier-ignore - const symbol = - {" `` "}
- {" -odmmNmds: "}
- {" `hNmo:..-omNh. "}
- {" yMd` `hNh "}
- {" mMd oNm "}
- {" oMNo .mM/ "}
- {" `dMN+ -mM+ "}
- {" -mMNo -mN+ "}
- {" .+- :mMNo/mN/ "}
- {":yNMd. :NMNNN/ "}
- {"-mMMMh. /NMMh` "}
- {" .dMMMd. /NMMMy` "}
- {" `yMMMd. /NNyNMMh` "}
- {" `sMMMd. +Nm: +NMMh. "}
- {" oMMMm- oNm: /NMMd. "}
- {" +NMMmsMm- :mMMd. "}
- {" /NMMMm- -mMMd. "}
- {" /MMMm- -mMMd. "}
- {" `sMNMMm- .mMmo "}
- {" `sMd:hMMm. ./. "}
- {" `yMy` `yNMd` "}
- {" `hMs` oMMy "}
- {" `hMh sMN- "}
- {" /MM- .NMo "}
- {" +MM: :MM+ "}
- {" sNNo-.`.-omNy` "}
- {" -smNNNNmdo- "}
- {" `..` "}
+ const symbol = + {" `` "}
+ {" -odmmNmds: "}
+ {" `hNmo:..-omNh. "}
+ {" yMd` `hNh "}
+ {" mMd oNm "}
+ {" oMNo .mM/ "}
+ {" `dMN+ -mM+ "}
+ {" -mMNo -mN+ "}
+ {" .+- :mMNo/mN/ "}
+ {":yNMd. :NMNNN/ "}
+ {"-mMMMh. /NMMh` "}
+ {" .dMMMd. /NMMMy` "}
+ {" `yMMMd. /NNyNMMh` "}
+ {" `sMMMd. +Nm: +NMMh. "}
+ {" oMMMm- oNm: /NMMd. "}
+ {" +NMMmsMm- :mMMd. "}
+ {" /NMMMm- -mMMd. "}
+ {" /MMMm- -mMMd. "}
+ {" `sMNMMm- .mMmo "}
+ {" `sMd:hMMm. ./. "}
+ {" `yMy` `yNMd` "}
+ {" `hMs` oMMy "}
+ {" `hMh sMN- "}
+ {" /MM- .NMo "}
+ {" +MM: :MM+ "}
+ {" sNNo-.`.-omNy` "}
+ {" -smNNNNmdo- "}
+ {" `..` "}
return ( <> diff --git a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx index 166f5509e..d31795dac 100644 --- a/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx +++ b/src/PersonObjects/Player/PlayerObjectGeneralMethods.tsx @@ -59,7 +59,7 @@ import { Money } from "../../ui/React/Money"; import React from "react"; import { serverMetadata } from "../../Server/data/servers"; -import { SnackbarEvents } from "../../ui/React/Snackbar"; +import { SnackbarEvents } from "../../ui/React/Snackbar"; export function init(this: IPlayer): void { /* Initialize Player's home computer */ @@ -1531,20 +1531,20 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string { if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) { ws.scriptRef.log( "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 { @@ -1583,18 +1583,18 @@ export function finishCrime(this: IPlayer, cancelled: boolean): string { if (ws.disableLogs.ALL == null && ws.disableLogs.commitCrime == null) { ws.scriptRef.log( "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 { @@ -1698,7 +1698,7 @@ export function regenerateHp(this: IPlayer, amt: number): void { export function hospitalize(this: IPlayer): number { const cost = getHospitalizationCost(this); if (Settings.SuppressHospitalizationPopup === false) { - SnackbarEvents.emit(`You've been Hospitalized for ${numeralWrapper.formatMoney(cost)}`, "warning"); + SnackbarEvents.emit(`You've been Hospitalized for ${numeralWrapper.formatMoney(cost)}`, "warning"); } this.loseMoney(cost);