mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-10 09:43:54 +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) {
|
function applyAugmentation(aug, reapply=false) {
|
||||||
Augmentations[aug.name].owned = true;
|
Augmentations[aug.name].owned = true;
|
||||||
|
|
||||||
|
const augObj = Augmentations[aug.name];
|
||||||
|
|
||||||
// Apply multipliers
|
// Apply multipliers
|
||||||
for (const mult in aug.mults) {
|
for (const mult in augObj.mults) {
|
||||||
if (Player[mult] == null) {
|
if (Player[mult] == null) {
|
||||||
console.warn(`Augmentation has unrecognized multiplier property: ${mult}`);
|
console.warn(`Augmentation has unrecognized multiplier property: ${mult}`);
|
||||||
} else {
|
} else {
|
||||||
Player[mult] *= aug.mults[mult];
|
Player[mult] *= augObj.mults[mult];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,8 +137,8 @@ export abstract class Person {
|
|||||||
/**
|
/**
|
||||||
* Augmentations
|
* Augmentations
|
||||||
*/
|
*/
|
||||||
augmentations: string[] = [];
|
augmentations: IPlayerOwnedAugmentation[] = [];
|
||||||
queuedAugmentations: string[] = [];
|
queuedAugmentations: IPlayerOwnedAugmentation[] = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* City that the person is in
|
* City that the person is in
|
||||||
|
@ -31,9 +31,9 @@ export class Resleeve extends Person {
|
|||||||
// Get total base Augmentation cost for this re-sleeve
|
// Get total base Augmentation cost for this re-sleeve
|
||||||
let totalAugmentationCost: number = 0;
|
let totalAugmentationCost: number = 0;
|
||||||
for (let i = 0; i < this.augmentations.length; ++i) {
|
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) {
|
if (aug == null) {
|
||||||
console.error(`Could not find Augmentation ${this.augmentations[i]}`);
|
console.error(`Could not find Augmentation ${this.augmentations[i].name}`);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
totalAugmentationCost += aug!.baseCost;
|
totalAugmentationCost += aug!.baseCost;
|
||||||
|
@ -21,7 +21,7 @@ import { getRandomInt } from "../../../utils/helpers/getRandomInt";
|
|||||||
|
|
||||||
|
|
||||||
// Executes the actual re-sleeve when one is purchased
|
// 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
|
// Set the player's exp
|
||||||
p.hacking_exp = r.hacking_exp;
|
p.hacking_exp = r.hacking_exp;
|
||||||
p.strength_exp = r.strength_exp;
|
p.strength_exp = r.strength_exp;
|
||||||
@ -36,7 +36,7 @@ export function resleeve(r: Resleeve, p: IPlayer) {
|
|||||||
p.augmentations.length = 0;
|
p.augmentations.length = 0;
|
||||||
|
|
||||||
for (let i = 0; i < r.augmentations.length; ++i) {
|
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);
|
p.reapplyAllAugmentations(true);
|
||||||
@ -64,10 +64,14 @@ export function generateResleeves(): Resleeve[] {
|
|||||||
const baseNumAugs: number = Math.ceil((i + 1) / 2);
|
const baseNumAugs: number = Math.ceil((i + 1) / 2);
|
||||||
const numAugs: number = getRandomInt(baseNumAugs, baseNumAugs + 2);
|
const numAugs: number = getRandomInt(baseNumAugs, baseNumAugs + 2);
|
||||||
for (let a = 0; a < numAugs; ++a) {
|
for (let a = 0; a < numAugs; ++a) {
|
||||||
|
// We'll ignore Aug prerequisites for this
|
||||||
const augKeys: string[] = Object.keys(Augmentations);
|
const augKeys: string[] = Object.keys(Augmentations);
|
||||||
|
const randKey: string = augKeys[getRandomInt(0, augKeys.length - 1)];
|
||||||
r.augmentations.push(TODO);
|
const randAug: Augmentation | null = Augmentations[randKey];
|
||||||
|
r.augmentations.push({name: randAug!.name, level: 1});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ret.push(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
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_analysis_mult = 1; //Field Analysis Only
|
||||||
this.bladeburner_success_chance_mult = 1;
|
this.bladeburner_success_chance_mult = 1;
|
||||||
|
|
||||||
// Sleeves
|
// Sleeves & Re-sleeving
|
||||||
this.sleeves = [];
|
this.sleeves = [];
|
||||||
|
this.resleeves = [];
|
||||||
|
|
||||||
//bitnode
|
//bitnode
|
||||||
this.bitNodeN = 1;
|
this.bitNodeN = 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user