mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2026-05-10 01:27:48 +02:00
UI: Show hints of Gang mechanic in pre-endgame (#2723)
This commit is contained in:
@@ -7,13 +7,13 @@ import { type InternalAPI, type NetscriptContext, setRemovedFunctions } from "..
|
||||
import { GangPromise, RecruitmentResult } from "../Gang/Gang";
|
||||
import { Player } from "@player";
|
||||
import { FactionName } from "@enums";
|
||||
import { GangConstants } from "../Gang/data/Constants";
|
||||
import { AllGangs } from "../Gang/AllGangs";
|
||||
import { GangMemberTasks } from "../Gang/GangMemberTasks";
|
||||
import { GangMemberUpgrades } from "../Gang/GangMemberUpgrades";
|
||||
import { helpers } from "../Netscript/NetscriptHelpers";
|
||||
import { getEnumHelper } from "../utils/EnumHelper";
|
||||
import { CONSTANTS } from "../Constants";
|
||||
import { canCreateGang } from "../Gang/helpers";
|
||||
|
||||
export function NetscriptGang(): InternalAPI<IGang> {
|
||||
/** Functions as an API check and also returns the gang object */
|
||||
@@ -40,26 +40,11 @@ export function NetscriptGang(): InternalAPI<IGang> {
|
||||
const gangFunctions: InternalAPI<IGang> = {
|
||||
createGang: (ctx) => (_faction) => {
|
||||
const faction = getEnumHelper("FactionName").nsGetMember(ctx, _faction);
|
||||
if (Player.gang) {
|
||||
return false;
|
||||
}
|
||||
const checkResult = Player.canAccessGang();
|
||||
const checkResult = canCreateGang(faction);
|
||||
if (!checkResult.success) {
|
||||
helpers.log(ctx, () => checkResult.message);
|
||||
return false;
|
||||
}
|
||||
if (!GangConstants.Names.includes(faction)) {
|
||||
helpers.log(
|
||||
ctx,
|
||||
() =>
|
||||
`${faction} does not allow creating a gang. You can only do that with ${GangConstants.Names.join(", ")}.`,
|
||||
);
|
||||
return false;
|
||||
}
|
||||
if (!Player.factions.includes(faction)) {
|
||||
helpers.log(ctx, () => `You are not a member of ${faction}.`);
|
||||
return false;
|
||||
}
|
||||
|
||||
const isHacking = faction === FactionName.NiteSec || faction === FactionName.TheBlackHand;
|
||||
Player.startGang(faction, isHacking);
|
||||
|
||||
Reference in New Issue
Block a user