Merge pull request #2873 from SagePtr/purchaseserver-args

Add user-friendly invalid argument number message to purchaseServer
This commit is contained in:
hydroflame 2022-03-08 16:39:54 -05:00 committed by GitHub
commit 570b8caf78
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1628,6 +1628,7 @@ export function NetscriptFunctions(workerScript: WorkerScript): NS {
return cost; return cost;
}, },
purchaseServer: function (aname: any, aram: any): any { purchaseServer: function (aname: any, aram: any): any {
if (arguments.length !== 2) throw makeRuntimeErrorMsg("purchaseServer", "Takes 2 arguments");
const name = helper.string("purchaseServer", "name", aname); const name = helper.string("purchaseServer", "name", aname);
const ram = helper.number("purchaseServer", "ram", aram); const ram = helper.number("purchaseServer", "ram", aram);
updateDynamicRam("purchaseServer", getRamCost(Player, "purchaseServer")); updateDynamicRam("purchaseServer", getRamCost(Player, "purchaseServer"));