UI: Fix #3366 Sleeve UI would sometimes displays the wrong stat while working out.
This commit is contained in:
hydroflame 2022-07-21 16:17:14 -04:00 committed by GitHub
commit e76b5628c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 47 additions and 22 deletions

@ -854,17 +854,22 @@ export class Sleeve extends Person {
// Set stat gain rate // Set stat gain rate
const baseGymExp = 1; const baseGymExp = 1;
const totalExpMultiplier = p.hashManager.getTrainingMult() * expMult; const totalExpMultiplier = p.hashManager.getTrainingMult() * expMult;
const sanitizedStat: string = this.gymStatType.toLowerCase(); switch (this.gymStatType) {
if (sanitizedStat.includes("str")) { case "none": // Note : due to the way Sleeve.workOutAtGym() is currently designed, this should never happend.
this.gainRatesForTask.str = baseGymExp * totalExpMultiplier * this.mults.strength_exp; break;
} else if (sanitizedStat.includes("def")) { case "str":
this.gainRatesForTask.def = baseGymExp * totalExpMultiplier * this.mults.defense_exp; this.gainRatesForTask.str = baseGymExp * totalExpMultiplier * this.strength_exp_mult;
} else if (sanitizedStat.includes("dex")) { break;
this.gainRatesForTask.dex = baseGymExp * totalExpMultiplier * this.mults.dexterity_exp; case "def":
} else if (sanitizedStat.includes("agi")) { this.gainRatesForTask.def = baseGymExp * totalExpMultiplier * this.defense_exp_mult;
this.gainRatesForTask.agi = baseGymExp * totalExpMultiplier * this.mults.agility_exp; 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; return;
} }
@ -1058,19 +1063,27 @@ export class Sleeve extends Person {
// Set experience/money gains based on class // Set experience/money gains based on class
const sanitizedStat: string = stat.toLowerCase(); const sanitizedStat: string = stat.toLowerCase();
// Set cost // set stat to a default value.
this.gainRatesForTask.money = -1 * (CONSTANTS.ClassGymBaseCost * costMult); stat = "none";
if (sanitizedStat.includes("str")) {
// Validate "stat" argument stat = "str";
if ( }
!sanitizedStat.includes("str") && if (sanitizedStat.includes("def")) {
!sanitizedStat.includes("def") && stat = "def";
!sanitizedStat.includes("dex") && }
!sanitizedStat.includes("agi") 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; return false;
} }
// Set cost
this.gainRatesForTask.money = -1 * (CONSTANTS.ClassGymBaseCost * costMult);
this.gymStatType = stat; this.gymStatType = stat;
this.currentTask = SleeveTaskType.Gym; this.currentTask = SleeveTaskType.Gym;

@ -265,8 +265,20 @@ function getABC(sleeve: Sleeve): [string, string, string] {
return ["Commit Crime", sleeve.crimeType, "------"]; return ["Commit Crime", sleeve.crimeType, "------"];
case SleeveTaskType.Class: case SleeveTaskType.Class:
return ["Take University Course", sleeve.className, sleeve.currentTaskLocation]; return ["Take University Course", sleeve.className, sleeve.currentTaskLocation];
case SleeveTaskType.Gym: case SleeveTaskType.Gym: {
return ["Workout at Gym", sleeve.gymStatType, sleeve.currentTaskLocation]; 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: case SleeveTaskType.Bladeburner:
return ["Perform Bladeburner Actions", sleeve.bbAction, sleeve.bbContract]; return ["Perform Bladeburner Actions", sleeve.bbAction, sleeve.bbContract];
case SleeveTaskType.Recovery: case SleeveTaskType.Recovery: