gang.getEquipmentStats added, returns equipment multipliers

This commit is contained in:
Olivier Gagnon
2021-03-07 22:01:31 -05:00
parent 1d2136da4b
commit 84423e6309
6 changed files with 35 additions and 4 deletions

View File

@@ -29,7 +29,7 @@ import {
calculateGrowTime,
calculateWeakenTime
} from "./Hacking";
import { AllGangs } from "./Gang";
import { AllGangs, GangMemberUpgrades } from "./Gang";
import { Faction } from "./Faction/Faction";
import { Factions, factionExists } from "./Faction/Factions";
import { joinFaction, purchaseAugmentation } from "./Faction/FactionHelpers";
@@ -3742,6 +3742,16 @@ function NetscriptFunctions(workerScript) {
throw makeRuntimeRejectMsg(workerScript, nsGang.unknownGangApiExceptionMessage("getEquipmentType", e));
}
},
getEquipmentStats: function(equipName) {
updateDynamicRam("getEquipmentStats", getRamCost("gang", "getEquipmentStats"));
nsGang.checkGangApiAccess(workerScript, "getEquipmentStats");
const equipment = GangMemberUpgrades[equipName];
if (!equipment) {
throw makeRuntimeRejectMsg(workerScript, nsGang.unknownGangApiExceptionMessage("getEquipmentStats", `${equipName} does not exists`));
}
return Object.assign({}, equipment.mults);
},
purchaseEquipment: function(memberName, equipName) {
updateDynamicRam("purchaseEquipment", getRamCost("gang", "purchaseEquipment"));
nsGang.checkGangApiAccess(workerScript, "purchaseEquipment");