mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-20 21:25:47 +01:00
findSleevePurchasableAugs as a class member
This commit is contained in:
parent
dcd9023b93
commit
475a8812bb
@ -1,5 +1,4 @@
|
||||
import { Player } from "../Player";
|
||||
import { findSleevePurchasableAugs } from "../PersonObjects/Sleeve/SleeveHelpers";
|
||||
import { StaticAugmentations } from "../Augmentation/StaticAugmentations";
|
||||
import { CityName } from "../Locations/data/CityNames";
|
||||
import { findCrime } from "../Crime/CrimeHelpers";
|
||||
@ -251,7 +250,7 @@ export function NetscriptSleeve(): InternalAPI<ISleeve> {
|
||||
checkSleeveAPIAccess(ctx);
|
||||
checkSleeveNumber(ctx, sleeveNumber);
|
||||
|
||||
const purchasableAugs = findSleevePurchasableAugs(Player.sleeves[sleeveNumber]);
|
||||
const purchasableAugs = Player.sleeves[sleeveNumber].findPurchasableAugs();
|
||||
const augs = [];
|
||||
for (let i = 0; i < purchasableAugs.length; i++) {
|
||||
const aug = purchasableAugs[i];
|
||||
|
@ -44,6 +44,7 @@ import { SleeveInfiltrateWork } from "./Work/SleeveInfiltrateWork";
|
||||
import { SleeveSupportWork } from "./Work/SleeveSupportWork";
|
||||
import { SleeveBladeburnerWork } from "./Work/SleeveBladeburnerWork";
|
||||
import { SleeveCrimeWork } from "./Work/SleeveCrimeWork";
|
||||
import * as sleeveMethods from "./SleeveMethods";
|
||||
|
||||
export class Sleeve extends Person {
|
||||
currentWork: Work | null = null;
|
||||
@ -79,6 +80,8 @@ export class Sleeve extends Person {
|
||||
this.shockRecovery();
|
||||
}
|
||||
|
||||
findPurchasableAugs = sleeveMethods.findPurchasableAugs;
|
||||
|
||||
shockBonus(): number {
|
||||
return this.shock / 100;
|
||||
}
|
||||
|
@ -10,12 +10,12 @@ import { Multipliers } from "../Multipliers";
|
||||
import { AugmentationNames } from "../../Augmentation/data/AugmentationNames";
|
||||
import { getFactionAugmentationsFiltered } from "../../Faction/FactionHelpers";
|
||||
|
||||
export function findSleevePurchasableAugs(sleeve: Sleeve): Augmentation[] {
|
||||
export function findPurchasableAugs(this: Sleeve): Augmentation[] {
|
||||
// You can only purchase Augmentations that are actually available from
|
||||
// your factions. I.e. you must be in a faction that has the Augmentation
|
||||
// and you must also have enough rep in that faction in order to purchase it.
|
||||
|
||||
const ownedAugNames = sleeve.augmentations.map((e) => e.name);
|
||||
const ownedAugNames = this.augmentations.map((e) => e.name);
|
||||
const availableAugs: Augmentation[] = [];
|
||||
|
||||
// Helper function that helps filter out augs that are already owned
|
||||
@ -85,7 +85,7 @@ export function findSleevePurchasableAugs(sleeve: Sleeve): Augmentation[] {
|
||||
}
|
||||
|
||||
// Add the stanek sleeve aug
|
||||
if (!ownedAugNames.includes(AugmentationNames.ZOE) && p.factions.includes(FactionNames.ChurchOfTheMachineGod)) {
|
||||
if (!ownedAugNames.includes(AugmentationNames.ZOE) && Player.factions.includes(FactionNames.ChurchOfTheMachineGod)) {
|
||||
const aug = StaticAugmentations[AugmentationNames.ZOE];
|
||||
availableAugs.push(aug);
|
||||
}
|
@ -4,7 +4,6 @@ import { PurchasableAugmentations } from "../../../Augmentation/ui/PurchasableAu
|
||||
import { Player } from "../../../Player";
|
||||
import { Modal } from "../../../ui/React/Modal";
|
||||
import { Sleeve } from "../Sleeve";
|
||||
import { findSleevePurchasableAugs } from "../SleeveHelpers";
|
||||
|
||||
interface IProps {
|
||||
open: boolean;
|
||||
@ -29,7 +28,7 @@ export function SleeveAugmentationsModal(props: IProps): React.ReactElement {
|
||||
// You can only purchase Augmentations that are actually available from
|
||||
// your factions. I.e. you must be in a faction that has the Augmentation
|
||||
// and you must also have enough rep in that faction in order to purchase it.
|
||||
const availableAugs = findSleevePurchasableAugs(props.sleeve);
|
||||
const availableAugs = props.sleeve.findPurchasableAugs();
|
||||
|
||||
return (
|
||||
<Modal open={props.open} onClose={props.onClose}>
|
||||
|
Loading…
Reference in New Issue
Block a user