36
36
public class vHackOSBot {
37
37
38
38
public static vHackOSAPI api ;
39
- static Logger LOG = LoggerFactory .getLogger ("vHackOSBot" );
40
- ConfigFile config = new ConfigFile ();
41
- AdvancedConfigFile advConfig = new AdvancedConfigFile ();
42
39
public static BotService updateService = new UpdateService ();
43
40
public static MiscService miscService = new MiscService ();
44
41
public static BotService networkingService = new NetworkingService ();
45
42
public static BotService maintenanceService = new MaintenanceService ();
43
+ static Logger LOG = LoggerFactory .getLogger ("vHackOSBot" );
44
+ ConfigFile config = new ConfigFile ();
45
+ AdvancedConfigFile advConfig = new AdvancedConfigFile ();
46
+ double curVersion = 1.9 ;
47
+ private long startTime = 0 ;
48
+
46
49
public static void main (String [] args ) {
47
50
try {
48
51
new vHackOSBot ().run ();
@@ -104,7 +107,7 @@ public void run() throws LoginException, InterruptedException {
104
107
api = new vHackOSAPIBuilder ().setUsername (ConfigValues .username ).setPassword (ConfigValues .password ).buildBlocking ();
105
108
}
106
109
checkForUpdates ();
107
- advConfig .getConfigJson ().addProperty ("login.accesstoken" , ((vHackOSAPIImpl ) api ).getAccessToken ());
110
+ advConfig .getConfigJson ().addProperty ("login.accesstoken" , ((vHackOSAPIImpl ) api ).getAccessToken ());
108
111
advConfig .getConfigJson ().addProperty ("login.uid" , ((vHackOSAPIImpl ) api ).getUid ());
109
112
advConfig .save ();
110
113
Sentry .getContext ().setUser (
@@ -145,7 +148,7 @@ public void run() throws LoginException, InterruptedException {
145
148
"Level: " + api .getStats ().getLevel () + getProgressBar ());
146
149
break ;
147
150
case "tasks" :
148
- System .out .println ("-------------------\n " + "Boosters: " + api .getTaskManager ().getBoosters () + "\n -------------------\n " + api .getTaskManager ().getActiveTasks ().stream ().map (task -> task .getType () + ": " + task .getLevel () + " " + getTimeLeft ((task .getEndTimestamp () - System .currentTimeMillis ()) ) + " left." ).collect (Collectors .joining ("\n " )) + "\n -------------------" );
151
+ System .out .println ("-------------------\n " + "Boosters: " + api .getTaskManager ().getBoosters () + "\n -------------------\n " + api .getTaskManager ().getActiveTasks ().stream ().map (task -> task .getType () + ": " + task .getLevel () + " " + getTimeLeft ((task .getEndTimestamp () - System .currentTimeMillis ())) + " left." ).collect (Collectors .joining ("\n " )) + "\n -------------------" );
149
152
break ;
150
153
case "brutes" :
151
154
System .out .println ("-------------------\n " + api .getTaskManager ().getActiveBrutes ().stream ().map (bruteForce -> bruteForce .getUsername () + ": " + bruteForce .getState ()).collect (Collectors .joining ("\n " )) + "\n -------------------" );
@@ -154,7 +157,7 @@ public void run() throws LoginException, InterruptedException {
154
157
System .out .println ("NetworkingService: " + getStatus (networkingService .getService ()) + "\n " +
155
158
"UpdateService: " + getStatus (updateService .getService ()) + "\n " +
156
159
"MiscService: " + getStatus (miscService .getService ()) + "\n " +
157
- "MainService: " + getStatus (maintenanceService .getService ()));
160
+ "MainService: " + getStatus (maintenanceService .getService ()));
158
161
break ;
159
162
case "apps" :
160
163
System .out .println ("-------------------\n " + api .getAppManager ().getApps ().stream ().map (app -> app .getType ().getName () + ": " + (app .isInstalled () ? app .getLevel () : "Not installed" )).collect (Collectors .joining ("\n " )) + "\n -------------------" );
@@ -164,7 +167,7 @@ public void run() throws LoginException, InterruptedException {
164
167
case "leaderboards" :
165
168
System .out .println ("-------------------\n " + "Current tournament pos: " + api .getLeaderboards ().getTournamentRank () +
166
169
"\n Tournament history (5, 10, 15, 30 min): " + miscService .history [0 ] + ", " + miscService .history [1 ] + ", " + miscService .history [2 ] + ", " + miscService .history [5 ] +
167
- "\n Tournament ends in: " + getTimeLeft (api .getLeaderboards ().getTournamentEndTimestamp () - System .currentTimeMillis ()) + "\n Current global pos: " + api .getLeaderboards ().getRank () + "\n -------------------" );
170
+ "\n Tournament ends in: " + getTimeLeft (api .getLeaderboards ().getTournamentEndTimestamp () - System .currentTimeMillis ()) + "\n Current global pos: " + api .getLeaderboards ().getRank () + "\n -------------------" );
168
171
break ;
169
172
case "quit" :
170
173
System .exit (0 );
@@ -188,7 +191,7 @@ private String getTimeLeft(long millis) {
188
191
TimeUnit .MILLISECONDS .toMinutes (millis ) - TimeUnit .HOURS .toMinutes (TimeUnit .MILLISECONDS .toHours (millis )),
189
192
TimeUnit .MILLISECONDS .toSeconds (millis ) - TimeUnit .MINUTES .toSeconds (TimeUnit .MILLISECONDS .toMinutes (millis )));
190
193
}
191
- private long startTime = 0 ;
194
+
192
195
private String getRunningTime () {
193
196
long millis = System .currentTimeMillis () - startTime ;
194
197
return String .format ("%02d:%02d:%02d" , TimeUnit .MILLISECONDS .toHours (millis ),
@@ -210,7 +213,7 @@ private String getProgressBar() {
210
213
builder .append ("] " + api .getStats ().getLevelPorcentage () + "%" );
211
214
return builder .toString ();
212
215
}
213
- double curVersion = 1.8 ;
216
+
214
217
public void checkForUpdates () {
215
218
Request request = (new Request .Builder ()).url ("https://api.github.com/repos/OlympicCode/vHackOSBot-Java/releases/latest" ).addHeader ("user-agent" , "Dalvik/1.6.0 (Linux; U; Android 4.4.4; SM-N935F Build/KTU84P)" ).build ();
216
219
try {
0 commit comments