Advertisement
sinrtb

getGrowThreadsByTargetAndStartMoney

Jan 20th, 2022
886
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //usage:  getGrowThreadsByTargetAndStartMoney(ns Object , targetInfo Object, startingMoney number, threadResoltion number)
  2. export function getGrowThreadsByTargetAndStartMoney(ns,targetInfo,startingMoney,threadResolution) {
  3.     var player = ns.getPlayer();
  4.     var server = targetInfo;
  5.     ns.clearLog();
  6.     ns.disableLog('ALL');
  7.  
  8.     server.hackDifficulty = server.minDifficulty;
  9.     server.moneyAvailable = startingMoney;
  10.  
  11.     var i = 0;
  12.     for (i = 1; server.moneyAvailable < server.moneyMax; i=i+threadResolution) {
  13.         var newGrowPercent = 0;
  14.         //growPercent(server Object, threads Number, player Object, cores Number)
  15.         newGrowPercent = growPercent(server, threadResolution, player, 1);//returns same values as growPercent from formulas.hacking.growPercent
  16.         server.moneyAvailable = (server.moneyAvailable * newGrowPercent);
  17.        
  18.     }
  19. return i;
  20. }
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement