mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-20 16:22:56 +02:00
SINGULARITY: Add ns.singularity.getFactionWorkTypes (#1425)
This commit is contained in:
@@ -827,7 +827,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
|
||||
// if the player is in a gang and the target faction is any of the gang faction, fail
|
||||
if (Player.gang && faction.name === Player.getGangFaction().name) {
|
||||
helpers.log(ctx, () => `You can't work for '${facName}' because youre managing a gang for it`);
|
||||
helpers.log(ctx, () => `You can't work for '${facName}' because you are managing a gang for it`);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -913,6 +913,26 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
getFactionWorkTypes: (ctx) => (_facName) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
const facName = getEnumHelper("FactionName").nsGetMember(ctx, _facName);
|
||||
// Gang does not offer normal work.
|
||||
if (Player.gang?.facName === facName) {
|
||||
return [];
|
||||
}
|
||||
const factionInfo = Factions[facName].getInfo();
|
||||
const workTypes = [];
|
||||
if (factionInfo.offerHackingWork) {
|
||||
workTypes.push(FactionWorkType.hacking);
|
||||
}
|
||||
if (factionInfo.offerFieldWork) {
|
||||
workTypes.push(FactionWorkType.field);
|
||||
}
|
||||
if (factionInfo.offerSecurityWork) {
|
||||
workTypes.push(FactionWorkType.security);
|
||||
}
|
||||
return workTypes;
|
||||
},
|
||||
getFactionRep: (ctx) => (_facName) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
const facName = getEnumHelper("FactionName").nsGetMember(ctx, _facName);
|
||||
@@ -941,7 +961,7 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
return false;
|
||||
}
|
||||
if (Player.gang && faction.name === Player.getGangFaction().name) {
|
||||
helpers.log(ctx, () => `You can't donate to '${facName}' because youre managing a gang for it`);
|
||||
helpers.log(ctx, () => `You can't donate to '${facName}' because you are managing a gang for it`);
|
||||
return false;
|
||||
}
|
||||
if (faction.name === FactionName.ChurchOfTheMachineGod || faction.name === FactionName.Bladeburners) {
|
||||
|
||||
Reference in New Issue
Block a user