mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-11 02:03:58 +01:00
UI: Fix #3366 Sleeve UI would sometime display the stat in TaskSelector while working out.
fixes #3366 Sleeve.gymStatType will now be constrainded to the following values by Sleeve.workoutAtGym() : "none" , "str", "def", "dex", "agi". (could previously be anything inputted by player through API) Sleeve.updateGainTaskRate() and TaskSelector.tasks's initializer block will now use a switch, expecting one of those value, instead of reevaluating the string. (fixing commit issue)
This commit is contained in:
parent
27bf6cba39
commit
8af4fb1d5a
@ -854,17 +854,22 @@ export class Sleeve extends Person {
|
||||
// Set stat gain rate
|
||||
const baseGymExp = 1;
|
||||
const totalExpMultiplier = p.hashManager.getTrainingMult() * expMult;
|
||||
const sanitizedStat: string = this.gymStatType.toLowerCase();
|
||||
if (sanitizedStat.includes("str")) {
|
||||
this.gainRatesForTask.str = baseGymExp * totalExpMultiplier * this.strength_exp_mult;
|
||||
} else if (sanitizedStat.includes("def")) {
|
||||
this.gainRatesForTask.def = baseGymExp * totalExpMultiplier * this.defense_exp_mult;
|
||||
} else if (sanitizedStat.includes("dex")) {
|
||||
this.gainRatesForTask.dex = baseGymExp * totalExpMultiplier * this.dexterity_exp_mult;
|
||||
} else if (sanitizedStat.includes("agi")) {
|
||||
this.gainRatesForTask.agi = baseGymExp * totalExpMultiplier * this.agility_exp_mult;
|
||||
switch (this.gymStatType) {
|
||||
case "none": // Note : due to the way Sleeve.workOutAtGym() is currently designed, this should never happend.
|
||||
break;
|
||||
case "str":
|
||||
this.gainRatesForTask.str = baseGymExp * totalExpMultiplier * this.strength_exp_mult;
|
||||
break;
|
||||
case "def":
|
||||
this.gainRatesForTask.def = baseGymExp * totalExpMultiplier * this.defense_exp_mult;
|
||||
break;
|
||||
case "dex":
|
||||
this.gainRatesForTask.dex = baseGymExp * totalExpMultiplier * this.dexterity_exp_mult;
|
||||
break;
|
||||
case "agi":
|
||||
this.gainRatesForTask.agi = baseGymExp * totalExpMultiplier * this.agility_exp_mult;
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1058,19 +1063,27 @@ export class Sleeve extends Person {
|
||||
// Set experience/money gains based on class
|
||||
const sanitizedStat: string = stat.toLowerCase();
|
||||
|
||||
// Set cost
|
||||
this.gainRatesForTask.money = -1 * (CONSTANTS.ClassGymBaseCost * costMult);
|
||||
|
||||
// Validate "stat" argument
|
||||
if (
|
||||
!sanitizedStat.includes("str") &&
|
||||
!sanitizedStat.includes("def") &&
|
||||
!sanitizedStat.includes("dex") &&
|
||||
!sanitizedStat.includes("agi")
|
||||
) {
|
||||
// set stat to a default value.
|
||||
stat = "none";
|
||||
if (sanitizedStat.includes("str")) {
|
||||
stat = "str";
|
||||
}
|
||||
if (sanitizedStat.includes("def")) {
|
||||
stat = "def";
|
||||
}
|
||||
if (sanitizedStat.includes("dex")) {
|
||||
stat = "dex";
|
||||
}
|
||||
if (sanitizedStat.includes("agi")) {
|
||||
stat = "agi";
|
||||
}
|
||||
// if stat is still equals its default value, then validation has failed.
|
||||
if (stat === "none") {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Set cost
|
||||
this.gainRatesForTask.money = -1 * (CONSTANTS.ClassGymBaseCost * costMult);
|
||||
this.gymStatType = stat;
|
||||
this.currentTask = SleeveTaskType.Gym;
|
||||
|
||||
|
@ -270,8 +270,20 @@ function getABC(sleeve: Sleeve): [string, string, string] {
|
||||
return ["Commit Crime", sleeve.crimeType, "------"];
|
||||
case SleeveTaskType.Class:
|
||||
return ["Take University Course", sleeve.className, sleeve.currentTaskLocation];
|
||||
case SleeveTaskType.Gym:
|
||||
return ["Workout at Gym", sleeve.gymStatType, sleeve.currentTaskLocation];
|
||||
case SleeveTaskType.Gym: {
|
||||
switch (sleeve.gymStatType) {
|
||||
case "none":
|
||||
return ["Idle", "------", "------"];
|
||||
case "str":
|
||||
return ["Workout at Gym", "Train Strength", sleeve.currentTaskLocation];
|
||||
case "def":
|
||||
return ["Workout at Gym", "Train Defense", sleeve.currentTaskLocation];
|
||||
case "dex":
|
||||
return ["Workout at Gym", "Train Dexterity", sleeve.currentTaskLocation];
|
||||
case "agi":
|
||||
return ["Workout at Gym", "Train Agility", sleeve.currentTaskLocation];
|
||||
}
|
||||
}
|
||||
case SleeveTaskType.Bladeburner:
|
||||
return ["Perform Bladeburner Actions", sleeve.bbAction, sleeve.bbContract];
|
||||
case SleeveTaskType.Recovery:
|
||||
|
Loading…
Reference in New Issue
Block a user