mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-30 03:23:48 +01:00
Merge pull request #3454 from TheMas3212/fix/gang-singularity-work
Fix inconsistancy with trying to work for gang factions while running a gang
This commit is contained in:
commit
0db3dc5feb
@ -23,7 +23,6 @@ import { findCrime } from "../Crime/CrimeHelpers";
|
|||||||
import { CompanyPosition } from "../Company/CompanyPosition";
|
import { CompanyPosition } from "../Company/CompanyPosition";
|
||||||
import { CompanyPositions } from "../Company/CompanyPositions";
|
import { CompanyPositions } from "../Company/CompanyPositions";
|
||||||
import { DarkWebItems } from "../DarkWeb/DarkWebItems";
|
import { DarkWebItems } from "../DarkWeb/DarkWebItems";
|
||||||
import { AllGangs } from "../Gang/AllGangs";
|
|
||||||
import { CityName } from "../Locations/data/CityNames";
|
import { CityName } from "../Locations/data/CityNames";
|
||||||
import { LocationName } from "../Locations/data/LocationNames";
|
import { LocationName } from "../Locations/data/LocationNames";
|
||||||
import { Router } from "../ui/GameRoot";
|
import { Router } from "../ui/GameRoot";
|
||||||
@ -1047,11 +1046,14 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
|||||||
const facName = _ctx.helper.string("facName", _facName);
|
const facName = _ctx.helper.string("facName", _facName);
|
||||||
const type = _ctx.helper.string("type", _type);
|
const type = _ctx.helper.string("type", _type);
|
||||||
const focus = _ctx.helper.boolean(_focus);
|
const focus = _ctx.helper.boolean(_focus);
|
||||||
getFaction(_ctx, facName);
|
const faction = getFaction(_ctx, facName);
|
||||||
|
|
||||||
// if the player is in a gang and the target faction is any of the gang faction, fail
|
// if the player is in a gang and the target faction is any of the gang faction, fail
|
||||||
if (player.inGang() && AllGangs[facName] !== undefined) {
|
if (player.inGang() && faction.name === player.getGangFaction().name) {
|
||||||
workerScript.log("workForFaction", () => `Faction '${facName}' does not offer work at the moment.`);
|
workerScript.log(
|
||||||
|
"workForFaction",
|
||||||
|
() => `You can't work for '${facName}' because youre managing a gang for it`,
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1066,21 +1068,18 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
|||||||
workerScript.log("workForFaction", () => txt);
|
workerScript.log("workForFaction", () => txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
const fac = Factions[facName];
|
|
||||||
// Arrays listing factions that allow each time of work
|
|
||||||
|
|
||||||
switch (type.toLowerCase()) {
|
switch (type.toLowerCase()) {
|
||||||
case "hacking":
|
case "hacking":
|
||||||
case "hacking contracts":
|
case "hacking contracts":
|
||||||
case "hackingcontracts":
|
case "hackingcontracts":
|
||||||
if (!FactionInfos[fac.name].offerHackingWork) {
|
if (!FactionInfos[faction.name].offerHackingWork) {
|
||||||
workerScript.log(
|
workerScript.log(
|
||||||
"workForFaction",
|
"workForFaction",
|
||||||
() => `Faction '${fac.name}' do not need help with hacking contracts.`,
|
() => `Faction '${faction.name}' do not need help with hacking contracts.`,
|
||||||
);
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
player.startFactionHackWork(fac);
|
player.startFactionHackWork(faction);
|
||||||
if (focus) {
|
if (focus) {
|
||||||
player.startFocusing();
|
player.startFocusing();
|
||||||
Router.toWork();
|
Router.toWork();
|
||||||
@ -1088,16 +1087,19 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
|||||||
player.stopFocusing();
|
player.stopFocusing();
|
||||||
Router.toTerminal();
|
Router.toTerminal();
|
||||||
}
|
}
|
||||||
workerScript.log("workForFaction", () => `Started carrying out hacking contracts for '${fac.name}'`);
|
workerScript.log("workForFaction", () => `Started carrying out hacking contracts for '${faction.name}'`);
|
||||||
return true;
|
return true;
|
||||||
case "field":
|
case "field":
|
||||||
case "fieldwork":
|
case "fieldwork":
|
||||||
case "field work":
|
case "field work":
|
||||||
if (!FactionInfos[fac.name].offerFieldWork) {
|
if (!FactionInfos[faction.name].offerFieldWork) {
|
||||||
workerScript.log("workForFaction", () => `Faction '${fac.name}' do not need help with field missions.`);
|
workerScript.log(
|
||||||
|
"workForFaction",
|
||||||
|
() => `Faction '${faction.name}' do not need help with field missions.`,
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
player.startFactionFieldWork(fac);
|
player.startFactionFieldWork(faction);
|
||||||
if (focus) {
|
if (focus) {
|
||||||
player.startFocusing();
|
player.startFocusing();
|
||||||
Router.toWork();
|
Router.toWork();
|
||||||
@ -1105,16 +1107,19 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
|||||||
player.stopFocusing();
|
player.stopFocusing();
|
||||||
Router.toTerminal();
|
Router.toTerminal();
|
||||||
}
|
}
|
||||||
workerScript.log("workForFaction", () => `Started carrying out field missions for '${fac.name}'`);
|
workerScript.log("workForFaction", () => `Started carrying out field missions for '${faction.name}'`);
|
||||||
return true;
|
return true;
|
||||||
case "security":
|
case "security":
|
||||||
case "securitywork":
|
case "securitywork":
|
||||||
case "security work":
|
case "security work":
|
||||||
if (!FactionInfos[fac.name].offerSecurityWork) {
|
if (!FactionInfos[faction.name].offerSecurityWork) {
|
||||||
workerScript.log("workForFaction", () => `Faction '${fac.name}' do not need help with security work.`);
|
workerScript.log(
|
||||||
|
"workForFaction",
|
||||||
|
() => `Faction '${faction.name}' do not need help with security work.`,
|
||||||
|
);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
player.startFactionSecurityWork(fac);
|
player.startFactionSecurityWork(faction);
|
||||||
if (focus) {
|
if (focus) {
|
||||||
player.startFocusing();
|
player.startFocusing();
|
||||||
Router.toWork();
|
Router.toWork();
|
||||||
@ -1122,7 +1127,7 @@ export function NetscriptSingularity(player: IPlayer, workerScript: WorkerScript
|
|||||||
player.stopFocusing();
|
player.stopFocusing();
|
||||||
Router.toTerminal();
|
Router.toTerminal();
|
||||||
}
|
}
|
||||||
workerScript.log("workForFaction", () => `Started carrying out security work for '${fac.name}'`);
|
workerScript.log("workForFaction", () => `Started carrying out security work for '${faction.name}'`);
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
workerScript.log("workForFaction", () => `Invalid work type: '${type}`);
|
workerScript.log("workForFaction", () => `Invalid work type: '${type}`);
|
||||||
|
Loading…
Reference in New Issue
Block a user