mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 23:53:48 +01:00
fix sleeve criming
This commit is contained in:
parent
c4f59d4129
commit
e52eff7771
24
dist/vendor.bundle.js
vendored
24
dist/vendor.bundle.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -143,8 +143,8 @@ export class Sleeve extends Person {
|
|||||||
* Commit crimes
|
* Commit crimes
|
||||||
*/
|
*/
|
||||||
commitCrime(p: IPlayer, crimeKey: string): boolean {
|
commitCrime(p: IPlayer, crimeKey: string): boolean {
|
||||||
const crime: Crime | null = Crimes[crimeKey];
|
const crime: Crime | null = Crimes[crimeKey] || Object.values(Crimes).find((crime) => crime.name === crimeKey);
|
||||||
if (!(crime instanceof Crime)) {
|
if (!crime) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,7 +164,7 @@ export class Sleeve extends Person {
|
|||||||
|
|
||||||
this.currentTaskLocation = String(this.gainRatesForTask.money);
|
this.currentTaskLocation = String(this.gainRatesForTask.money);
|
||||||
|
|
||||||
this.crimeType = crimeKey;
|
this.crimeType = crime.name;
|
||||||
this.currentTaskMaxTime = crime.time;
|
this.currentTaskMaxTime = crime.time;
|
||||||
this.currentTask = SleeveTaskType.Crime;
|
this.currentTask = SleeveTaskType.Crime;
|
||||||
return true;
|
return true;
|
||||||
@ -179,8 +179,8 @@ export class Sleeve extends Person {
|
|||||||
if (this.currentTask === SleeveTaskType.Crime) {
|
if (this.currentTask === SleeveTaskType.Crime) {
|
||||||
// For crimes, all experience and money is gained at the end
|
// For crimes, all experience and money is gained at the end
|
||||||
if (this.currentTaskTime >= this.currentTaskMaxTime) {
|
if (this.currentTaskTime >= this.currentTaskMaxTime) {
|
||||||
const crime: Crime | null = Crimes[this.crimeType];
|
const crime: Crime | undefined = Object.values(Crimes).find((crime) => crime.name === this.crimeType);
|
||||||
if (!(crime instanceof Crime)) {
|
if (!crime) {
|
||||||
console.error(`Invalid data stored in sleeve.crimeType: ${this.crimeType}`);
|
console.error(`Invalid data stored in sleeve.crimeType: ${this.crimeType}`);
|
||||||
this.resetTaskStatus();
|
this.resetTaskStatus();
|
||||||
return retValue;
|
return retValue;
|
||||||
|
@ -104,14 +104,17 @@ export function SleeveElem(props: IProps): React.ReactElement {
|
|||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SleeveTaskType.Crime:
|
case SleeveTaskType.Crime: {
|
||||||
|
const crime = Object.values(Crimes).find((crime) => crime.name === props.sleeve.crimeType);
|
||||||
|
if (!crime) throw new Error("crime should not be undefined");
|
||||||
desc = (
|
desc = (
|
||||||
<>
|
<>
|
||||||
This sleeve is currently attempting to {Crimes[props.sleeve.crimeType].type} (Success Rate:{" "}
|
This sleeve is currently attempting to {crime.type} (Success Rate:{" "}
|
||||||
{numeralWrapper.formatPercentage(Crimes[props.sleeve.crimeType].successRate(props.sleeve))}).
|
{numeralWrapper.formatPercentage(crime.successRate(props.sleeve))}).
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case SleeveTaskType.Class:
|
case SleeveTaskType.Class:
|
||||||
desc = <>This sleeve is currently studying/taking a course at {props.sleeve.currentTaskLocation}.</>;
|
desc = <>This sleeve is currently studying/taking a course at {props.sleeve.currentTaskLocation}.</>;
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user