Advertisement
The3vilM0nk3y

symptoms

Apr 17th, 2022
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. /** @param {NS} ns */
  2. export async function main(ns) {
  3. var target = ns.args[0];
  4.  
  5. var moneyThresh = ns.getServerMaxMoney(target) * 0.75;
  6.  
  7. // Defines the maximum security level the target server can
  8. // have. If the target's security level is higher than this,
  9. // we'll weaken it before doing anything else
  10. var securityThresh = ns.getServerMinSecurityLevel(target) + 5;
  11. // Infinite loop that continously hacks/grows/weakens the target server
  12. while(true) {
  13. if (ns.getServerSecurityLevel(target) > securityThresh) {
  14. // If the server's security level is above our threshold, weaken it
  15. await ns.weaken(target);
  16. } else if (ns.getServerMoneyAvailable(target) < moneyThresh) {
  17. // If the server's money is less than our threshold, grow it
  18. await ns.grow(target);
  19. } else {
  20. // Otherwise, hack it
  21. await ns.hack(target);
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement