|
| 1 | +package examples; |
| 2 | + |
| 3 | +import me.checkium.vhackapi.vHackAPI; |
| 4 | +import me.checkium.vhackapi.vHackAPIBuilder; |
| 5 | +import me.checkium.vhackapi.botnet.Bot; |
| 6 | +import me.checkium.vhackapi.botnet.BotnetManager; |
| 7 | +import me.checkium.vhackapi.botnet.BotnetTarget; |
| 8 | + |
| 9 | +public class BotnetExample { |
| 10 | + |
| 11 | + //Creating an API instance |
| 12 | + vHackAPI api = new vHackAPIBuilder().password("pass").username("user").getAPI(); |
| 13 | + //We need a botnet manager |
| 14 | + BotnetManager mgr = api.getBotnetManager(); |
| 15 | + //We need a target |
| 16 | + public void attack(BotnetTarget target){ |
| 17 | + |
| 18 | + //Let's check the input |
| 19 | + switch(target){ |
| 20 | + |
| 21 | + case KFMSolutions: |
| 22 | + if(mgr.getStrength() < 7){ |
| 23 | + //We shouldn't attack this target if our strength is under 7 |
| 24 | + System.out.println("You shouldn't attack this target"); |
| 25 | + break; |
| 26 | + |
| 27 | + } else { |
| 28 | + |
| 29 | + //We're using a boolean that will be true if the attack is successful |
| 30 | + boolean success = mgr.attack(target); |
| 31 | + if(success){ |
| 32 | + |
| 33 | + System.out.println("Attaccked KFM Solutions, got 200 NC"); |
| 34 | + |
| 35 | + } else { |
| 36 | + |
| 37 | + //We verified that we have enough strength, so if we fail the target is already attacked |
| 38 | + System.out.println("You already attacked this target"); |
| 39 | + |
| 40 | + } |
| 41 | + |
| 42 | + } |
| 43 | + case VHACKSERVER: //you could do it by yourself ;) |
| 44 | + |
| 45 | + case NETCOINBANK: //you could do it by yourself ;) |
| 46 | + |
| 47 | + } |
| 48 | + |
| 49 | + } |
| 50 | + |
| 51 | + |
| 52 | + public void getBotStats(){ |
| 53 | + //Maybe we want to see our stats |
| 54 | + //How much bots do we have? |
| 55 | + int count = mgr.getBotCount(); |
| 56 | + //Let's get bots' stats |
| 57 | + for(int i = 1; i <= count; i++){ |
| 58 | + |
| 59 | + Bot bot = mgr.getBot(i); |
| 60 | + //Get the botID |
| 61 | + System.out.println(bot.getBID()); |
| 62 | + //Get the bot level |
| 63 | + System.out.println(bot.getLevel()); |
| 64 | + //Get money needed for upgrade |
| 65 | + System.out.println(bot.getPrice()); |
| 66 | + //Maybe we could upgrade our botnets? |
| 67 | + bot.update(); |
| 68 | + try { |
| 69 | + //Let's wait half second for avoiding crashes |
| 70 | + Thread.sleep(500); |
| 71 | + } catch (InterruptedException e) { |
| 72 | + e.printStackTrace(); |
| 73 | + } |
| 74 | + |
| 75 | + } |
| 76 | + |
| 77 | + } |
| 78 | + |
| 79 | +} |
0 commit comments