UI: Show hints of Gang mechanic in pre-endgame (#2723)

This commit is contained in:
catloversg
2026-05-07 05:22:43 +07:00
committed by GitHub
parent 2ab144cff2
commit eb431145ee
9 changed files with 216 additions and 106 deletions
+2 -17
View File
@@ -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);