NETSCRIPT: reduce RAM cost for renamePurchasedServer to 0 (#450)

This commit is contained in:
Zelow79 2023-03-28 16:01:09 -04:00 committed by GitHub
parent a1441b31f2
commit eb8bcd00e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 12 deletions

@ -494,7 +494,7 @@ export const RamCosts: RamCostTree<NSFull> = {
getPurchasedServerCost: RamCostConstants.GetPurchaseServer, getPurchasedServerCost: RamCostConstants.GetPurchaseServer,
getPurchasedServerUpgradeCost: 0.1, getPurchasedServerUpgradeCost: 0.1,
upgradePurchasedServer: 0.25, upgradePurchasedServer: 0.25,
renamePurchasedServer: 2, renamePurchasedServer: 0,
purchaseServer: RamCostConstants.PurchaseServer, purchaseServer: RamCostConstants.PurchaseServer,
deleteServer: RamCostConstants.PurchaseServer, deleteServer: RamCostConstants.PurchaseServer,
getPurchasedServers: RamCostConstants.PurchaseServer, getPurchasedServers: RamCostConstants.PurchaseServer,

@ -1254,6 +1254,7 @@ export const ns: InternalAPI<NSFull> = {
return -1; return -1;
} }
}, },
upgradePurchasedServer: (ctx) => (_hostname, _ram) => { upgradePurchasedServer: (ctx) => (_hostname, _ram) => {
const hostname = helpers.string(ctx, "hostname", _hostname); const hostname = helpers.string(ctx, "hostname", _hostname);
const ram = helpers.number(ctx, "ram", _ram); const ram = helpers.number(ctx, "ram", _ram);
@ -1265,17 +1266,11 @@ export const ns: InternalAPI<NSFull> = {
return false; return false;
} }
}, },
renamePurchasedServer: (ctx) => (_hostname, _newName) => { renamePurchasedServer: (ctx) => (_hostname, _newName) => {
const hostname = helpers.string(ctx, "hostname", _hostname); const hostname = helpers.string(ctx, "hostname", _hostname);
const newName = helpers.string(ctx, "newName", _newName); const newName = helpers.string(ctx, "newName", _newName);
try {
renamePurchasedServer(hostname, newName); renamePurchasedServer(hostname, newName);
return true;
} catch (err) {
helpers.log(ctx, () => String(err));
return false;
}
return false;
}, },
deleteServer: (ctx) => (_name) => { deleteServer: (ctx) => (_name) => {

@ -6082,13 +6082,12 @@ export interface NS {
/** /**
* Rename a purchased server. * Rename a purchased server.
* @remarks * @remarks
* RAM cost: 2.00 GB * RAM cost: 0 GB
* *
* @param hostname - Current server hostname. * @param hostname - Current server hostname.
* @param newName - New server hostname. * @param newName - New server hostname.
* @returns True if the upgrade succeeded, and false otherwise.
*/ */
renamePurchasedServer(hostname: string, newName: string): boolean; renamePurchasedServer(hostname: string, newName: string): void;
/** /**
* Delete a purchased server. * Delete a purchased server.