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

Commit 59ee8cf

Browse files
David Cookeitsfolf
David Cooke
authored andcommitted
Refactoring basically everything
1 parent 2f95111 commit 59ee8cf

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2005
-2185
lines changed
Lines changed: 70 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,79 @@
11
package examples;
22

3-
import me.checkium.vhackapi.vHackAPI;
4-
import me.checkium.vhackapi.vHackAPIBuilder;
3+
import me.checkium.vhackapi.VHackAPI;
54
import me.checkium.vhackapi.botnet.Bot;
65
import me.checkium.vhackapi.botnet.BotnetManager;
76
import me.checkium.vhackapi.botnet.BotnetTarget;
7+
import me.checkium.vhackapi.VHackAPIBuilder;
88

99
public class BotnetExample {
1010

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-
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+
16+
//We need a target
17+
public void attack(BotnetTarget target) {
18+
19+
//Let's check the input
20+
switch (target) {
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+
7979
}
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
package examples;
22

3-
import me.checkium.vhackapi.vHackAPI;
4-
import me.checkium.vhackapi.vHackAPIBuilder;
53
import me.checkium.vhackapi.chat.ChatListener;
64
import me.checkium.vhackapi.chat.ChatMessage;
5+
import me.checkium.vhackapi.VHackAPI;
6+
import me.checkium.vhackapi.VHackAPIBuilder;
7+
78
// implements ChatListener
89
public class ChatExample implements ChatListener {
9-
// Create your API instance
10-
vHackAPI api = new vHackAPIBuilder().password("pass").username("user").getAPI();
10+
// Create your API instance
11+
VHackAPI api = new VHackAPIBuilder().password("pass").username("user").getAPI();
12+
13+
public void onChatMessage(ChatMessage message) {
14+
//this is executed every message
15+
16+
if (message.getMessage().contains("!test")) {
17+
//if the message contains !test then send message with @ + message + Testing
18+
api.getChat().sendChatMessage("@" + message.getAuthor() + " Testing");
19+
}
20+
}
1121

12-
public void onChatMessage(ChatMessage message) {
13-
//this is executed every message
14-
15-
if (message.getMessage().contains("!test")) {
16-
//if the message contains !test then send message with @ + message + Testing
17-
api.getChat().sendChatMessage("@" + message.getAuthor() + " Testing");
18-
}
19-
}
20-
2122
}
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
package examples;
22

3-
import me.checkium.vhackapi.vHackAPI;
4-
import me.checkium.vhackapi.vHackAPIBuilder;
3+
import me.checkium.vhackapi.VHackAPI;
54
import me.checkium.vhackapi.packages.PackageResult;
5+
import me.checkium.vhackapi.VHackAPIBuilder;
66

77
public class PackageExample {
88

9-
vHackAPI api = new vHackAPIBuilder().password("pass").username("user").getAPI();
10-
11-
public void openPackage() {
12-
PackageResult openresult = api.getPackageManager().openPackage();
13-
System.out.println("Got " + openresult.getResultAmount() + api.humanizeString(openresult.getResultType().toString()));
14-
}
9+
VHackAPI api = new VHackAPIBuilder().password("pass").username("user").getAPI();
10+
11+
public void openPackage() {
12+
PackageResult openresult = api.getPackageManager().openPackage();
13+
System.out.println("Got " + openresult.getResultAmount() + api.humanizeString(openresult.getResultType().toString()));
14+
}
1515
}
Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
11
package examples;
22

3-
import me.checkium.vhackapi.vHackAPI;
4-
import me.checkium.vhackapi.vHackAPIBuilder;
53
import me.checkium.vhackapi.upgrades.Task;
64
import me.checkium.vhackapi.upgrades.UpgradeResult;
75
import me.checkium.vhackapi.upgrades.UpgradeType;
6+
import me.checkium.vhackapi.VHackAPI;
7+
import me.checkium.vhackapi.VHackAPIBuilder;
88

99
public class UpgradeExample {
1010

11-
vHackAPI api = new vHackAPIBuilder().password("pass").username("user").getAPI();
12-
13-
public void addUpgrade() {
14-
UpgradeResult upgrade = api.getUpgradeManager().addUpdate(UpgradeType.adw);
15-
16-
if (upgrade == UpgradeResult.NoMoney || upgrade == UpgradeResult.Invalid || upgrade == UpgradeResult.NoMemory) {
17-
System.out.println("Fail");
18-
}
19-
if (upgrade == UpgradeResult.Success) {
20-
System.out.println("Success");
21-
}
22-
}
23-
24-
public void finishUpgrade() {
25-
Task task = api.getUpgradeManager().getTasks().get(0);
26-
if (api.getUpgradeManager().finishTask(task)) {
27-
System.out.println("Task finished with netcoins successfully");
28-
}
29-
}
30-
31-
public void abortUpgrade() {
32-
Task task = api.getUpgradeManager().getTasks().get(0);
33-
if (api.getUpgradeManager().abortTask(task)) {
34-
System.out.println("Task aborted successfully");
35-
}
36-
}
11+
VHackAPI api = new VHackAPIBuilder().password("pass").username("user").getAPI();
12+
13+
public void addUpgrade() {
14+
UpgradeResult upgrade = api.getUpgradeManager().addUpdate(UpgradeType.ADW);
15+
16+
if (upgrade == UpgradeResult.NO_MONEY || upgrade == UpgradeResult.INVALID || upgrade == UpgradeResult.NO_MEMORY) {
17+
System.out.println("Fail");
18+
}
19+
if (upgrade == UpgradeResult.SUCCESS) {
20+
System.out.println("SUCCESS");
21+
}
22+
}
23+
24+
public void finishUpgrade() {
25+
Task task = api.getUpgradeManager().getTasks().get(0);
26+
if (api.getUpgradeManager().finishTask(task)) {
27+
System.out.println("Task finished with NETCOINS successfully");
28+
}
29+
}
30+
31+
public void abortUpgrade() {
32+
Task task = api.getUpgradeManager().getTasks().get(0);
33+
if (api.getUpgradeManager().abortTask(task)) {
34+
System.out.println("Task aborted successfully");
35+
}
36+
}
3737
}

0 commit comments

Comments
 (0)