Merge pull request #67 from Parabot/development

[MERGE] Development into master
This commit is contained in:
Jeroen Ketelaar
2017-01-10 11:44:18 +01:00
committed by GitHub
5 changed files with 139 additions and 17 deletions
Regular → Executable
View File
+82 -2
View File
@@ -6,7 +6,7 @@
<groupId>org.parabot</groupId>
<artifactId>317-api-minified</artifactId>
<version>1.201</version>
<version>1.202</version>
<name>Parabot 317-API-Minified</name>
<licenses>
@@ -35,7 +35,19 @@
<dependency>
<groupId>org.parabot</groupId>
<artifactId>client</artifactId>
<version>2.6.0</version>
<version>2.6.1</version>
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.parabot</groupId>
<artifactId>internal-api</artifactId>
<version>1.4.45</version>
</dependency>
</dependencies>
@@ -75,6 +87,74 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.4</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
<phase>deploy</phase>
</execution>
</executions>
<configuration>
<doctitle>${project.name} V${project.version}</doctitle>
<failOnError>false</failOnError>
<quiet>true</quiet>
<outputDirectory>${project.build.directory}/apidocs/${project.version}</outputDirectory>
<additionalparam>-Xdoclint:none</additionalparam>
</configuration>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.5.1</version>
<executions>
<execution>
<id>attach-descriptor</id>
<goals>
<goal>attach-descriptor</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<extensions>
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>2.10</version>
</extension>
</extensions>
</build>
<distributionManagement>
<downloadUrl>https://maven.parabot.org/</downloadUrl>
<repository>
<uniqueVersion>false</uniqueVersion>
<id>parabot-maven</id>
<name>Custom Maven Repository</name>
<url>ftp://maven.parabot.org</url>
<layout>default</layout>
</repository>
<site>
<id>parabot-maven</id>
<name>Frontend Parabot Maven</name>
<url>ftp://maven.parabot.org/docs/${artifactId}/</url>
</site>
</distributionManagement>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project>
@@ -30,8 +30,6 @@ public interface Client {
int getBackDialogId();
int getInputDialogState();
int getPlane();
int[] getMenuActionId();
@@ -62,4 +60,12 @@ public interface Client {
int[] getSettings();
boolean isLoggedIn();
int getInputDialogState();
long[] getFriendsListAsLong();
void addFriend(long id);
void deleteFriend(long id);
}
@@ -1,11 +1,12 @@
package org.rev317.min.api.methods;
import org.parabot.api.misc.TextUtils;
import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.SleepCondition;
import org.rev317.min.Loader;
/**
* @author Everel, JKetelaar
* @author Everel, JKetelaar, EmmaStone
*/
public class Game {
@@ -77,6 +78,15 @@ public class Game {
return Loader.getClient().getPlane();
}
/**
* Gets the friends list long values
*
* @return long values of friends list
*/
public static long[] getFriendsListAsLong() {
return Loader.getClient().getFriendsListAsLong();
}
/**
* Determines whether this client has action 4 hooked
*
@@ -160,4 +170,20 @@ public class Game {
public static void login(String username, String password) {
login(username, password, false);
}
/**
* Adds friend
* @param username String
*/
public static void addFriend(String username) {
Loader.getClient().addFriend(TextUtils.longForName(TextUtils.fixName(username)));
}
/**
* Deletes friend
* @param username String
*/
public static void deleteFriend(String username) {
Loader.getClient().deleteFriend(TextUtils.longForName(TextUtils.fixName(username)));
}
}
@@ -24,7 +24,7 @@ public class Trading {
* @return True if the requested screen is open
*/
public static boolean isOpen(boolean first){
return Loader.getClient().getOpenInterfaceId() == (first ? settings.get("first_trade_interface_id") : settings.get("second_trade_interface_id"));
return Interfaces.getOpenInterfaceId() == (first ? settings.get("first_trade_interface_id") : settings.get("second_trade_interface_id"));
}
/**
@@ -32,7 +32,7 @@ public class Trading {
* @return True if open, false if not open
*/
public static boolean isOpen(){
return Loader.getClient().getOpenInterfaceId() == settings.get("first_trade_interface_id") || Loader.getClient().getOpenInterfaceId() == settings.get("second_trade_interface_id");
return Interfaces.getOpenInterfaceId() == settings.get("first_trade_interface_id") || Interfaces.getOpenInterfaceId() == settings.get("second_trade_interface_id");
}
/**
@@ -75,7 +75,7 @@ public class Trading {
private static int[] getItemIDs(int interfaceID) {
Interface i;
if ((i = Loader.getClient().getInterfaceCache()[interfaceID]) != null) {
if ((i = Interfaces.getInterfaces()[interfaceID]) != null) {
int[] items;
if ((items = i.getItems()) != null && items.length > 0) {
return items;
@@ -87,7 +87,7 @@ public class Trading {
private static int[] getItemStacks(int interfaceID) {
Interface i;
if ((i = Loader.getClient().getInterfaceCache()[interfaceID]) != null) {
if ((i = Interfaces.getInterfaces()[interfaceID]) != null) {
int[] stacks;
if ((stacks = i.getStackSizes()) != null && stacks.length > 0) {
return stacks;
@@ -97,22 +97,32 @@ public class Trading {
}
/**
* TODO Figure a way to use packets instead
* TODO: Add the id into the settings
*
* Accepts the offer and hits the button to continue to the second screen
*/
public static void acceptOffer() {
Time.sleep(500, 750);
Mouse.getInstance().click(260, 190, true);
Time.sleep(500, 750);
Menu.clickButton(3420);
Time.sleep(new SleepCondition() {
@Override
public boolean isValid() {
return Interfaces.getOpenInterfaceId() == settings.get("second_trade_interface_id");
}
}, 2500);
}
/**
* TODO Figure a way to use packets instead
* TODO: Add the id into the settings
*
* Accepts the trade and hits the button to complete the trade
*/
public static void acceptTrade() {
Time.sleep(500, 750);
Mouse.getInstance().click(230, 310, true);
Time.sleep(500, 750);
Menu.clickButton(3546);
Time.sleep(new SleepCondition() {
@Override
public boolean isValid() {
return !isOpen();
}
}, 2500);
}
}