mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-22 15:43:49 +01:00
fix a few test
This commit is contained in:
parent
f05b533af5
commit
4fc352a792
@ -31,9 +31,9 @@ export function NetscriptCodingContract(
|
||||
_hostname: unknown = workerScript.hostname,
|
||||
{ returnReward }: CodingAttemptOptions = { returnReward: false },
|
||||
): boolean | string {
|
||||
helper.updateDynamicRam("attempt", getRamCost(player, "codingcontract", "attempt"));
|
||||
const filename = helper.string("attempt", "filename", _filename);
|
||||
const hostname = helper.string("attempt", "hostname", _hostname);
|
||||
helper.updateDynamicRam("attempt", getRamCost(player, "codingcontract", "attempt"));
|
||||
const contract = getCodingContract("attempt", hostname, filename);
|
||||
|
||||
// Convert answer to string. If the answer is a 2D array, then we have to
|
||||
@ -83,16 +83,16 @@ export function NetscriptCodingContract(
|
||||
}
|
||||
},
|
||||
getContractType: function (_filename: unknown, _hostname: unknown = workerScript.hostname): string {
|
||||
helper.updateDynamicRam("getContractType", getRamCost(player, "codingcontract", "getContractType"));
|
||||
const filename = helper.string("getContractType", "filename", _filename);
|
||||
const hostname = helper.string("getContractType", "hostname", _hostname);
|
||||
helper.updateDynamicRam("getContractType", getRamCost(player, "codingcontract", "getContractType"));
|
||||
const contract = getCodingContract("getContractType", hostname, filename);
|
||||
return contract.getType();
|
||||
},
|
||||
getData: function (_filename: unknown, _hostname: unknown = workerScript.hostname): any {
|
||||
helper.updateDynamicRam("getData", getRamCost(player, "codingcontract", "getData"));
|
||||
const filename = helper.string("getContractType", "filename", _filename);
|
||||
const hostname = helper.string("getContractType", "hostname", _hostname);
|
||||
helper.updateDynamicRam("getData", getRamCost(player, "codingcontract", "getData"));
|
||||
const contract = getCodingContract("getData", hostname, filename);
|
||||
const data = contract.getData();
|
||||
if (data.constructor === Array) {
|
||||
@ -112,16 +112,16 @@ export function NetscriptCodingContract(
|
||||
}
|
||||
},
|
||||
getDescription: function (_filename: unknown, _hostname: unknown = workerScript.hostname): string {
|
||||
helper.updateDynamicRam("getDescription", getRamCost(player, "codingcontract", "getDescription"));
|
||||
const filename = helper.string("getDescription", "filename", _filename);
|
||||
const hostname = helper.string("getDescription", "hostname", _hostname);
|
||||
helper.updateDynamicRam("getDescription", getRamCost(player, "codingcontract", "getDescription"));
|
||||
const contract = getCodingContract("getDescription", hostname, filename);
|
||||
return contract.getDescription();
|
||||
},
|
||||
getNumTriesRemaining: function (_filename: unknown, _hostname: unknown = workerScript.hostname): number {
|
||||
helper.updateDynamicRam("getNumTriesRemaining", getRamCost(player, "codingcontract", "getNumTriesRemaining"));
|
||||
const filename = helper.string("getNumTriesRemaining", "filename", _filename);
|
||||
const hostname = helper.string("getNumTriesRemaining", "hostname", _hostname);
|
||||
helper.updateDynamicRam("getNumTriesRemaining", getRamCost(player, "codingcontract", "getNumTriesRemaining"));
|
||||
const contract = getCodingContract("getNumTriesRemaining", hostname, filename);
|
||||
return contract.getMaxNumTries() - contract.tries;
|
||||
},
|
||||
|
@ -57,23 +57,23 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
||||
return player.sleeves.length;
|
||||
},
|
||||
setToShockRecovery: function (_sleeveNumber: unknown): boolean {
|
||||
const sleeveNumber = helper.number("setToShockRecovery", "sleeveNumber", _sleeveNumber);
|
||||
helper.updateDynamicRam("setToShockRecovery", getRamCost(player, "sleeve", "setToShockRecovery"));
|
||||
const sleeveNumber = helper.number("setToShockRecovery", "sleeveNumber", _sleeveNumber);
|
||||
checkSleeveAPIAccess("setToShockRecovery");
|
||||
checkSleeveNumber("setToShockRecovery", sleeveNumber);
|
||||
return player.sleeves[sleeveNumber].shockRecovery(player);
|
||||
},
|
||||
setToSynchronize: function (_sleeveNumber: unknown): boolean {
|
||||
const sleeveNumber = helper.number("setToSynchronize", "sleeveNumber", _sleeveNumber);
|
||||
helper.updateDynamicRam("setToSynchronize", getRamCost(player, "sleeve", "setToSynchronize"));
|
||||
const sleeveNumber = helper.number("setToSynchronize", "sleeveNumber", _sleeveNumber);
|
||||
checkSleeveAPIAccess("setToSynchronize");
|
||||
checkSleeveNumber("setToSynchronize", sleeveNumber);
|
||||
return player.sleeves[sleeveNumber].synchronize(player);
|
||||
},
|
||||
setToCommitCrime: function (_sleeveNumber: unknown, _crimeRoughName: unknown): boolean {
|
||||
helper.updateDynamicRam("setToCommitCrime", getRamCost(player, "sleeve", "setToCommitCrime"));
|
||||
const sleeveNumber = helper.number("setToCommitCrime", "sleeveNumber", _sleeveNumber);
|
||||
const crimeRoughName = helper.string("setToCommitCrime", "crimeName", _crimeRoughName);
|
||||
helper.updateDynamicRam("setToCommitCrime", getRamCost(player, "sleeve", "setToCommitCrime"));
|
||||
checkSleeveAPIAccess("setToCommitCrime");
|
||||
checkSleeveNumber("setToCommitCrime", sleeveNumber);
|
||||
const crime = findCrime(crimeRoughName);
|
||||
@ -83,26 +83,26 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
||||
return player.sleeves[sleeveNumber].commitCrime(player, crime.name);
|
||||
},
|
||||
setToUniversityCourse: function (_sleeveNumber: unknown, _universityName: unknown, _className: unknown): boolean {
|
||||
helper.updateDynamicRam("setToUniversityCourse", getRamCost(player, "sleeve", "setToUniversityCourse"));
|
||||
const sleeveNumber = helper.number("setToUniversityCourse", "sleeveNumber", _sleeveNumber);
|
||||
const universityName = helper.string("setToUniversityCourse", "universityName", _universityName);
|
||||
const className = helper.string("setToUniversityCourse", "className", _className);
|
||||
helper.updateDynamicRam("setToUniversityCourse", getRamCost(player, "sleeve", "setToUniversityCourse"));
|
||||
checkSleeveAPIAccess("setToUniversityCourse");
|
||||
checkSleeveNumber("setToUniversityCourse", sleeveNumber);
|
||||
return player.sleeves[sleeveNumber].takeUniversityCourse(player, universityName, className);
|
||||
},
|
||||
travel: function (_sleeveNumber: unknown, _cityName: unknown): boolean {
|
||||
helper.updateDynamicRam("travel", getRamCost(player, "sleeve", "travel"));
|
||||
const sleeveNumber = helper.number("travel", "sleeveNumber", _sleeveNumber);
|
||||
const cityName = helper.string("setToUniversityCourse", "cityName", _cityName);
|
||||
helper.updateDynamicRam("travel", getRamCost(player, "sleeve", "travel"));
|
||||
checkSleeveAPIAccess("travel");
|
||||
checkSleeveNumber("travel", sleeveNumber);
|
||||
return player.sleeves[sleeveNumber].travel(player, cityName as CityName);
|
||||
},
|
||||
setToCompanyWork: function (_sleeveNumber: unknown, acompanyName: unknown): boolean {
|
||||
helper.updateDynamicRam("setToCompanyWork", getRamCost(player, "sleeve", "setToCompanyWork"));
|
||||
const sleeveNumber = helper.number("setToCompanyWork", "sleeveNumber", _sleeveNumber);
|
||||
const companyName = helper.string("setToUniversityCourse", "companyName", acompanyName);
|
||||
helper.updateDynamicRam("setToCompanyWork", getRamCost(player, "sleeve", "setToCompanyWork"));
|
||||
checkSleeveAPIAccess("setToCompanyWork");
|
||||
checkSleeveNumber("setToCompanyWork", sleeveNumber);
|
||||
|
||||
@ -127,10 +127,10 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
||||
_factionName: unknown,
|
||||
_workType: unknown,
|
||||
): boolean | undefined {
|
||||
helper.updateDynamicRam("setToFactionWork", getRamCost(player, "sleeve", "setToFactionWork"));
|
||||
const sleeveNumber = helper.number("setToFactionWork", "sleeveNumber", _sleeveNumber);
|
||||
const factionName = helper.string("setToUniversityCourse", "factionName", _factionName);
|
||||
const workType = helper.string("setToUniversityCourse", "workType", _workType);
|
||||
helper.updateDynamicRam("setToFactionWork", getRamCost(player, "sleeve", "setToFactionWork"));
|
||||
checkSleeveAPIAccess("setToFactionWork");
|
||||
checkSleeveNumber("setToFactionWork", sleeveNumber);
|
||||
|
||||
@ -158,25 +158,25 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
||||
return player.sleeves[sleeveNumber].workForFaction(player, factionName, workType);
|
||||
},
|
||||
setToGymWorkout: function (_sleeveNumber: unknown, _gymName: unknown, _stat: unknown): boolean {
|
||||
helper.updateDynamicRam("setToGymWorkout", getRamCost(player, "sleeve", "setToGymWorkout"));
|
||||
const sleeveNumber = helper.number("setToGymWorkout", "sleeveNumber", _sleeveNumber);
|
||||
const gymName = helper.string("setToUniversityCourse", "gymName", _gymName);
|
||||
const stat = helper.string("setToUniversityCourse", "stat", _stat);
|
||||
helper.updateDynamicRam("setToGymWorkout", getRamCost(player, "sleeve", "setToGymWorkout"));
|
||||
checkSleeveAPIAccess("setToGymWorkout");
|
||||
checkSleeveNumber("setToGymWorkout", sleeveNumber);
|
||||
|
||||
return player.sleeves[sleeveNumber].workoutAtGym(player, gymName, stat);
|
||||
},
|
||||
getSleeveStats: function (_sleeveNumber: unknown): SleeveSkills {
|
||||
const sleeveNumber = helper.number("getSleeveStats", "sleeveNumber", _sleeveNumber);
|
||||
helper.updateDynamicRam("getSleeveStats", getRamCost(player, "sleeve", "getSleeveStats"));
|
||||
const sleeveNumber = helper.number("getSleeveStats", "sleeveNumber", _sleeveNumber);
|
||||
checkSleeveAPIAccess("getSleeveStats");
|
||||
checkSleeveNumber("getSleeveStats", sleeveNumber);
|
||||
return getSleeveStats(sleeveNumber);
|
||||
},
|
||||
getTask: function (_sleeveNumber: unknown): SleeveTask {
|
||||
const sleeveNumber = helper.number("getTask", "sleeveNumber", _sleeveNumber);
|
||||
helper.updateDynamicRam("getTask", getRamCost(player, "sleeve", "getTask"));
|
||||
const sleeveNumber = helper.number("getTask", "sleeveNumber", _sleeveNumber);
|
||||
checkSleeveAPIAccess("getTask");
|
||||
checkSleeveNumber("getTask", sleeveNumber);
|
||||
|
||||
@ -190,8 +190,8 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
||||
};
|
||||
},
|
||||
getInformation: function (_sleeveNumber: unknown): SleeveInformation {
|
||||
const sleeveNumber = helper.number("getInformation", "sleeveNumber", _sleeveNumber);
|
||||
helper.updateDynamicRam("getInformation", getRamCost(player, "sleeve", "getInformation"));
|
||||
const sleeveNumber = helper.number("getInformation", "sleeveNumber", _sleeveNumber);
|
||||
checkSleeveAPIAccess("getInformation");
|
||||
checkSleeveNumber("getInformation", sleeveNumber);
|
||||
|
||||
@ -256,8 +256,8 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
||||
};
|
||||
},
|
||||
getSleeveAugmentations: function (_sleeveNumber: unknown): string[] {
|
||||
const sleeveNumber = helper.number("getSleeveAugmentations", "sleeveNumber", _sleeveNumber);
|
||||
helper.updateDynamicRam("getSleeveAugmentations", getRamCost(player, "sleeve", "getSleeveAugmentations"));
|
||||
const sleeveNumber = helper.number("getSleeveAugmentations", "sleeveNumber", _sleeveNumber);
|
||||
checkSleeveAPIAccess("getSleeveAugmentations");
|
||||
checkSleeveNumber("getSleeveAugmentations", sleeveNumber);
|
||||
|
||||
@ -268,8 +268,8 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
||||
return augs;
|
||||
},
|
||||
getSleevePurchasableAugs: function (_sleeveNumber: unknown): AugmentPair[] {
|
||||
const sleeveNumber = helper.number("getSleevePurchasableAugs", "sleeveNumber", _sleeveNumber);
|
||||
helper.updateDynamicRam("getSleevePurchasableAugs", getRamCost(player, "sleeve", "getSleevePurchasableAugs"));
|
||||
const sleeveNumber = helper.number("getSleevePurchasableAugs", "sleeveNumber", _sleeveNumber);
|
||||
checkSleeveAPIAccess("getSleevePurchasableAugs");
|
||||
checkSleeveNumber("getSleevePurchasableAugs", sleeveNumber);
|
||||
|
||||
@ -286,9 +286,9 @@ export function NetscriptSleeve(player: IPlayer, workerScript: WorkerScript, hel
|
||||
return augs;
|
||||
},
|
||||
purchaseSleeveAug: function (_sleeveNumber: unknown, _augName: unknown): boolean {
|
||||
helper.updateDynamicRam("purchaseSleeveAug", getRamCost(player, "sleeve", "purchaseSleeveAug"));
|
||||
const sleeveNumber = helper.number("purchaseSleeveAug", "sleeveNumber", _sleeveNumber);
|
||||
const augName = helper.string("purchaseSleeveAug", "augName", _augName);
|
||||
helper.updateDynamicRam("purchaseSleeveAug", getRamCost(player, "sleeve", "purchaseSleeveAug"));
|
||||
checkSleeveAPIAccess("purchaseSleeveAug");
|
||||
checkSleeveNumber("purchaseSleeveAug", sleeveNumber);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user