Merge pull request #60 from Parabot/development

[MERGE] Development into master
This commit is contained in:
Jeroen Ketelaar
2016-10-24 01:29:10 +02:00
committed by GitHub
13 changed files with 207 additions and 92 deletions
+54
View File
@@ -0,0 +1,54 @@
language: java
jdk:
- oraclejdk7
- oraclejdk8
before_install:
- chmod +x ./.travis/maven-build.sh
- chmod +x ./.travis/call-creation.sh
- mvn clean
install:
- sudo apt-get update && sudo apt-get --assume-yes install zip unzip
script: "./.travis/maven-build.sh"
after_deploy: "./.travis/call-creation.sh"
notifications:
email: false
slack:
secure: osWX769z0hSVPbeF1ZHSENgR4i+VKFTMGFNIV02RhvZ4a1BXsGUG5VCCDYUoBzWPCA5avJHg+FrN7nEEaoIjc5/qqFmZFGwOitZJsOzvR8C18QcgyuEX+35U4eQF4h5ITpruvwNNQ/7hIWyPl/fEPcAswHFDAccEb5iRNJeFNeM=
webhooks:
on_success: always
on_failure: always
on_start: never
env:
global:
- PROVIDER_VERSION=1.201
cache:
directories:
- ".autoconf"
- "$HOME/.m2"
deploy:
- provider: s3
access_key_id: AKIAJDZLZNH2PIKHUKOA
secret_access_key:
secure: Opk2uGg0CyBIeqDX5EIu6UBRjaxjZwfNVNsjGbsA8QWjIu2zIUwFe1ZWJEkqzF5jqrN8ykgHw74ofrgZyBKH2nhGn7MN4wWWktKN4iIeq2D6gf8Cq31tzZcpgEfUaJnARXtu0jjCKag2PqglQAEc/OgVEeEFuUapJ0I4ITDZWbk=
bucket: parabot
skip_cleanup: true
local-dir: "./target/final/"
upload-dir: "artifacts/provider"
region: us-west-1
detect_encoding: true
acl: public_read
on:
repo: Parabot/Parabot-317-API-Minified
branch:
- master
- development
jdk: 'oraclejdk7'
+4
View File
@@ -0,0 +1,4 @@
#! /bin/bash
sleep 1
curl --data "build_id=$TRAVIS_BUILD_ID&version=$PROVIDER_VERSION" "http://v3.bdn.parabot.org/api/bot/create/provider"
+7
View File
@@ -0,0 +1,7 @@
#! /bin/bash
if [ "$TRAVIS_BRANCH" == "master" ]; then
mvn -U package
else
mvn -Dbuild.version="-RC-$TRAVIS_BUILD_ID" -U package
fi
+25 -33
View File
@@ -6,7 +6,7 @@
<groupId>org.parabot</groupId> <groupId>org.parabot</groupId>
<artifactId>317-api-minified</artifactId> <artifactId>317-api-minified</artifactId>
<version>1.15</version> <version>1.201</version>
<name>Parabot 317-API-Minified</name> <name>Parabot 317-API-Minified</name>
<licenses> <licenses>
@@ -19,6 +19,7 @@
<properties> <properties>
<jdk.version>1.7</jdk.version> <jdk.version>1.7</jdk.version>
<build.version></build.version>
<additionalparam>-Xdoclint:none</additionalparam> <additionalparam>-Xdoclint:none</additionalparam>
</properties> </properties>
@@ -34,12 +35,12 @@
<dependency> <dependency>
<groupId>org.parabot</groupId> <groupId>org.parabot</groupId>
<artifactId>client</artifactId> <artifactId>client</artifactId>
<version>2.6</version> <version>2.6.0</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<finalName>${artifactId}-V${version}</finalName> <finalName>Provider-V${version}${build.version}</finalName>
<plugins> <plugins>
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
@@ -50,39 +51,30 @@
<target>${jdk.version}</target> <target>${jdk.version}</target>
</configuration> </configuration>
</plugin> </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> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId> <artifactId>maven-assembly-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<outputDirectory>${project.build.directory}/final/</outputDirectory>
<appendAssemblyId>false</appendAssemblyId>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<!-- bind to the packaging phase -->
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin> </plugin>
</plugins> </plugins>
</reporting> </build>
</project> </project>
@@ -20,6 +20,8 @@ public interface Client {
void setInterface(int id); void setInterface(int id);
void setAmountOrNameInput(int amount);
int[] getCurrentExp(); int[] getCurrentExp();
Deque[][][] getGroundItems(); Deque[][][] getGroundItems();
@@ -28,6 +30,8 @@ public interface Client {
int getBackDialogId(); int getBackDialogId();
int getInputDialogState();
int getPlane(); int getPlane();
int[] getMenuActionId(); int[] getMenuActionId();
@@ -45,10 +49,14 @@ public interface Client {
// args switched // args switched
boolean walkTo(int clickType, int sizeX, int sizeY, int startX, int startY, int destX, int destY, int type, int face, boolean arbitrary, int rotation); boolean walkTo(int clickType, int sizeX, int sizeY, int startX, int startY, int destX, int destY, int type, int face, boolean arbitrary, int rotation);
boolean walkToPKH(boolean flag1, boolean flag2, int clickType, int sizeX, int sizeY, int startX, int startY, int destX, int destY, int type, int face, boolean arbitrary, int rotation);
void doAction(int i); void doAction(int i);
void dropClient(); void dropClient();
void login(String username, String password, boolean reconnecting);
int[] getCurrentStats(); int[] getCurrentStats();
int[] getSettings(); int[] getSettings();
@@ -31,16 +31,21 @@ public class Game {
* Gets open interface id * Gets open interface id
* *
* @return interface id * @return interface id
* @deprecated Use {@link Interfaces #getOpenInterfaceId()} instead
*/ */
@Deprecated
public static int getOpenInterfaceId() { public static int getOpenInterfaceId() {
return Loader.getClient().getOpenInterfaceId(); return Loader.getClient().getOpenInterfaceId();
} }
/** /**
* Get open back dialog id * Get open back dialog id
* *
* @return back dialog id * @return back dialog id
* @deprecated Use {@link Interfaces #getBackDialogId()} instead
*/ */
@Deprecated
public static int getOpenBackDialogId() { public static int getOpenBackDialogId() {
return Loader.getClient().getBackDialogId(); return Loader.getClient().getBackDialogId();
} }
@@ -90,10 +95,9 @@ public class Game {
* Returns the settings within the client * Returns the settings within the client
* *
* @param index The index of the setting you want to gather * @param index The index of the setting you want to gather
*
* @return The specific setting for the given index * @return The specific setting for the given index
*/ */
public static int getSetting(int index){ public static int getSetting(int index) {
return Loader.getClient().getSettings()[index]; return Loader.getClient().getSettings()[index];
} }
@@ -102,7 +106,7 @@ public class Game {
* *
* @return All settings * @return All settings
*/ */
public static int[] getSettings(){ public static int[] getSettings() {
return Loader.getClient().getSettings(); return Loader.getClient().getSettings();
} }
@@ -118,15 +122,16 @@ public class Game {
/** /**
* Just simply drops the client * Just simply drops the client
*/ */
public static void dropClient(){ public static void dropClient() {
Loader.getClient().dropClient(); Loader.getClient().dropClient();
} }
/** /**
* Drops the client and returns if the game is logged out or not * Drops the client and returns if the game is logged out or not
*
* @return True if game is logged out, false if not * @return True if game is logged out, false if not
*/ */
public static boolean confirmedDropClient(){ public static boolean confirmedDropClient() {
Loader.getClient().dropClient(); Loader.getClient().dropClient();
Time.sleep(new SleepCondition() { Time.sleep(new SleepCondition() {
@Override @Override
@@ -137,4 +142,22 @@ public class Game {
return !isLoggedIn(); return !isLoggedIn();
} }
/**
* Login to a server
* @param username String
* @param password String
* @param reconnecting True if it's a retry, false if not
*/
public static void login(String username, String password, boolean reconnecting) {
Loader.getClient().login(username, password, reconnecting);
}
/**
* Login to a server
* @param username String
* @param password String
*/
public static void login(String username, String password) {
login(username, password, false);
}
} }
@@ -13,70 +13,96 @@ public class Interfaces {
/** /**
* Get's the interfaces loaded in the interface Cache. * Get's the interfaces loaded in the interface Cache.
*
* @return Interfaces in the Interface Cache. * @return Interfaces in the Interface Cache.
*/ */
public static Interface[] getInterfaces(){ public static Interface[] getInterfaces() {
return Loader.getClient().getInterfaceCache(); return Loader.getClient().getInterfaceCache();
} }
/** /**
* Get's the Interface from the Interface Cache using the given ID. * Get's the Interface from the Interface Cache using the given ID.
*
* @param id Interface ID. * @param id Interface ID.
* @return Interface from the cache by the given ID. * @return Interface from the cache by the given ID.
*/ */
public static Interface getInterface(int id){ public static Interface getInterface(int id) {
return getInterfaces()[id]; return getInterfaces()[id];
} }
/** /**
* Opens the Interface by the given ID. * Opens the Interface by the given ID.
*
* @param id ID of the Interface to Open. * @param id ID of the Interface to Open.
*/ */
public static void openInterface(int id){ public static void openInterface(int id) {
Loader.getClient().setInterface(id); Loader.getClient().setInterface(id);
} }
/**
* Sets the int by the given Amount
*
* @param amount Amount to set
*/
public static void setAmountOrNameInput(int amount) {
Loader.getClient().setAmountOrNameInput(amount);
}
/** /**
* Get's the Open Interface ID. * Get's the Open Interface ID.
*
* @return The ID of the Open Interface , will be -1 if all Interfaces are closed. * @return The ID of the Open Interface , will be -1 if all Interfaces are closed.
*/ */
public static int getOpenInterfaceId(){ public static int getOpenInterfaceId() {
return Loader.getClient().getOpenInterfaceId(); return Loader.getClient().getOpenInterfaceId();
} }
/** /**
* Get's the Open Back Dialog ID. * Get's the Open Back Dialog ID.
*
* @return The ID of the Open Back Dialog , will be -1 if all Back Dialogs are closed. * @return The ID of the Open Back Dialog , will be -1 if all Back Dialogs are closed.
*/ */
public static int getBackDialogId(){ public static int getBackDialogId() {
return Loader.getClient().getBackDialogId(); return Loader.getClient().getBackDialogId();
} }
/**
* Get current input dialog state
*
* @return input dialog state
*/
public static int getInputDialogState() {
return Loader.getClient().getInputDialogState();
}
/** /**
* Checks if the Interface or Back Dialog by the given ID is Open. * Checks if the Interface or Back Dialog by the given ID is Open.
*
* @param id ID of the Interface or Back Dialog to check for. * @param id ID of the Interface or Back Dialog to check for.
* @return True is the Interface or Back Dialog is Open else will return false. * @return True is the Interface or Back Dialog is Open else will return false.
*/ */
public static boolean isOpen(int id){ public static boolean isOpen(int id) {
return getOpenInterfaceId() == id || getBackDialogId() == id; return getOpenInterfaceId() == id || getBackDialogId() == id;
} }
/** /**
* Checks if the Interface by the given ID is Open. * Checks if the Interface by the given ID is Open.
* @param id ID of the Interface or Back Dialog to check for depending on the backDialog boolean. *
* @param id ID of the Interface or Back Dialog to check for depending on the backDialog boolean.
* @param backDialog When tru it will check the Bank Dialog ID else it will check for the Interface ID. * @param backDialog When tru it will check the Bank Dialog ID else it will check for the Interface ID.
* @return True is the Interface or Back Dialog is Open else will return false. * @return True is the Interface or Back Dialog is Open else will return false.
*/ */
public static boolean isOpen(int id, boolean backDialog){ public static boolean isOpen(int id, boolean backDialog) {
if(backDialog){ if (backDialog) {
return getBackDialogId() == id; return getBackDialogId() == id;
}else{ } else {
return getOpenInterfaceId() == id; return getOpenInterfaceId() == id;
} }
} }
/** /**
* Clicks an option from the given back dialog * Clicks an option from the given back dialog
*
* @param index Index of the requested option whereas you start at 0 * @param index Index of the requested option whereas you start at 0
*/ */
public static void clickBackDialogOption(int index) { public static void clickBackDialogOption(int index) {
@@ -296,4 +296,3 @@ public class Inventory {
return false; return false;
} }
} }
@@ -32,10 +32,9 @@ public class Menu {
/** /**
* Interacts with a sceneobject * Interacts with a sceneobject
* *
* @deprecated
*
* @param object * @param object
* @param actionIndex * @param actionIndex
* @deprecated
*/ */
public static void interact(SceneObject object, int actionIndex) { public static void interact(SceneObject object, int actionIndex) {
int actionId = SceneObjects.Option.FIRST.getActionId(); int actionId = SceneObjects.Option.FIRST.getActionId();
@@ -86,10 +85,9 @@ public class Menu {
/** /**
* Interacts with a character * Interacts with a character
* *
* @deprecated
*
* @param character * @param character
* @param actionIndex * @param actionIndex
* @deprecated
*/ */
public static void interact(Character character, int actionIndex) { public static void interact(Character character, int actionIndex) {
int actionId = 20; int actionId = 20;
@@ -129,11 +127,10 @@ public class Menu {
/** /**
* Interacts with an item when it has the following menu Transform-1 Transform-5 Transform-10 etc.. * Interacts with an item when it has the following menu Transform-1 Transform-5 Transform-10 etc..
* *
* @deprecated
*
* @param item * @param item
* @param actionIndex * @param actionIndex
* @param interfaceParentId * @param interfaceParentId
* @deprecated
*/ */
public static void transformItem(Item item, int actionIndex, public static void transformItem(Item item, int actionIndex,
int interfaceParentId) { int interfaceParentId) {
@@ -181,10 +178,9 @@ public class Menu {
/** /**
* Interacts with a ground item * Interacts with a ground item
* *
* @deprecated
*
* @param item * @param item
* @param action * @param action
* @deprecated
*/ */
public static void interact(GroundItem item, int action) { public static void interact(GroundItem item, int action) {
int actionId = GroundItems.Option.FIRST.getActionId(); int actionId = GroundItems.Option.FIRST.getActionId();
@@ -208,16 +204,16 @@ public class Menu {
sendAction(actionId, item.getId(), item.getX(), item.getY()); sendAction(actionId, item.getId(), item.getX(), item.getY());
} }
public static void interact(Item item, Items.Option action){ public static void interact(Item item, Items.Option action) {
sendAction(action.getActionId(), item.getId() - 1, item.getSlot(), 3214); sendAction(action.getActionId(), item.getId() - 1, item.getSlot(), 3214);
} }
/** /**
* @deprecated * @deprecated
*/ */
public static void interact(Item item, int action){ public static void interact(Item item, int action) {
int actionId = 447; int actionId = 447;
switch (action){ switch (action) {
case 0: case 0:
actionId = 447; actionId = 447;
break; break;
@@ -237,9 +233,9 @@ public class Menu {
/** /**
* @deprecated * @deprecated
*/ */
public static void interact(Item item, String action){ public static void interact(Item item, String action) {
int actionId = 447; int actionId = 447;
switch (action.toLowerCase()){ switch (action.toLowerCase()) {
case "use": case "use":
actionId = 447; actionId = 447;
break; break;
@@ -317,7 +313,6 @@ public class Menu {
* @param index * @param index
*/ */
public static void sendAction(int action, int cmd1, int cmd2, int cmd3, int cmd4, int index) { public static void sendAction(int action, int cmd1, int cmd2, int cmd3, int cmd4, int index) {
Client client = Loader.getClient(); Client client = Loader.getClient();
client.getMenuAction1()[index] = cmd1; client.getMenuAction1()[index] = cmd1;
@@ -105,26 +105,26 @@ public class Prayer {
} }
public enum Curse implements Book { public enum Curse implements Book {
PROTECT_ITEM_CURSE(0, 0, 50), PROTECT_ITEM_CURSE(601, 22503, 50),
SAP_WARRIOR(0, 0, 50), SAP_WARRIOR(611, 22505, 50),
SAP_RANGER(0, 0, 52), SAP_RANGER(612, 22507, 52),
SAP_MAGE(0, 0, 54), SAP_MAGE(613, 22509, 54),
SAP_SPIRIT(0, 0, 56), SAP_SPIRIT(614, 22511, 56),
BERSERKER(0, 0, 59), BERSERKER(615, 22513, 59),
DEFLECT_SUMMONING(0, 0, 62), DEFLECT_SUMMONING(616, 22515, 62),
DEFLECT_MAGIC(0, 0, 65), DEFLECT_MAGIC(617, 22517, 65),
DEFLECT_MISSILE(0, 0, 68), DEFLECT_MISSILE(618, 22519, 68),
DEFLECT_MELEE(0, 0, 71), DEFLECT_MELEE(619, 22521, 71),
LEECH_ATTACK(0, 0, 74), LEECH_ATTACK(620, 22523, 74),
LEECH_RANGE(0, 0, 76), LEECH_RANGE(621, 22525, 76),
LEECH_MAGIC(0, 0, 78), LEECH_MAGIC(622, 22527, 78),
LEECH_DEFENCE(0, 0, 80), LEECH_DEFENCE(623, 22529, 80),
LEECH_STRENGTH(0, 0, 82), LEECH_STRENGTH(624, 22531, 82),
LEECH_ENERGY(0, 0, 84), LEECH_ENERGY(625, 22533, 84),
LEECH_SPECIAL_ATTACK(0, 0, 86), LEECH_SPECIAL_ATTACK(626, 22535, 86),
WRATH(0, 0, 89), WRATH(627, 22537, 89),
SOUL_SPLIT(0, 0, 92), SOUL_SPLIT(628, 22539, 92),
TURMOIL(0, 0, 95); TURMOIL(629, 22541, 95);
private int setting; private int setting;
private int action; private int action;
@@ -1,5 +1,7 @@
package org.rev317.min.api.methods; package org.rev317.min.api.methods;
import org.parabot.core.Context;
import org.rev317.min.Loader; import org.rev317.min.Loader;
import org.rev317.min.api.wrappers.Tile; import org.rev317.min.api.wrappers.Tile;
import org.rev317.min.api.wrappers.TilePath; import org.rev317.min.api.wrappers.TilePath;
@@ -16,7 +18,11 @@ public class Walking {
* @param to Tile to Walk To. * @param to Tile to Walk To.
*/ */
public static void walkTo(Tile from, Tile to) { public static void walkTo(Tile from, Tile to) {
Loader.getClient().walkTo(0, 0, 0, 0, from.getRegionY(), 0, 0, to.getRegionY(), from.getRegionX(), true, to.getRegionX()); if (Context.getInstance().getServerProviderInfo().getServerName().equalsIgnoreCase("pkhonor")) {
Loader.getClient().walkToPKH(false, false, 0, 0, 0, 0, from.getLocation().getRegionY(), 0, 0, to.getRegionY(), from.getLocation().getRegionX(), true, to.getRegionX());
} else {
Loader.getClient().walkTo(0, 0, 0, 0, from.getRegionY(), 0, 0, to.getRegionY(), from.getRegionX(), true, to.getRegionX());
}
} }
/** /**
@@ -25,7 +31,7 @@ public class Walking {
* @param to Destination Tile. * @param to Destination Tile.
*/ */
public static void walkTo(Tile to) { public static void walkTo(Tile to) {
Loader.getClient().walkTo(0, 0, 0, 0, Players.getMyPlayer().getLocation().getRegionY(), 0, 0, to.getRegionY(), Players.getMyPlayer().getLocation().getRegionX(), true, to.getRegionX()); walkTo(Players.getMyPlayer().getLocation(), to);
} }
/** /**
@@ -3,7 +3,7 @@ package org.rev317.min.debug;
import org.parabot.core.Context; import org.parabot.core.Context;
import org.parabot.core.paint.AbstractDebugger; import org.parabot.core.paint.AbstractDebugger;
import org.parabot.core.paint.PaintDebugger; import org.parabot.core.paint.PaintDebugger;
import org.rev317.min.api.methods.Game; import org.rev317.min.api.methods.Interfaces;
import java.awt.*; import java.awt.*;
@@ -13,8 +13,8 @@ public class DInterfaces extends AbstractDebugger {
@Override @Override
public void paint(Graphics g) { public void paint(Graphics g) {
PaintDebugger p = Context.getInstance().getPaintDebugger(); PaintDebugger p = Context.getInstance().getPaintDebugger();
p.addLine("Open interface: " + Game.getOpenInterfaceId()); p.addLine("Open interface: " + Interfaces.getOpenInterfaceId());
p.addLine("Open back dialog: " + Game.getOpenBackDialogId()); p.addLine("Open back dialog: " + Interfaces.getBackDialogId());
} }
@Override @Override
+5 -4
View File
@@ -65,18 +65,19 @@ public class BotMenu implements ActionListener {
debug.add(players); debug.add(players);
actions.addSeparator(); actions.addSeparator();
ButtonGroup group = new ButtonGroup();
for (int i = 0; i < MenuAction.getOutputs().length; i++){ for (int i = 0; i < MenuAction.getOutputs().length; i++){
final int index = i; final int index = i;
JMenuItem debugOutput = new JCheckBoxMenuItem("Output: " + index); JMenuItem debugOutput = new JRadioButtonMenuItem("Output: " + index);
debugOutput.addActionListener(new ActionListener() { debugOutput.addActionListener(new ActionListener() {
@Override @Override
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
MenuAction.setCurrentOutputIndex(index); MenuAction.setCurrentOutputIndex(index);
} }
}); });
if (i == 0){ group.add(debugOutput);
debugOutput.setEnabled(true);
}
actions.add(debugOutput); actions.add(debugOutput);
} }