mirror of
https://github.com/bitburner-official/bitburner-src.git
synced 2024-11-26 09:33:49 +01:00
NETSCRIPT: reduce RAM cost for renamePurchasedServer to 0 (#450)
This commit is contained in:
parent
a1441b31f2
commit
eb8bcd00e3
@ -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) => {
|
||||||
|
5
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
5
src/ScriptEditor/NetscriptDefinitions.d.ts
vendored
@ -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.
|
||||||
|
Loading…
Reference in New Issue
Block a user