3636public class vHackOSBot {
3737
3838 public static vHackOSAPI api ;
39- static Logger LOG = LoggerFactory .getLogger ("vHackOSBot" );
40- ConfigFile config = new ConfigFile ();
41- AdvancedConfigFile advConfig = new AdvancedConfigFile ();
4239 public static BotService updateService = new UpdateService ();
4340 public static MiscService miscService = new MiscService ();
4441 public static BotService networkingService = new NetworkingService ();
4542 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+
4649 public static void main (String [] args ) {
4750 try {
4851 new vHackOSBot ().run ();
@@ -104,7 +107,7 @@ public void run() throws LoginException, InterruptedException {
104107 api = new vHackOSAPIBuilder ().setUsername (ConfigValues .username ).setPassword (ConfigValues .password ).buildBlocking ();
105108 }
106109 checkForUpdates ();
107- advConfig .getConfigJson ().addProperty ("login.accesstoken" , ((vHackOSAPIImpl ) api ).getAccessToken ());
110+ advConfig .getConfigJson ().addProperty ("login.accesstoken" , ((vHackOSAPIImpl ) api ).getAccessToken ());
108111 advConfig .getConfigJson ().addProperty ("login.uid" , ((vHackOSAPIImpl ) api ).getUid ());
109112 advConfig .save ();
110113 Sentry .getContext ().setUser (
@@ -145,7 +148,7 @@ public void run() throws LoginException, InterruptedException {
145148 "Level: " + api .getStats ().getLevel () + getProgressBar ());
146149 break ;
147150 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 -------------------" );
149152 break ;
150153 case "brutes" :
151154 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 {
154157 System .out .println ("NetworkingService: " + getStatus (networkingService .getService ()) + "\n " +
155158 "UpdateService: " + getStatus (updateService .getService ()) + "\n " +
156159 "MiscService: " + getStatus (miscService .getService ()) + "\n " +
157- "MainService: " + getStatus (maintenanceService .getService ()));
160+ "MainService: " + getStatus (maintenanceService .getService ()));
158161 break ;
159162 case "apps" :
160163 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 {
164167 case "leaderboards" :
165168 System .out .println ("-------------------\n " + "Current tournament pos: " + api .getLeaderboards ().getTournamentRank () +
166169 "\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 -------------------" );
168171 break ;
169172 case "quit" :
170173 System .exit (0 );
@@ -188,7 +191,7 @@ private String getTimeLeft(long millis) {
188191 TimeUnit .MILLISECONDS .toMinutes (millis ) - TimeUnit .HOURS .toMinutes (TimeUnit .MILLISECONDS .toHours (millis )),
189192 TimeUnit .MILLISECONDS .toSeconds (millis ) - TimeUnit .MINUTES .toSeconds (TimeUnit .MILLISECONDS .toMinutes (millis )));
190193 }
191- private long startTime = 0 ;
194+
192195 private String getRunningTime () {
193196 long millis = System .currentTimeMillis () - startTime ;
194197 return String .format ("%02d:%02d:%02d" , TimeUnit .MILLISECONDS .toHours (millis ),
@@ -210,7 +213,7 @@ private String getProgressBar() {
210213 builder .append ("] " + api .getStats ().getLevelPorcentage () + "%" );
211214 return builder .toString ();
212215 }
213- double curVersion = 1.8 ;
216+
214217 public void checkForUpdates () {
215218 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 ();
216219 try {
0 commit comments