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

Added an example #39

Merged
merged 3 commits into from
Feb 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[![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)]()

### 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)
### 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)
###### Don't forget to add your name here when you pull request.
Current feature list:
- Ability to scan the network for IP addresses.
Expand All @@ -15,3 +15,5 @@ Current feature list:
- Abort tasks/finish tasks with netcoin.
- Open free packages.
- Read/Send messages to/from the vHackXT chat.
- Botnet attacks
- Botnet upgrading
79 changes: 79 additions & 0 deletions src/main/java/examples/BotnetExample.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
package examples;

import me.checkium.vhackapi.vHackAPI;
import me.checkium.vhackapi.vHackAPIBuilder;
import me.checkium.vhackapi.botnet.Bot;
import me.checkium.vhackapi.botnet.BotnetManager;
import me.checkium.vhackapi.botnet.BotnetTarget;

public class BotnetExample {

//Creating an API instance
vHackAPI api = new vHackAPIBuilder().password("pass").username("user").getAPI();
//We need a botnet manager
BotnetManager mgr = api.getBotnetManager();
//We need a target
public void attack(BotnetTarget target){

//Let's check the input
switch(target){

case KFMSolutions:
if(mgr.getStrength() < 7){
//We shouldn't attack this target if our strength is under 7
System.out.println("You shouldn't attack this target");
break;

} else {

//We're using a boolean that will be true if the attack is successful
boolean success = mgr.attack(target);
if(success){

System.out.println("Attaccked KFM Solutions, got 200 NC");

} else {

//We verified that we have enough strength, so if we fail the target is already attacked
System.out.println("You already attacked this target");

}

}
case VHACKSERVER: //you could do it by yourself ;)

case NETCOINBANK: //you could do it by yourself ;)

}

}


public void getBotStats(){
//Maybe we want to see our stats
//How much bots do we have?
int count = mgr.getBotCount();
//Let's get bots' stats
for(int i = 1; i <= count; i++){

Bot bot = mgr.getBot(i);
//Get the botID
System.out.println(bot.getBID());
//Get the bot level
System.out.println(bot.getLevel());
//Get money needed for upgrade
System.out.println(bot.getPrice());
//Maybe we could upgrade our botnets?
bot.update();
try {
//Let's wait half second for avoiding crashes
Thread.sleep(500);
} catch (InterruptedException e) {
e.printStackTrace();
}

}

}

}