format, lint, more enums, revert fn rename

This commit is contained in:
Snarling
2022-10-05 14:52:48 -04:00
parent a78a84c5b5
commit 068533cd2f
23 changed files with 94 additions and 101 deletions
+3 -3
View File
@@ -66,7 +66,7 @@ import { Factions } from "../Faction/Factions";
import { BitNodeMultipliers } from "../BitNode/BitNodeMultipliers";
import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper";
import { helpers } from "../Netscript/NetscriptHelpers";
import { checkObjContainsValue } from "../utils/helpers/checkObjContains";
import { checkEnum } from "../utils/helpers/checkEnum";
export function NetscriptCorporation(): InternalAPI<NSCorporation> {
function createCorporation(corporationName: string, selfFund = true): boolean {
@@ -712,7 +712,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
const employeeName = helpers.string(ctx, "employeeName", _employeeName);
const job = helpers.string(ctx, "job", _job);
if (!checkObjContainsValue(EmployeePositions, job)) throw new Error(`'${job}' is not a valid job.`);
if (!checkEnum(EmployeePositions, job)) throw new Error(`'${job}' is not a valid job.`);
const office = getOffice(divisionName, cityName);
AssignJob(office, employeeName, job);
@@ -726,7 +726,7 @@ export function NetscriptCorporation(): InternalAPI<NSCorporation> {
const amount = helpers.number(ctx, "amount", _amount);
const job = helpers.string(ctx, "job", _job);
if (!checkObjContainsValue(EmployeePositions,job)) throw new Error(`'${job}' is not a valid job.`);
if (!checkEnum(EmployeePositions, job)) throw new Error(`'${job}' is not a valid job.`);
const office = getOffice(divisionName, cityName);
return AutoAssignJob(office, job, amount);
+2 -2
View File
@@ -14,7 +14,7 @@ import {
import { FactionNames } from "../Faction/data/FactionNames";
import { Factions } from "../Faction/Factions";
import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper";
import { checkObjContainsValue } from "../utils/helpers/checkObjContains";
import { checkEnum } from "../utils/helpers/checkEnum";
import { LocationName } from "../Locations/data/LocationNames";
import { helpers } from "../Netscript/NetscriptHelpers";
@@ -24,7 +24,7 @@ export function NetscriptInfiltration(): InternalAPI<IInfiltration> {
);
const calculateInfiltrationData = (ctx: NetscriptContext, locationName: string): InfiltrationLocation => {
if (!checkObjContainsValue(LocationName, locationName)) throw new Error(`Location '${locationName}' does not exists.`);
if (!checkEnum(LocationName, locationName)) throw new Error(`Location '${locationName}' does not exists.`);
const location = Locations[locationName];
if (location === undefined) throw helpers.makeRuntimeErrorMsg(ctx, `Location '${location}' does not exists.`);
if (location.infiltrationData === undefined)
+2 -2
View File
@@ -11,7 +11,7 @@ import {
SleeveSkills,
SleeveTask,
} from "../ScriptEditor/NetscriptDefinitions";
import { checkObjContainsValue } from "../utils/helpers/checkObjContains";
import { checkEnum } from "../utils/helpers/checkEnum";
import { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper";
import { isSleeveBladeburnerWork } from "../PersonObjects/Sleeve/Work/SleeveBladeburnerWork";
import { isSleeveFactionWork } from "../PersonObjects/Sleeve/Work/SleeveFactionWork";
@@ -102,7 +102,7 @@ export function NetscriptSleeve(): InternalAPI<ISleeve> {
const cityName = helpers.string(ctx, "cityName", _cityName);
checkSleeveAPIAccess(ctx);
checkSleeveNumber(ctx, sleeveNumber);
if (checkObjContainsValue(CityName, cityName)) {
if (checkEnum(CityName, cityName)) {
return Player.sleeves[sleeveNumber].travel(cityName);
} else {
throw helpers.makeRuntimeErrorMsg(ctx, `Invalid city name: '${cityName}'.`);