mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
Merge pull request #3107 from nickofolas/improvement/aug-page-link
Add shortcut to Faction augmentations page from FactionsRoot
This commit is contained in:
commit
c8e5b8a6e2
@ -24,6 +24,7 @@ import { CovenantPurchasesRoot } from "../../PersonObjects/Sleeve/ui/CovenantPur
|
|||||||
|
|
||||||
type IProps = {
|
type IProps = {
|
||||||
faction: Faction;
|
faction: Faction;
|
||||||
|
augPage: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Info text for all options on the UI
|
// Info text for all options on the UI
|
||||||
@ -188,6 +189,7 @@ export function FactionRoot(props: IProps): React.ReactElement {
|
|||||||
|
|
||||||
const faction = props.faction;
|
const faction = props.faction;
|
||||||
|
|
||||||
|
const [purchasingAugs, setPurchasingAugs] = useState(props.augPage);
|
||||||
if (player && !player.factions.includes(faction.name)) {
|
if (player && !player.factions.includes(faction.name)) {
|
||||||
return <>
|
return <>
|
||||||
<Typography variant="h4" color="primary">
|
<Typography variant="h4" color="primary">
|
||||||
|
@ -41,6 +41,10 @@ export function FactionsRoot(props: IProps): React.ReactElement {
|
|||||||
props.router.toFaction(faction);
|
props.router.toFaction(faction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function openFactionAugPage(faction: Faction): void {
|
||||||
|
props.router.toFaction(faction, true);
|
||||||
|
}
|
||||||
|
|
||||||
function acceptInvitation(event: React.MouseEvent<HTMLButtonElement, MouseEvent>, faction: string): void {
|
function acceptInvitation(event: React.MouseEvent<HTMLButtonElement, MouseEvent>, faction: string): void {
|
||||||
if (!event.isTrusted) return;
|
if (!event.isTrusted) return;
|
||||||
joinFaction(Factions[faction]);
|
joinFaction(Factions[faction]);
|
||||||
@ -61,7 +65,7 @@ export function FactionsRoot(props: IProps): React.ReactElement {
|
|||||||
</Typography>
|
</Typography>
|
||||||
{(props.player.factions.length > 0 && (
|
{(props.player.factions.length > 0 && (
|
||||||
<Paper sx={{ my: 1, p: 1, pb: 0, display: "inline-block" }}>
|
<Paper sx={{ my: 1, p: 1, pb: 0, display: "inline-block" }}>
|
||||||
<Table padding="none">
|
<Table padding="none" style={{ width: "fit-content" }}>
|
||||||
<TableBody>
|
<TableBody>
|
||||||
{props.player.factions.map((faction: string) => (
|
{props.player.factions.map((faction: string) => (
|
||||||
<TableRow key={faction}>
|
<TableRow key={faction}>
|
||||||
@ -76,13 +80,15 @@ export function FactionsRoot(props: IProps): React.ReactElement {
|
|||||||
</Box>
|
</Box>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
<TableCell align="right">
|
<TableCell align="right">
|
||||||
<Typography noWrap ml={10} mb={1}>
|
<Box ml={1} mb={1}>
|
||||||
Augmentations Left: {Factions[faction]
|
<Button sx={{ width: '100%' }} onClick={() => openFactionAugPage(Factions[faction])}>
|
||||||
.augmentations
|
Augmentations Left: {Factions[faction]
|
||||||
.filter((augmentation: string) =>
|
.augmentations
|
||||||
!props.player.hasAugmentation(augmentation))
|
.filter((augmentation: string) =>
|
||||||
.length}
|
!props.player.hasAugmentation(augmentation))
|
||||||
</Typography>
|
.length}
|
||||||
|
</Button>
|
||||||
|
</Box>
|
||||||
</TableCell>
|
</TableCell>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))}
|
))}
|
||||||
|
@ -590,7 +590,7 @@ export function process(this: IPlayer, router: IRouter, numCycles = 1): void {
|
|||||||
if (this.isWorking) {
|
if (this.isWorking) {
|
||||||
if (this.workType == CONSTANTS.WorkTypeFaction) {
|
if (this.workType == CONSTANTS.WorkTypeFaction) {
|
||||||
if (this.workForFaction(numCycles)) {
|
if (this.workForFaction(numCycles)) {
|
||||||
router.toFaction();
|
router.toFaction(Factions[this.currentWorkFactionName]);
|
||||||
}
|
}
|
||||||
} else if (this.workType == CONSTANTS.WorkTypeCreateProgram) {
|
} else if (this.workType == CONSTANTS.WorkTypeCreateProgram) {
|
||||||
if (this.createProgramWork(numCycles)) {
|
if (this.createProgramWork(numCycles)) {
|
||||||
|
@ -223,6 +223,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
|||||||
const [{ files, vim }, setEditorOptions] = useState({ files: {}, vim: false });
|
const [{ files, vim }, setEditorOptions] = useState({ files: {}, vim: false });
|
||||||
const [page, setPage] = useState(determineStartPage(player));
|
const [page, setPage] = useState(determineStartPage(player));
|
||||||
const setRerender = useState(0)[1];
|
const setRerender = useState(0)[1];
|
||||||
|
const [augPage, setAugPage] = useState<boolean>(false);
|
||||||
const [faction, setFaction] = useState<Faction>(
|
const [faction, setFaction] = useState<Faction>(
|
||||||
player.currentWorkFactionName ? Factions[player.currentWorkFactionName] : (undefined as unknown as Faction),
|
player.currentWorkFactionName ? Factions[player.currentWorkFactionName] : (undefined as unknown as Faction),
|
||||||
);
|
);
|
||||||
@ -275,7 +276,8 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
|||||||
toCorporation: () => setPage(Page.Corporation),
|
toCorporation: () => setPage(Page.Corporation),
|
||||||
toCreateProgram: () => setPage(Page.CreateProgram),
|
toCreateProgram: () => setPage(Page.CreateProgram),
|
||||||
toDevMenu: () => setPage(Page.DevMenu),
|
toDevMenu: () => setPage(Page.DevMenu),
|
||||||
toFaction: (faction?: Faction) => {
|
toFaction: (faction: Faction, augPage = false) => {
|
||||||
|
setAugPage(augPage);
|
||||||
setPage(Page.Faction);
|
setPage(Page.Faction);
|
||||||
if (faction) setFaction(faction);
|
if (faction) setFaction(faction);
|
||||||
},
|
},
|
||||||
@ -453,7 +455,7 @@ export function GameRoot({ player, engine, terminal }: IProps): React.ReactEleme
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Page.Faction: {
|
case Page.Faction: {
|
||||||
mainPage = <FactionRoot faction={faction} />;
|
mainPage = <FactionRoot faction={faction} augPage={augPage} />;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Page.Milestones: {
|
case Page.Milestones: {
|
||||||
|
@ -65,7 +65,7 @@ export interface IRouter {
|
|||||||
toCorporation(): void;
|
toCorporation(): void;
|
||||||
toCreateProgram(): void;
|
toCreateProgram(): void;
|
||||||
toDevMenu(): void;
|
toDevMenu(): void;
|
||||||
toFaction(faction?: Faction): void; // faction name
|
toFaction(faction: Faction, augPage?: boolean): void; // faction name
|
||||||
toFactions(): void;
|
toFactions(): void;
|
||||||
toGameOptions(): void;
|
toGameOptions(): void;
|
||||||
toGang(): void;
|
toGang(): void;
|
||||||
|
Loading…
Reference in New Issue
Block a user