API: Update getInfiltration API (#1235)

This commit is contained in:
catloversg
2024-05-12 07:13:59 +07:00
committed by GitHub
parent e478b9a224
commit 1288d1c289
5 changed files with 33 additions and 2 deletions
+7 -2
View File
@@ -1,5 +1,5 @@
import type { InternalAPI, NetscriptContext } from "../Netscript/APIWrapper";
import { Infiltration as NetscriptInfiltation, InfiltrationLocation, ILocation } from "@nsdefs";
import { Infiltration as NetscriptInfiltation, InfiltrationLocation } from "@nsdefs";
import { FactionName, LocationName } from "@enums";
import { Location } from "../Locations/Location";
import { Locations } from "../Locations/Locations";
@@ -29,13 +29,18 @@ export function NetscriptInfiltration(): InternalAPI<NetscriptInfiltation> {
const reward = calculateReward(startingSecurityLevel);
const maxLevel = location.infiltrationData.maxClearanceLevel;
return {
location: structuredClone(location) as ILocation,
location: {
city: location.city!,
name: location.name,
},
reward: {
tradeRep: calculateTradeInformationRepReward(reward, maxLevel, startingSecurityLevel),
sellCash: calculateSellInformationCashReward(reward, maxLevel, startingSecurityLevel),
SoARep: calculateInfiltratorsRepReward(Factions[FactionName.ShadowsOfAnarchy], startingSecurityLevel),
},
difficulty: difficulty,
maxClearanceLevel: location.infiltrationData.maxClearanceLevel,
startingSecurityLevel: location.infiltrationData.startingSecurityLevel,
};
};
return {