mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 17:43:48 +01:00
switch to checkEnum
This commit is contained in:
parent
e07b92a408
commit
de3359dfad
@ -16,6 +16,7 @@ import {
|
|||||||
SleeveSkills,
|
SleeveSkills,
|
||||||
SleeveTask,
|
SleeveTask,
|
||||||
} from "../ScriptEditor/NetscriptDefinitions";
|
} from "../ScriptEditor/NetscriptDefinitions";
|
||||||
|
import { checkEnum } from "../utils/helpers/checkEnum";
|
||||||
|
|
||||||
export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): ISleeve {
|
export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, helper: INetscriptHelper): ISleeve {
|
||||||
const checkSleeveAPIAccess = function (func: string): void {
|
const checkSleeveAPIAccess = function (func: string): void {
|
||||||
@ -99,16 +100,10 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
|||||||
const cityName = helper.string("travel", "cityName", _cityName);
|
const cityName = helper.string("travel", "cityName", _cityName);
|
||||||
checkSleeveAPIAccess("travel");
|
checkSleeveAPIAccess("travel");
|
||||||
checkSleeveNumber("travel", sleeveNumber);
|
checkSleeveNumber("travel", sleeveNumber);
|
||||||
switch (cityName) {
|
if (checkEnum(CityName, cityName)) {
|
||||||
case CityName.Aevum:
|
return player.sleeves[sleeveNumber].travel(player, cityName as CityName);
|
||||||
case CityName.Chongqing:
|
} else {
|
||||||
case CityName.Sector12:
|
throw helper.makeRuntimeErrorMsg("sleeve.setToCompanyWork", `Invalid city name: '${cityName}'.`);
|
||||||
case CityName.NewTokyo:
|
|
||||||
case CityName.Ishima:
|
|
||||||
case CityName.Volhaven:
|
|
||||||
return player.sleeves[sleeveNumber].travel(player, cityName as CityName);
|
|
||||||
default:
|
|
||||||
throw helper.makeRuntimeErrorMsg("sleeve.setToCompanyWork", `Invalid city name: '${cityName}'.`);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setToCompanyWork: function (_sleeveNumber: unknown, acompanyName: unknown): boolean {
|
setToCompanyWork: function (_sleeveNumber: unknown, acompanyName: unknown): boolean {
|
||||||
|
Loading…
Reference in New Issue
Block a user