mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-23 01:32:55 +02:00
API: Programming-friendly interface to getFactionInviteRequirements (#953)
This commit is contained in:
@@ -816,14 +816,12 @@ export function NetscriptSingularity(): InternalAPI<ISingularity> {
|
||||
const companyName = getEnumHelper("CompanyName").nsGetMember(ctx, _companyName);
|
||||
return Companies[companyName].getFavorGain();
|
||||
},
|
||||
/* Function temporarily removed, likely to change in next version to be more programming-friendly instead of providing human-readable string outputs for each requirement
|
||||
getFactionInviteRequirements: (ctx) => (_facName) => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
const facName = getEnumHelper("FactionName").nsGetMember(ctx, _facName);
|
||||
const fac = Factions[facName];
|
||||
return fac.getInfo().inviteReqs.map((condition) => condition.toString());
|
||||
return [...fac.getInfo().inviteReqs].map((condition) => condition.toJSON());
|
||||
},
|
||||
*/
|
||||
checkFactionInvitations: (ctx) => () => {
|
||||
helpers.checkSingularityAccess(ctx);
|
||||
// Manually trigger a check for faction invites
|
||||
|
||||
@@ -108,19 +108,13 @@ export function NetscriptStanek(): InternalAPI<IStanek> {
|
||||
return staneksGift.delete(rootX, rootY);
|
||||
},
|
||||
acceptGift: (ctx) => () => {
|
||||
//Check if the player is eligible to join the church
|
||||
if (
|
||||
Player.canAccessCotMG() &&
|
||||
Player.augmentations.filter((a) => a.name !== AugmentationName.NeuroFluxGovernor).length == 0 &&
|
||||
Player.queuedAugmentations.filter((a) => a.name !== AugmentationName.NeuroFluxGovernor).length == 0
|
||||
) {
|
||||
//Attempt to join CotMG
|
||||
joinFaction(Factions[FactionName.ChurchOfTheMachineGod]);
|
||||
//Attempt to install the first Stanek aug
|
||||
if (
|
||||
!Player.hasAugmentation(AugmentationName.StaneksGift1) &&
|
||||
!Player.queuedAugmentations.some((a) => a.name === AugmentationName.StaneksGift1)
|
||||
) {
|
||||
const cotmgFaction = Factions[FactionName.ChurchOfTheMachineGod];
|
||||
// Check if the player is eligible to join the church
|
||||
if (cotmgFaction.getInfo().inviteReqs.isSatisfied(Player)) {
|
||||
// Attempt to join CotMG
|
||||
joinFaction(cotmgFaction);
|
||||
// Attempt to install the first Stanek aug (unless it is already queued)
|
||||
if (!Player.hasAugmentation(AugmentationName.StaneksGift1, false)) {
|
||||
applyAugmentation({ name: AugmentationName.StaneksGift1, level: 1 });
|
||||
helpers.log(
|
||||
ctx,
|
||||
@@ -128,11 +122,8 @@ export function NetscriptStanek(): InternalAPI<IStanek> {
|
||||
);
|
||||
}
|
||||
}
|
||||
//Return true iff the player is in CotMG and has the first Stanek aug installed
|
||||
return (
|
||||
Factions[FactionName.ChurchOfTheMachineGod].isMember &&
|
||||
Player.hasAugmentation(AugmentationName.StaneksGift1, true)
|
||||
);
|
||||
// Return true iff the player is in CotMG and has the first Stanek aug installed
|
||||
return cotmgFaction.isMember && Player.hasAugmentation(AugmentationName.StaneksGift1, true);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user