mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-18 20:25:45 +01:00
Added gang.getTaskStats which returns the stats of a gang task
This commit is contained in:
parent
84423e6309
commit
619db14622
33
doc/source/netscript/gangapi/getTaskStats.rst
Normal file
33
doc/source/netscript/gangapi/getTaskStats.rst
Normal file
@ -0,0 +1,33 @@
|
||||
getTaskStats() Netscript Function
|
||||
======================================
|
||||
|
||||
.. js:function:: getTaskStats()
|
||||
|
||||
:RAM cost: 1 GB
|
||||
|
||||
Get the stats of a gang member stats. This is typically used to evaluate
|
||||
which action should be executed next.
|
||||
|
||||
{
|
||||
name: Terrorism,
|
||||
desc: "Assign this gang member to commit acts of terrorism
|
||||
|
||||
Greatly increases respect - Greatly increases wanted level - Scales heavily with territory",
|
||||
isHacking: false,
|
||||
isCombat: true,
|
||||
baseRespect: 0.01,
|
||||
baseWanted: 6,
|
||||
baseMoney: 0,
|
||||
hackWeight: 20,
|
||||
strWeight: 20,
|
||||
defWeight: 20,
|
||||
dexWeight: 20,
|
||||
agiWeight: 0,
|
||||
chaWeight: 20,
|
||||
difficulty: 36,
|
||||
territory: {
|
||||
money: 1,
|
||||
respect: 2,
|
||||
wanted: 2
|
||||
}
|
||||
}
|
@ -912,7 +912,7 @@ GangMemberTask.fromJSON = function(value) {
|
||||
|
||||
Reviver.constructors.GangMemberTask = GangMemberTask;
|
||||
|
||||
const GangMemberTasks = {};
|
||||
export const GangMemberTasks = {};
|
||||
|
||||
function addGangMemberTask(name, desc, isHacking, isCombat, params) {
|
||||
GangMemberTasks[name] = new GangMemberTask(name, desc, isHacking, isCombat, params);
|
||||
|
@ -216,6 +216,7 @@ export const RamCosts: IMap<any> = {
|
||||
canRecruitMember: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
|
||||
recruitMember: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
|
||||
getTaskNames: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
|
||||
getTaskStats: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
|
||||
setMemberTask: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
|
||||
getEquipmentNames: () => RamCostConstants.ScriptGangApiBaseRamCost / 4,
|
||||
getEquipmentCost: () => RamCostConstants.ScriptGangApiBaseRamCost / 2,
|
||||
|
@ -29,7 +29,11 @@ import {
|
||||
calculateGrowTime,
|
||||
calculateWeakenTime
|
||||
} from "./Hacking";
|
||||
import { AllGangs, GangMemberUpgrades } from "./Gang";
|
||||
import {
|
||||
AllGangs,
|
||||
GangMemberUpgrades,
|
||||
GangMemberTasks
|
||||
} from "./Gang";
|
||||
import { Faction } from "./Faction/Faction";
|
||||
import { Factions, factionExists } from "./Faction/Factions";
|
||||
import { joinFaction, purchaseAugmentation } from "./Faction/FactionHelpers";
|
||||
@ -3712,6 +3716,17 @@ function NetscriptFunctions(workerScript) {
|
||||
throw makeRuntimeRejectMsg(workerScript, nsGang.unknownGangApiExceptionMessage("setMemberTask", e));
|
||||
}
|
||||
},
|
||||
getTaskStats: function(taskName) {
|
||||
updateDynamicRam("getTaskStats", getRamCost("gang", "getTaskStats"));
|
||||
nsGang.checkGangApiAccess(workerScript, "getTaskStats");
|
||||
const task = GangMemberTasks[taskName];
|
||||
if (!task) {
|
||||
throw makeRuntimeRejectMsg(workerScript, nsGang.unknownGangApiExceptionMessage("getTaskStats", `${taskName} does not exists`));
|
||||
}
|
||||
const copy = Object.assign({}, task);
|
||||
copy.territory = Object.assign({}, task.territory)
|
||||
return copy;
|
||||
},
|
||||
getEquipmentNames: function() {
|
||||
updateDynamicRam("getEquipmentNames", getRamCost("gang", "getEquipmentNames"));
|
||||
nsGang.checkGangApiAccess(workerScript, "getEquipmentNames");
|
||||
|
@ -110,7 +110,7 @@ let NetscriptFunctions =
|
||||
"getMemberNames|getGangInformation|getMemberInformation|canRecruitMember|" +
|
||||
"recruitMember|getTaskNames|setMemberTask|getEquipmentNames|" +
|
||||
"getEquipmentCost|getEquipmentType|purchaseEquipment|ascendMember|" +
|
||||
"setTerritoryWarfare|getEquipmentStats|" +
|
||||
"setTerritoryWarfare|getEquipmentStats|getTaskStats|" +
|
||||
"getChanceToWinClash|getBonusTime|" +
|
||||
|
||||
// Bladeburner API
|
||||
|
Loading…
Reference in New Issue
Block a user