switch to checkEnum

This commit is contained in:
TheMas3212 2022-04-15 02:07:47 +10:00
parent e07b92a408
commit de3359dfad
No known key found for this signature in database
GPG Key ID: 62A173A4FDA683CA

@ -16,6 +16,7 @@ import {
SleeveSkills,
SleeveTask,
} from "../ScriptEditor/NetscriptDefinitions";
import { checkEnum } from "../utils/helpers/checkEnum";
export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): ISleeve {
const checkSleeveAPIAccess = function (func: string): void {
@ -99,15 +100,9 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
const cityName = helper.string("travel", "cityName", _cityName);
checkSleeveAPIAccess("travel");
checkSleeveNumber("travel", sleeveNumber);
switch (cityName) {
case CityName.Aevum:
case CityName.Chongqing:
case CityName.Sector12:
case CityName.NewTokyo:
case CityName.Ishima:
case CityName.Volhaven:
if (checkEnum(CityName, cityName)) {
return player.sleeves[sleeveNumber].travel(player, cityName as CityName);
default:
} else {
throw helper.makeRuntimeErrorMsg("sleeve.setToCompanyWork", `Invalid city name: '${cityName}'.`);
}
},