mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-21 08:42:53 +02:00
Fix bug with sleeve.setToFactionWork
Function was not checking that the player was actually in the faction, which allowed sleeves to work for factions the player was not part of.
This commit is contained in:
@@ -12,6 +12,7 @@ import { isSleeveCompanyWork } from "../PersonObjects/Sleeve/Work/SleeveCompanyW
|
||||
import { helpers } from "../Netscript/NetscriptHelpers";
|
||||
import { cloneDeep } from "lodash";
|
||||
import { getAugCost } from "../Augmentation/AugmentationHelpers";
|
||||
import { Factions } from "../Faction/Factions";
|
||||
|
||||
export function NetscriptSleeve(): InternalAPI<NetscriptSleeve> {
|
||||
const checkSleeveAPIAccess = function (ctx: NetscriptContext) {
|
||||
@@ -102,11 +103,15 @@ export function NetscriptSleeve(): InternalAPI<NetscriptSleeve> {
|
||||
},
|
||||
setToFactionWork: (ctx) => (_sleeveNumber, _factionName, _workType) => {
|
||||
const sleeveNumber = helpers.number(ctx, "sleeveNumber", _sleeveNumber);
|
||||
const factionName = helpers.string(ctx, "factionName", _factionName);
|
||||
const factionName = getEnumHelper("FactionName").nsGetMember(ctx, _factionName);
|
||||
const workType = helpers.string(ctx, "workType", _workType);
|
||||
checkSleeveAPIAccess(ctx);
|
||||
checkSleeveNumber(ctx, sleeveNumber);
|
||||
|
||||
if (!Factions[factionName].isMember) {
|
||||
throw helpers.makeRuntimeErrorMsg(ctx, `Cannot work for faction ${factionName} without being a member.`);
|
||||
}
|
||||
|
||||
// Cannot work at the same faction that another sleeve is working at
|
||||
for (let i = 0; i < Player.sleeves.length; ++i) {
|
||||
if (i === sleeveNumber) {
|
||||
|
||||
Reference in New Issue
Block a user