8
8
import net .olympiccode .vhackos .api .vHackOSAPIBuilder ;
9
9
import net .olympiccode .vhackos .api .vHackOSInfo ;
10
10
import net .olympiccode .vhackos .bot .core .config .AdvancedConfigFile ;
11
+ import net .olympiccode .vhackos .bot .core .config .AdvancedConfigValues ;
11
12
import net .olympiccode .vhackos .bot .core .config .ConfigFile ;
12
13
import net .olympiccode .vhackos .bot .core .config .ConfigValues ;
13
14
import net .olympiccode .vhackos .bot .core .misc .MiscConfigValues ;
@@ -95,17 +96,19 @@ public void run() throws LoginException, InterruptedException {
95
96
LOG .error ("Please set your login data in the config file" );
96
97
System .exit (0 );
97
98
}
98
- api = new vHackOSAPIBuilder ().setUsername (ConfigValues .username ).setPassword (ConfigValues .password ).buildBlocking ();
99
+ api = new vHackOSAPIBuilder ().setUsername (ConfigValues .username ).setPassword (ConfigValues .password ).buildBlocking ();
99
100
Sentry .getContext ().setUser (
100
101
new UserBuilder ().setUsername (ConfigValues .username ).build ()
101
102
);
102
103
Sentry .getContext ().recordBreadcrumb (
103
104
new BreadcrumbBuilder ().setMessage ("Service setup" ).build ()
104
105
);
105
106
try {
107
+ startTime = System .currentTimeMillis ();
106
108
if (UpdateConfigValues .enabled ) updateService .setup ();
107
109
if (MiscConfigValues .enabled ) miscService .setup ();
108
110
if (NetworkingConfigValues .enabled ) networkingService .setup ();
111
+
109
112
} catch (Exception e ) {
110
113
Sentry .capture (e );
111
114
e .printStackTrace ();
@@ -127,7 +130,7 @@ public void run() throws LoginException, InterruptedException {
127
130
break ;
128
131
case "stats" :
129
132
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 " +
131
134
"Level: " + api .getStats ().getLevel () + getProgressBar ());
132
135
break ;
133
136
case "tasks" :
@@ -173,6 +176,13 @@ private String getTimeLeft() {
173
176
TimeUnit .MILLISECONDS .toMinutes (millis ) - TimeUnit .HOURS .toMinutes (TimeUnit .MILLISECONDS .toHours (millis )),
174
177
TimeUnit .MILLISECONDS .toSeconds (millis ) - TimeUnit .MINUTES .toSeconds (TimeUnit .MILLISECONDS .toMinutes (millis )));
175
178
}
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
+ }
176
186
177
187
private String getProgressBar () {
178
188
long barnum = (Math .round (api .getStats ().getLevelPorcentage () / 10 )) - 1 ;
0 commit comments