mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-12-23 22:52:29 +01:00
fix getPossibleInfiltrations not returning enough info and fix donation saying Invalid input before unlocking
This commit is contained in:
parent
5c551348ed
commit
7f20dc2ee8
@ -56,7 +56,7 @@ export function DonateOption(props: IProps): React.ReactElement {
|
||||
}
|
||||
|
||||
function Status(): React.ReactElement {
|
||||
if (donateAmt === null) return <></>;
|
||||
if (isNaN(donateAmt)) return <></>;
|
||||
if (!canDonate()) {
|
||||
if (props.p.money < donateAmt) return <Typography>Insufficient funds</Typography>;
|
||||
return <Typography>Invalid donate amount entered!</Typography>;
|
||||
|
@ -1,6 +1,10 @@
|
||||
import { IPlayer } from "../PersonObjects/IPlayer";
|
||||
|
||||
import { Infiltration as IInfiltration, InfiltrationLocation } from "../ScriptEditor/NetscriptDefinitions";
|
||||
import {
|
||||
Infiltration as IInfiltration,
|
||||
InfiltrationLocation,
|
||||
PossibleInfiltrationLocation,
|
||||
} from "../ScriptEditor/NetscriptDefinitions";
|
||||
import { Location } from "../Locations/Location";
|
||||
import { Locations } from "../Locations/Locations";
|
||||
import { calculateDifficulty, calculateReward } from "../Infiltration/formulas/game";
|
||||
@ -31,7 +35,7 @@ export function NetscriptInfiltration(player: IPlayer): InternalAPI<IInfiltratio
|
||||
const reward = calculateReward(player, startingSecurityLevel);
|
||||
const maxLevel = location.infiltrationData.maxClearanceLevel;
|
||||
return {
|
||||
location: location,
|
||||
location: JSON.parse(JSON.stringify(location)),
|
||||
reward: {
|
||||
tradeRep: calculateTradeInformationRepReward(player, reward, maxLevel, difficulty),
|
||||
sellCash: calculateSellInformationCashReward(player, reward, maxLevel, difficulty),
|
||||
@ -41,8 +45,11 @@ export function NetscriptInfiltration(player: IPlayer): InternalAPI<IInfiltratio
|
||||
};
|
||||
};
|
||||
return {
|
||||
getPossibleLocations: () => (): string[] => {
|
||||
return getLocationsWithInfiltrations.map((l) => l.name);
|
||||
getPossibleLocations: () => (): PossibleInfiltrationLocation[] => {
|
||||
return getLocationsWithInfiltrations.map((l) => ({
|
||||
city: l.city ?? "",
|
||||
name: String(l.name),
|
||||
}));
|
||||
},
|
||||
getInfiltration:
|
||||
(ctx: NetscriptContext) =>
|
||||
|
10
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
10
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -1,3 +1,11 @@
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface PossibleInfiltrationLocation[] {
|
||||
city: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coding contract data will differ depending on coding contract.
|
||||
* @public
|
||||
@ -4289,7 +4297,7 @@ interface Infiltration {
|
||||
*
|
||||
* @returns all locations that can be infiltrated.
|
||||
*/
|
||||
getPossibleLocations(): string[];
|
||||
getPossibleLocations(): PossibleInfiltrationLocation[];
|
||||
/**
|
||||
* Get all infiltrations with difficulty, location and rewards.
|
||||
* @remarks
|
||||
|
Loading…
Reference in New Issue
Block a user