From 04bc2bebdd5ac5fd7a50a0727d593a774cae3150 Mon Sep 17 00:00:00 2001 From: Olivier Gagnon Date: Sun, 21 Mar 2021 18:03:16 -0400 Subject: [PATCH] Factions Augmentation page now lists purchased augmentation separatly. --- doc/source/conf.py | 4 +- src/Constants.ts | 15 ++----- src/Faction/ui/AugmentationsPage.tsx | 50 +++++++++++++++------ src/Faction/ui/PurchaseableAugmentation.tsx | 1 - src/ui/React/StatsTable.tsx | 2 +- 5 files changed, 44 insertions(+), 28 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index 14a3cb32d..6a6a115f5 100644 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -64,9 +64,9 @@ documentation_title = '{0} Documentation'.format(project) # built documents. # # The short X.Y version. -version = '0.47' +version = '0.50' # The full version, including alpha/beta/rc tags. -release = '0.47.0' +release = '0.50.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/src/Constants.ts b/src/Constants.ts index 88b1c8c7f..ef96e0c41 100644 --- a/src/Constants.ts +++ b/src/Constants.ts @@ -6,7 +6,7 @@ import { IMap } from "./types"; export let CONSTANTS: IMap = { - Version: "0.50.0", + Version: "0.5X.X", /** Max level for any skill, assuming no multipliers. Determined by max numerical value in javascript for experience * and the skill level formula in Player.js. Note that all this means it that when experience hits MAX_INT, then @@ -228,20 +228,13 @@ export let CONSTANTS: IMap = { LatestUpdate: ` - v0.50.0 - 2021-03-20 Intelligence (hydroflame) + v0.5X.X - 2021-XX-XX TITLE (hydroflame) ------- - Intelligence - * int exp gain and effect has been reworked. It is now much more easy to - acquire and far more powerful. The goal here is to feel like players have - another tool in their arsenal. Factions - * Hacking factions no longer have hacking level requirements since their associated servers do. + * Augmentations offered by a Faction but already bought are in a separate list at the bottom of the page. Misc. - * Sleeve styling. - * number formatting - * remove wiki button in Hacking Missions. - * Fix NaN displayed when very very large numbers are reached. + * Minor spacing in stats tables. ` } diff --git a/src/Faction/ui/AugmentationsPage.tsx b/src/Faction/ui/AugmentationsPage.tsx index 017e6e873..c950c8291 100644 --- a/src/Faction/ui/AugmentationsPage.tsx +++ b/src/Faction/ui/AugmentationsPage.tsx @@ -6,6 +6,7 @@ import * as React from "react"; import { PurchaseableAugmentation } from "./PurchaseableAugmentation"; import { Augmentations } from "../../Augmentation/Augmentations"; +import { AugmentationNames } from "../../Augmentation/data/AugmentationNames"; import { Faction } from "../../Faction/Faction"; import { IPlayer } from "../../PersonObjects/IPlayer"; import { PurchaseAugmentationsOrderSetting } from "../../Settings/SettingEnums"; @@ -44,7 +45,7 @@ export class AugmentationsPage extends React.Component { this.rerender = this.rerender.bind(this); } - getAugs() { + getAugs(): string[] { if (this.isPlayersGang) { const augs: string[] = []; for (const augName in Augmentations) { @@ -60,7 +61,7 @@ export class AugmentationsPage extends React.Component { } } - getAugsSorted() { + getAugsSorted(): string[] { switch (Settings.PurchaseAugmentationsOrder) { case PurchaseAugmentationsOrderSetting.Cost: { return this.getAugsSortedByCost(); @@ -73,7 +74,7 @@ export class AugmentationsPage extends React.Component { } } - getAugsSortedByCost() { + getAugsSortedByCost(): string[] { const augs = this.getAugs(); augs.sort((augName1, augName2)=>{ var aug1 = Augmentations[augName1], aug2 = Augmentations[augName2]; @@ -87,7 +88,7 @@ export class AugmentationsPage extends React.Component { return augs; } - getAugsSortedByReputation() { + getAugsSortedByReputation(): string[] { const augs = this.getAugs(); augs.sort((augName1, augName2)=>{ var aug1 = Augmentations[augName1], aug2 = Augmentations[augName2]; @@ -100,16 +101,16 @@ export class AugmentationsPage extends React.Component { return augs; } - getAugsSortedByDefault() { + getAugsSortedByDefault(): string[] { return this.getAugs(); } - switchSortOrder(newOrder: PurchaseAugmentationsOrderSetting) { + switchSortOrder(newOrder: PurchaseAugmentationsOrderSetting): void { Settings.PurchaseAugmentationsOrder = newOrder; this.rerender(); } - rerender() { + rerender(): void { this.setState((prevState) => { return { rerenderFlag: !prevState.rerenderFlag, @@ -119,17 +120,39 @@ export class AugmentationsPage extends React.Component { render() { const augs = this.getAugsSorted(); - const augList = augs.map((aug) => { + const purchasable = augs.filter((aug: string) => + aug === AugmentationNames.NeuroFluxGovernor || + (!this.props.p.augmentations.some(a => a.name === aug) && + !this.props.p.queuedAugmentations.some(a => a.name === aug)) + ) + + const parent = this; + function purchaseableAugmentation(aug: string) { return ( ) - }); + } + + const augListElems = purchasable.map(aug => purchaseableAugmentation(aug)); + + let ownedElem = <> + const owned = augs.filter((aug: string) => !purchasable.includes(aug)); + if (owned.length !== 0) { + ownedElem = <> +
+

Purchased Augmentations

+

+ This factions also offers these augmentations but you already own them. +

+ {owned.map(aug => purchaseableAugmentation(aug))} + + } return (
@@ -156,7 +179,8 @@ export class AugmentationsPage extends React.Component { text={"Sort by Default Order"} />
- {augList} + {augListElems} + {ownedElem}
) } diff --git a/src/Faction/ui/PurchaseableAugmentation.tsx b/src/Faction/ui/PurchaseableAugmentation.tsx index 0ac99525c..8db7b09e1 100644 --- a/src/Faction/ui/PurchaseableAugmentation.tsx +++ b/src/Faction/ui/PurchaseableAugmentation.tsx @@ -114,7 +114,6 @@ export class PurchaseableAugmentation extends React.Component { color = "red"; } else if (this.aug.name !== AugmentationNames.NeuroFluxGovernor && (this.aug.owned || this.owned())) { disabled = true; - statusTxt = "ALREADY OWNED"; } else if (this.hasReputation()) { statusTxt = `UNLOCKED - ${numeralWrapper.formatMoney(moneyCost)}`; } else { diff --git a/src/ui/React/StatsTable.tsx b/src/ui/React/StatsTable.tsx index e86aab8a0..9518a9fec 100644 --- a/src/ui/React/StatsTable.tsx +++ b/src/ui/React/StatsTable.tsx @@ -13,7 +13,7 @@ export function StatsTable(rows: any[][], title: string | null): React.ReactElem return {row.map((elem: any, i: number) => { let style = {}; - if (i !== 0) style = {textAlign: 'right'}; + if (i !== 0) style = {textAlign: 'right', paddingLeft: '.25em'}; return {elem} })}