Merge pull request #3997 from danielyxie/dev

trying to fix int problems
This commit is contained in:
hydroflame 2022-08-18 14:42:47 -03:00 committed by GitHub
commit dcdf8f7752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 167 additions and 5 deletions

2
dist/main.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

@ -88,8 +88,8 @@ export const CONSTANTS: {
Donations: number; // number of blood/plasma/palette donation the dev have verified., boosts NFG
LatestUpdate: string;
} = {
VersionString: "2.0.1",
VersionNumber: 24,
VersionString: "2.0.2",
VersionNumber: 25,
// Speed (in ms) at which the main loop is updated
_idleSpeed: 200,

@ -410,7 +410,7 @@ export function gainIntelligenceExp(this: IPerson, exp: number): void {
console.error("ERROR: NaN passed into Player.gainIntelligenceExp()");
return;
}
if (Player.sourceFileLvl(5) > 0 || this.skills.intelligence > 0) {
if (Player.sourceFileLvl(5) > 0 || this.skills.intelligence > 0 || Player.bitNodeN === 5) {
this.exp.intelligence += exp;
this.skills.intelligence = Math.floor(this.calculateSkill(this.exp.intelligence, 1));
}

@ -494,6 +494,168 @@ function evaluateVersionCompatibility(ver: string | number): void {
if (ver < 24) {
Player.getHomeComputer().scripts.forEach((s) => s.filename.endsWith(".ns") && (s.filename += ".js"));
}
if (ver < 25) {
const removePlayerFields = [
"hacking_chance_mult",
"hacking_speed_mult",
"hacking_money_mult",
"hacking_grow_mult",
"hacking_mult",
"strength_mult",
"defense_mult",
"dexterity_mult",
"agility_mult",
"charisma_mult",
"hacking_exp_mult",
"strength_exp_mult",
"defense_exp_mult",
"dexterity_exp_mult",
"agility_exp_mult",
"charisma_exp_mult",
"company_rep_mult",
"faction_rep_mult",
"crime_money_mult",
"crime_success_mult",
"work_money_mult",
"hacknet_node_money_mult",
"hacknet_node_purchase_cost_mult",
"hacknet_node_ram_cost_mult",
"hacknet_node_core_cost_mult",
"hacknet_node_level_cost_mult",
"bladeburner_max_stamina_mult",
"bladeburner_stamina_gain_mult",
"bladeburner_analysis_mult",
"bladeburner_success_chance_mult",
"hacking_exp",
"strength_exp",
"defense_exp",
"dexterity_exp",
"agility_exp",
"charisma_exp",
"intelligence_exp",
"companyName",
"isWorking",
"workType",
"workCostMult",
"workExpMult",
"currentWorkFactionName",
"currentWorkFactionDescription",
"workHackExpGainRate",
"workStrExpGainRate",
"workDefExpGainRate",
"workDexExpGainRate",
"workAgiExpGainRate",
"workChaExpGainRate",
"workRepGainRate",
"workMoneyGainRate",
"workMoneyLossRate",
"workHackExpGained",
"workStrExpGained",
"workDefExpGained",
"workDexExpGained",
"workAgiExpGained",
"workChaExpGained",
"workRepGained",
"workMoneyGained",
"createProgramName",
"createProgramReqLvl",
"graftAugmentationName",
"timeWorkedGraftAugmentation",
"className",
"crimeType",
"timeWorked",
"timeWorkedCreateProgram",
"timeNeededToCompleteWork",
"factionWorkType",
"committingCrimeThruSingFn",
"singFnCrimeWorkerScript",
"hacking",
"max_hp",
"strength",
"defense",
"dexterity",
"agility",
"charisma",
"intelligence",
];
const removeSleeveFields = [
"gymStatType",
"bbAction",
"bbContract",
"hacking",
"strength",
"defense",
"dexterity",
"agility",
"charisma",
"intelligence",
"max_hp",
"hacking_exp",
"strength_exp",
"defense_exp",
"dexterity_exp",
"agility_exp",
"charisma_exp",
"intelligence_exp",
"hacking_mult",
"strength_mult",
"defense_mult",
"dexterity_mult",
"agility_mult",
"charisma_mult",
"hacking_exp_mult",
"strength_exp_mult",
"defense_exp_mult",
"dexterity_exp_mult",
"agility_exp_mult",
"charisma_exp_mult",
"hacking_chance_mult",
"hacking_speed_mult",
"hacking_money_mult",
"hacking_grow_mult",
"company_rep_mult",
"faction_rep_mult",
"crime_money_mult",
"crime_success_mult",
"work_money_mult",
"hacknet_node_money_mult",
"hacknet_node_purchase_cost_mult",
"hacknet_node_ram_cost_mult",
"hacknet_node_core_cost_mult",
"hacknet_node_level_cost_mult",
"bladeburner_max_stamina_mult",
"bladeburner_stamina_gain_mult",
"bladeburner_analysis_mult",
"bladeburner_success_chance_mult",
"className",
"crimeType",
"currentTask",
"currentTaskLocation",
"currentTaskMaxTime",
"currentTaskTime",
"earningsForSleeves",
"earningsForPlayer",
"earningsForTask",
"factionWorkType",
"gainRatesForTask",
"logs",
];
let intExp = Number(anyPlayer.intelligence_exp);
if (isNaN(intExp)) intExp = 0;
anyPlayer.exp.intelligence += intExp;
for (const field of removePlayerFields) {
delete anyPlayer[field];
}
for (const sleeve of anyPlayer.sleeves) {
const anySleeve = sleeve as any;
let intExp = Number(anySleeve.intelligence_exp);
if (isNaN(intExp)) intExp = 0;
anySleeve.exp.intelligence += intExp;
for (const field of removeSleeveFields) {
delete sleeve[field];
}
}
}
}
}