mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-18 13:43:49 +01:00
Added functions to create gang
This commit is contained in:
parent
9996232751
commit
d6a7471e0b
12
doc/source/netscript/gangapi/createGang.rst
Normal file
12
doc/source/netscript/gangapi/createGang.rst
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
createGang() Netscript Function
|
||||||
|
======================================
|
||||||
|
|
||||||
|
.. js:function:: createGang(faction)
|
||||||
|
|
||||||
|
:RAM cost: 1 GB
|
||||||
|
:param string faction: Name of faction
|
||||||
|
:returns: ``true`` if a Gang was created with that faction.
|
||||||
|
|
||||||
|
Creates a Gang with that faction. You need to have access to Gangs, the
|
||||||
|
faction must be one of the approved gang factions, and you must be a member
|
||||||
|
of that faction for the creation to be successful.
|
7
doc/source/netscript/gangapi/inGang.rst
Normal file
7
doc/source/netscript/gangapi/inGang.rst
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
inGang() Netscript Function
|
||||||
|
======================================
|
||||||
|
|
||||||
|
.. js:function:: inGang()
|
||||||
|
|
||||||
|
:RAM cost: 1 GB
|
||||||
|
:returns: ``true`` if the player is already in a gang.
|
@ -25,6 +25,8 @@ In :ref:`netscriptjs`::
|
|||||||
.. toctree::
|
.. toctree::
|
||||||
:caption: API Functions:
|
:caption: API Functions:
|
||||||
|
|
||||||
|
createGang() <gangapi/createGang>
|
||||||
|
inGang() <gangapi/inGang>
|
||||||
getMemberNames() <gangapi/getMemberNames>
|
getMemberNames() <gangapi/getMemberNames>
|
||||||
getGangInformation() <gangapi/getGangInformation>
|
getGangInformation() <gangapi/getGangInformation>
|
||||||
getOtherGangInformation() <gangapi/getOtherGangInformation>
|
getOtherGangInformation() <gangapi/getOtherGangInformation>
|
||||||
|
@ -223,6 +223,8 @@ export const RamCosts: IMap<any> = {
|
|||||||
|
|
||||||
// Gang API
|
// Gang API
|
||||||
gang : {
|
gang : {
|
||||||
|
createGang: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
|
||||||
|
inGang: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
|
||||||
getMemberNames: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
|
getMemberNames: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
|
||||||
getGangInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
|
getGangInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
|
||||||
getOtherGangInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
|
getOtherGangInformation: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
|
||||||
|
@ -3603,6 +3603,30 @@ function NetscriptFunctions(workerScript) {
|
|||||||
|
|
||||||
// Gang API
|
// Gang API
|
||||||
gang: {
|
gang: {
|
||||||
|
createGang: function(faction) {
|
||||||
|
updateDynamicRam("createGang", getRamCost("gang", "createGang"));
|
||||||
|
// this list is copied from Faction/ui/Root.tsx
|
||||||
|
const GangNames = [
|
||||||
|
"Slum Snakes",
|
||||||
|
"Tetrads",
|
||||||
|
"The Syndicate",
|
||||||
|
"The Dark Army",
|
||||||
|
"Speakers for the Dead",
|
||||||
|
"NiteSec",
|
||||||
|
"The Black Hand",
|
||||||
|
];
|
||||||
|
if(!Player.canAccessGang() || !GangNames.includes(faction)) return false;
|
||||||
|
if (Player.inGang()) return false;
|
||||||
|
if(!Player.factions.includes(faction)) return false;
|
||||||
|
|
||||||
|
const isHacking = (faction === "NiteSec" || faction === "The Black Hand");
|
||||||
|
Player.startGang(faction, isHacking);
|
||||||
|
return true;
|
||||||
|
},
|
||||||
|
inGang: function() {
|
||||||
|
updateDynamicRam("inGang", getRamCost("gang", "inGang"));
|
||||||
|
return Player.inGang();
|
||||||
|
},
|
||||||
getMemberNames: function() {
|
getMemberNames: function() {
|
||||||
updateDynamicRam("getMemberNames", getRamCost("gang", "getMemberNames"));
|
updateDynamicRam("getMemberNames", getRamCost("gang", "getMemberNames"));
|
||||||
checkGangApiAccess("getMemberNames");
|
checkGangApiAccess("getMemberNames");
|
||||||
|
Loading…
Reference in New Issue
Block a user