mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-30 01:47:33 +01:00
Started implementing Resleeving UI
This commit is contained in:
parent
6d8d25e0bb
commit
19f65de555
@ -1991,12 +1991,14 @@ function resetAugmentation(newAugObject) {
|
||||
function applyAugmentation(aug, reapply=false) {
|
||||
Augmentations[aug.name].owned = true;
|
||||
|
||||
const augObj = Augmentations[aug.name];
|
||||
|
||||
// Apply multipliers
|
||||
for (const mult in aug.mults) {
|
||||
for (const mult in augObj.mults) {
|
||||
if (Player[mult] == null) {
|
||||
console.warn(`Augmentation has unrecognized multiplier property: ${mult}`);
|
||||
} else {
|
||||
Player[mult] *= aug.mults[mult];
|
||||
Player[mult] *= augObj.mults[mult];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,8 +137,8 @@ export abstract class Person {
|
||||
/**
|
||||
* Augmentations
|
||||
*/
|
||||
augmentations: string[] = [];
|
||||
queuedAugmentations: string[] = [];
|
||||
augmentations: IPlayerOwnedAugmentation[] = [];
|
||||
queuedAugmentations: IPlayerOwnedAugmentation[] = [];
|
||||
|
||||
/**
|
||||
* City that the person is in
|
||||
|
@ -31,9 +31,9 @@ export class Resleeve extends Person {
|
||||
// Get total base Augmentation cost for this re-sleeve
|
||||
let totalAugmentationCost: number = 0;
|
||||
for (let i = 0; i < this.augmentations.length; ++i) {
|
||||
const aug: Augmentation | null = Augmentations[this.augmentations[i]];
|
||||
const aug: Augmentation | null = Augmentations[this.augmentations[i].name];
|
||||
if (aug == null) {
|
||||
console.error(`Could not find Augmentation ${this.augmentations[i]}`);
|
||||
console.error(`Could not find Augmentation ${this.augmentations[i].name}`);
|
||||
continue;
|
||||
}
|
||||
totalAugmentationCost += aug!.baseCost;
|
||||
|
@ -21,7 +21,7 @@ import { getRandomInt } from "../../../utils/helpers/getRandomInt";
|
||||
|
||||
|
||||
// Executes the actual re-sleeve when one is purchased
|
||||
export function resleeve(r: Resleeve, p: IPlayer) {
|
||||
export function resleeve(r: Resleeve, p: IPlayer):void {
|
||||
// Set the player's exp
|
||||
p.hacking_exp = r.hacking_exp;
|
||||
p.strength_exp = r.strength_exp;
|
||||
@ -36,7 +36,7 @@ export function resleeve(r: Resleeve, p: IPlayer) {
|
||||
p.augmentations.length = 0;
|
||||
|
||||
for (let i = 0; i < r.augmentations.length; ++i) {
|
||||
p.augmentations.push(new PlayerOwnedAugmentation(r.augmentations[i]));
|
||||
p.augmentations.push(new PlayerOwnedAugmentation(r.augmentations[i].name));
|
||||
}
|
||||
|
||||
p.reapplyAllAugmentations(true);
|
||||
@ -64,10 +64,14 @@ export function generateResleeves(): Resleeve[] {
|
||||
const baseNumAugs: number = Math.ceil((i + 1) / 2);
|
||||
const numAugs: number = getRandomInt(baseNumAugs, baseNumAugs + 2);
|
||||
for (let a = 0; a < numAugs; ++a) {
|
||||
// We'll ignore Aug prerequisites for this
|
||||
const augKeys: string[] = Object.keys(Augmentations);
|
||||
|
||||
r.augmentations.push(TODO);
|
||||
const randKey: string = augKeys[getRandomInt(0, augKeys.length - 1)];
|
||||
const randAug: Augmentation | null = Augmentations[randKey];
|
||||
r.augmentations.push({name: randAug!.name, level: 1});
|
||||
}
|
||||
|
||||
ret.push(r);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
19
src/PersonObjects/Resleeving/ResleevingUI.ts
Normal file
19
src/PersonObjects/Resleeving/ResleevingUI.ts
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Module for handling the Re-sleeving UI
|
||||
*/
|
||||
import { Resleeve } from "./Resleeve";
|
||||
import { generateResleeves,
|
||||
resleeve } from "./Resleeving";
|
||||
|
||||
import { IMap } from "../../types";
|
||||
|
||||
import { numeralWrapper } from "../../ui/numeralFormat";
|
||||
import { Page,
|
||||
routing } from "../../ui/navigationTracking";
|
||||
|
||||
import { createElement } from "../../../utils/uiHelpers/createElement";
|
||||
import { createOptionElement } from "../../../utils/uiHelpers/createOptionElement";
|
||||
import { getSelectValue } from "../../../utils/uiHelpers/getSelectData";
|
||||
import { removeChildrenFromElement } from "../../../utils/uiHelpers/removeChildrenFromElement";
|
||||
import { removeElement } from "../../../utils/uiHelpers/removeElement";
|
||||
import { removeElementById } from "../../../utils/uiHelpers/removeElementById";
|
@ -195,8 +195,9 @@ function PlayerObject() {
|
||||
this.bladeburner_analysis_mult = 1; //Field Analysis Only
|
||||
this.bladeburner_success_chance_mult = 1;
|
||||
|
||||
// Sleeves
|
||||
// Sleeves & Re-sleeving
|
||||
this.sleeves = [];
|
||||
this.resleeves = [];
|
||||
|
||||
//bitnode
|
||||
this.bitNodeN = 1;
|
||||
|
Loading…
Reference in New Issue
Block a user