mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-04-21 00:32:51 +02:00
Added ns function stanek.acceptGift
Added a new ns function stanek.acceptGift to the game, with a ram cost of 2gb. The function attempts to join the CotMG and install the gift, then returns true iff the player is in the CotMG and has the gift installed.
This commit is contained in:
@@ -13,6 +13,10 @@ import {
|
||||
} from "../ScriptEditor/NetscriptDefinitions";
|
||||
import { AugmentationNames } from "../Augmentation/data/AugmentationNames";
|
||||
import { NetscriptContext, InternalAPI } from "../Netscript/APIWrapper";
|
||||
import { applyAugmentation } from "../Augmentation/AugmentationHelpers";
|
||||
import { FactionNames } from "../Faction/data/FactionNames";
|
||||
import { joinFaction } from "../Faction/FactionHelpers";
|
||||
import { Factions } from "../Faction/Factions";
|
||||
|
||||
export function NetscriptStanek(
|
||||
player: IPlayer,
|
||||
@@ -109,5 +113,28 @@ export function NetscriptStanek(
|
||||
checkStanekAPIAccess("removeFragment");
|
||||
return staneksGift.delete(rootX, rootY);
|
||||
},
|
||||
acceptGift: (_ctx: NetscriptContext) =>
|
||||
function (): boolean {
|
||||
//Check if the player has access to the church
|
||||
if (player.canAccessCotMG()) {
|
||||
//Attempt to join CotMG
|
||||
const faction = Factions[FactionNames.ChurchOfTheMachineGod];
|
||||
if (!player.factions.includes(FactionNames.ChurchOfTheMachineGod)) {
|
||||
joinFaction(faction);
|
||||
}
|
||||
//Attempt to install the first Stanek aug
|
||||
if (
|
||||
!player.hasAugmentation(AugmentationNames.StaneksGift1) &&
|
||||
!player.queuedAugmentations.some((a) => a.name === AugmentationNames.StaneksGift1)
|
||||
) {
|
||||
applyAugmentation({ name: AugmentationNames.StaneksGift1, level: 1 });
|
||||
}
|
||||
}
|
||||
//Return true iff the player is in CotMG and has the first Stanek aug installed
|
||||
return (
|
||||
player.factions.includes(FactionNames.ChurchOfTheMachineGod) &&
|
||||
player.hasAugmentation(AugmentationNames.StaneksGift1)
|
||||
);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user