mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 07:33: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
|
||||
*/
|
||||
commitCrime(p: IPlayer, crimeKey: string): boolean {
|
||||
const crime: Crime | null = Crimes[crimeKey];
|
||||
if (!(crime instanceof Crime)) {
|
||||
const crime: Crime | null = Crimes[crimeKey] || Object.values(Crimes).find((crime) => crime.name === crimeKey);
|
||||
if (!crime) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ export class Sleeve extends Person {
|
||||
|
||||
this.currentTaskLocation = String(this.gainRatesForTask.money);
|
||||
|
||||
this.crimeType = crimeKey;
|
||||
this.crimeType = crime.name;
|
||||
this.currentTaskMaxTime = crime.time;
|
||||
this.currentTask = SleeveTaskType.Crime;
|
||||
return true;
|
||||
@ -179,8 +179,8 @@ export class Sleeve extends Person {
|
||||
if (this.currentTask === SleeveTaskType.Crime) {
|
||||
// For crimes, all experience and money is gained at the end
|
||||
if (this.currentTaskTime >= this.currentTaskMaxTime) {
|
||||
const crime: Crime | null = Crimes[this.crimeType];
|
||||
if (!(crime instanceof Crime)) {
|
||||
const crime: Crime | undefined = Object.values(Crimes).find((crime) => crime.name === this.crimeType);
|
||||
if (!crime) {
|
||||
console.error(`Invalid data stored in sleeve.crimeType: ${this.crimeType}`);
|
||||
this.resetTaskStatus();
|
||||
return retValue;
|
||||
|
@ -104,14 +104,17 @@ export function SleeveElem(props: IProps): React.ReactElement {
|
||||
);
|
||||
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 = (
|
||||
<>
|
||||
This sleeve is currently attempting to {Crimes[props.sleeve.crimeType].type} (Success Rate:{" "}
|
||||
{numeralWrapper.formatPercentage(Crimes[props.sleeve.crimeType].successRate(props.sleeve))}).
|
||||
This sleeve is currently attempting to {crime.type} (Success Rate:{" "}
|
||||
{numeralWrapper.formatPercentage(crime.successRate(props.sleeve))}).
|
||||
</>
|
||||
);
|
||||
break;
|
||||
}
|
||||
case SleeveTaskType.Class:
|
||||
desc = <>This sleeve is currently studying/taking a course at {props.sleeve.currentTaskLocation}.</>;
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user