Skip to content
This repository was archived by the owner on Nov 24, 2018. It is now read-only.

Commit 6ce797b

Browse files
authored
Merge pull request #39 from C0mm4nd/master
Added an example
2 parents 6abb178 + 24489ff commit 6ce797b

File tree

2 files changed

+82
-1
lines changed

2 files changed

+82
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
[![Discord](https://img.shields.io/badge/Chat-%20on%20Discord-738bd7.svg?style=flat-square)](https://discord.gg/PHgESQn) [![Build Status](https://img.shields.io/travis/OlympicCode/vHackAPI-Java.svg?style=flat-square)](https://travis-ci.org/OlympicCode/vHackAPI-Java) [![Downloads](https://img.shields.io/github/downloads/OlympicCode/vHackAPI-Java/total.svg?style=flat-square)]() [![GitHub release](https://img.shields.io/github/release/OlympicCode/vHackAPI-Java.svg?style=flat-square)]()
66

7-
### Contributors: [@Checkium](https://github.com/checkium), [@dude24760](https://github.com/dude24760), [@angelbirth](https://github.com/angelbirth), [@Qup42](https://github.com/Qup42), [@tr0teK](https://github.com/tr0teK)
7+
### Contributors: [@Checkium](https://github.com/checkium), [@dude24760](https://github.com/dude24760), [@angelbirth](https://github.com/angelbirth), [@Qup42](https://github.com/Qup42), [@tr0teK](https://github.com/tr0teK), [@C0mm4nd](https://github.com/C0mm4nd)
88
###### Don't forget to add your name here when you pull request.
99
Current feature list:
1010
- Ability to scan the network for IP addresses.
@@ -15,3 +15,5 @@ Current feature list:
1515
- Abort tasks/finish tasks with netcoin.
1616
- Open free packages.
1717
- Read/Send messages to/from the vHackXT chat.
18+
- Botnet attacks
19+
- Botnet upgrading
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
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

Comments
 (0)