88import net .olympiccode .vhackos .api .vHackOSAPIBuilder ;
99import net .olympiccode .vhackos .api .vHackOSInfo ;
1010import net .olympiccode .vhackos .bot .core .config .AdvancedConfigFile ;
11+ import net .olympiccode .vhackos .bot .core .config .AdvancedConfigValues ;
1112import net .olympiccode .vhackos .bot .core .config .ConfigFile ;
1213import net .olympiccode .vhackos .bot .core .config .ConfigValues ;
1314import net .olympiccode .vhackos .bot .core .misc .MiscConfigValues ;
@@ -95,17 +96,19 @@ public void run() throws LoginException, InterruptedException {
9596 LOG .error ("Please set your login data in the config file" );
9697 System .exit (0 );
9798 }
98- api = new vHackOSAPIBuilder ().setUsername (ConfigValues .username ).setPassword (ConfigValues .password ).buildBlocking ();
99+ api = new vHackOSAPIBuilder ().setUsername (ConfigValues .username ).setPassword (ConfigValues .password ).buildBlocking ();
99100 Sentry .getContext ().setUser (
100101 new UserBuilder ().setUsername (ConfigValues .username ).build ()
101102 );
102103 Sentry .getContext ().recordBreadcrumb (
103104 new BreadcrumbBuilder ().setMessage ("Service setup" ).build ()
104105 );
105106 try {
107+ startTime = System .currentTimeMillis ();
106108 if (UpdateConfigValues .enabled ) updateService .setup ();
107109 if (MiscConfigValues .enabled ) miscService .setup ();
108110 if (NetworkingConfigValues .enabled ) networkingService .setup ();
111+
109112 } catch (Exception e ) {
110113 Sentry .capture (e );
111114 e .printStackTrace ();
@@ -127,7 +130,7 @@ public void run() throws LoginException, InterruptedException {
127130 break ;
128131 case "stats" :
129132 System .out .println ("Username: " + api .getStats ().getUsername () + SEPARATOR + "Money: " + api .getStats ().getMoney () + SEPARATOR + "Netcoins: " + api .getStats ().getNetcoins () +
130- "\n " + "Exploits: " + api .getStats ().getExploits () + SEPARATOR + "IP: " + api .getStats ().getIpAddress () + "\n " +
133+ "\n " + "Exploits: " + api .getStats ().getExploits () + SEPARATOR + "IP: " + api .getStats ().getIpAddress () + SEPARATOR + " Running for: " + getRunningTime () + "\n " +
131134 "Level: " + api .getStats ().getLevel () + getProgressBar ());
132135 break ;
133136 case "tasks" :
@@ -173,6 +176,13 @@ private String getTimeLeft() {
173176 TimeUnit .MILLISECONDS .toMinutes (millis ) - TimeUnit .HOURS .toMinutes (TimeUnit .MILLISECONDS .toHours (millis )),
174177 TimeUnit .MILLISECONDS .toSeconds (millis ) - TimeUnit .MINUTES .toSeconds (TimeUnit .MILLISECONDS .toMinutes (millis )));
175178 }
179+ private long startTime = 0 ;
180+ private String getRunningTime () {
181+ long millis = System .currentTimeMillis () - startTime ;
182+ return String .format ("%02d:%02d:%02d" , TimeUnit .MILLISECONDS .toHours (millis ),
183+ TimeUnit .MILLISECONDS .toMinutes (millis ) - TimeUnit .HOURS .toMinutes (TimeUnit .MILLISECONDS .toHours (millis )),
184+ TimeUnit .MILLISECONDS .toSeconds (millis ) - TimeUnit .MINUTES .toSeconds (TimeUnit .MILLISECONDS .toMinutes (millis )));
185+ }
176186
177187 private String getProgressBar () {
178188 long barnum = (Math .round (api .getStats ().getLevelPorcentage () / 10 )) - 1 ;
0 commit comments