Factions Augmentation page now lists purchased augmentation separatly.

This commit is contained in:
Olivier Gagnon 2021-03-21 18:03:16 -04:00
parent e8aa1851c5
commit 04bc2bebdd
5 changed files with 44 additions and 28 deletions

@ -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.

@ -6,7 +6,7 @@
import { IMap } from "./types";
export let CONSTANTS: IMap<any> = {
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<any> = {
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.
`
}

@ -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<IProps, IState> {
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<IProps, IState> {
}
}
getAugsSorted() {
getAugsSorted(): string[] {
switch (Settings.PurchaseAugmentationsOrder) {
case PurchaseAugmentationsOrderSetting.Cost: {
return this.getAugsSortedByCost();
@ -73,7 +74,7 @@ export class AugmentationsPage extends React.Component<IProps, IState> {
}
}
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<IProps, IState> {
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<IProps, IState> {
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<IProps, IState> {
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 (
<PurchaseableAugmentation
augName={aug}
faction={this.props.faction}
faction={parent.props.faction}
key={aug}
p={this.props.p}
rerender={this.rerender}
p={parent.props.p}
rerender={parent.rerender}
/>
)
});
}
const augListElems = purchasable.map(aug => purchaseableAugmentation(aug));
let ownedElem = <></>
const owned = augs.filter((aug: string) => !purchasable.includes(aug));
if (owned.length !== 0) {
ownedElem = <>
<br />
<h2>Purchased Augmentations</h2>
<p style={infoStyleMarkup}>
This factions also offers these augmentations but you already own them.
</p>
{owned.map(aug => purchaseableAugmentation(aug))}
</>
}
return (
<div>
@ -156,7 +179,8 @@ export class AugmentationsPage extends React.Component<IProps, IState> {
text={"Sort by Default Order"}
/>
<br />
{augList}
{augListElems}
{ownedElem}
</div>
)
}

@ -114,7 +114,6 @@ export class PurchaseableAugmentation extends React.Component<IProps, any> {
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 {

@ -13,7 +13,7 @@ export function StatsTable(rows: any[][], title: string | null): React.ReactElem
return <tr key={row[0]}>
{row.map((elem: any, i: number) => {
let style = {};
if (i !== 0) style = {textAlign: 'right'};
if (i !== 0) style = {textAlign: 'right', paddingLeft: '.25em'};
return <td key={i} style={style}>{elem}</td>
})}
</tr>