Merge pull request #1458 from danielyxie/dev

fix int not calculating
This commit is contained in:
hydroflame 2021-10-11 13:31:20 -04:00 committed by GitHub
commit 0cf1c86d3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 6 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -4610,19 +4610,19 @@ function NetscriptFunctions(workerScript: WorkerScript): NS {
...extra,
};
function getFunctionNames(obj: NS): string[] {
function getFunctionNames(obj: NS, prefix: string): string[] {
const functionNames: string[] = [];
for (const [key, value] of Object.entries(obj)) {
if (typeof value == "function") {
functionNames.push(key);
functionNames.push(prefix + key);
} else if (typeof value == "object") {
functionNames.push(...getFunctionNames(value));
functionNames.push(...getFunctionNames(value, key + "."));
}
}
return functionNames;
}
const possibleLogs = Object.fromEntries([...getFunctionNames(functions)].map((a) => [a, true]));
const possibleLogs = Object.fromEntries([...getFunctionNames(functions, "")].map((a) => [a, true]));
return functions;
} // End NetscriptFunction()

@ -453,6 +453,8 @@ export function gainIntelligenceExp(this: IPlayer, exp: number): void {
if (SourceFileFlags[5] > 0 || this.intelligence > 0) {
this.intelligence_exp += exp;
}
this.intelligence = Math.floor(this.calculateSkill(this.intelligence_exp));
}
//Given a string expression like "str" or "strength", returns the given stat