Skip to content
Draft
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ notifications:

env:
global:
- PROVIDER_VERSION=2.0.2
- PROVIDER_VERSION=2.0.3

cache:
directories:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>org.parabot.servers</groupId>
<artifactId>317-api-minified-runewild</artifactId>
<version>2.0.2</version>
<version>2.0.3</version>
<name>Parabot 317-API-Minified RuneWild</name>

<licenses>
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/rev317/min/Loader.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.parabot.environment.servers.ServerProvider;
import org.parabot.environment.servers.Type;
import org.rev317.min.accessors.Client;
import org.rev317.min.randoms.UUIDSpoofer;
import org.rev317.min.script.ScriptEngine;
import org.rev317.min.ui.BotMenu;

Expand Down Expand Up @@ -105,5 +106,6 @@ public void unloadScript(Script script) {

@Override
public void init() {
ScriptEngine.getInstance().addLoginListener(new UUIDSpoofer());
}
}
}
4 changes: 3 additions & 1 deletion src/main/java/org/rev317/min/accessors/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public interface Client {

int[] getMenuActionId();

long[] getMenuHash();

int[] getMenuAction1();

int[] getMenuAction2();
Expand All @@ -57,7 +59,7 @@ public interface Client {

void dropClient();

void login(String username, String password, boolean reconnecting);
void login(boolean reconnecting, String emailAddress, String username, String password);

int[] getCurrentStats();

Expand Down
6 changes: 6 additions & 0 deletions src/main/java/org/rev317/min/accessors/SceneObjectTile.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.rev317.min.accessors;

public interface SceneObjectTile {

long getHash();
}
25 changes: 25 additions & 0 deletions src/main/java/org/rev317/min/api/events/LoginEvent.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package org.rev317.min.api.events;

public final class LoginEvent {
private final String username;
private final String password;
private final boolean flag;

public LoginEvent(String username, String password, boolean flag) {
this.username = username;
this.password = password;
this.flag = flag;
}

public String getUsername() {
return username;
}

public String getPassword() {
return password;
}

public boolean isFlag() {
return flag;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.rev317.min.api.events.listeners;

import org.rev317.min.api.events.LoginEvent;

public interface LoginListener {

void loginReceived(LoginEvent event);
}
139 changes: 139 additions & 0 deletions src/main/java/org/rev317/min/api/methods/Equipment.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
package org.rev317.min.api.methods;

import org.parabot.environment.api.utils.Time;
import org.parabot.environment.scripts.framework.SleepCondition;
import org.rev317.min.Loader;
import org.rev317.min.api.wrappers.Item;

/**
* @author Piet Jetse Heeringa
*/

public class Equipment {

/**
* Equips an Item based on the ID of that item.
*
* @param id Item ID to Equip.
*/
public static void equip(final int id) {
Item item = Inventory.getItem(id);
if (item != null) {
item.interact(Items.Option.WEAR);
Time.sleep(new SleepCondition() {
@Override
public boolean isValid() {
return isWearing(id);
}
}, 3000);
}
}

/**
* Unequips an Item based on the ID of that item.
*
* @param id Item ID to Unequip.
*/
public static void unequip(int id) {
for (Slot slot : Slot.values()) {
if (slot.id() == id) {
unequip(slot);
}
}
}

/**
* Unequips the item from the given Slot.
*
* @param slot Slot to Unequip the item from.
*/
public static void unequip(final Slot slot) {
Menu.sendAction(632, slot.id() - 1, slot.slot, 1688, 3);
Time.sleep(new SleepCondition() {
@Override
public boolean isValid() {
return slot.id() == 0;
}
}, 3000);
}

/**
* Check if the Player is Wearing an Item based on the ID.
*
* @param id ID of the item to check for.
*
* @return True if the Player is wearing the Item.
*/
public static boolean isWearing(int id) {
for (Slot slot : Slot.values()) {
if (slot.id() == id) {
return true;
}
}

return false;
}

/**
* Get's the item ID in slot.
*
* @param slot Slot to get the item ID from.
*
* @return Item ID from given slot.
*/
public static int getItemId(Slot slot) {
return slot.id();
}

/**
* Check's if there is an item in the given slot.
*
* @param slot Slot to check for Item.
*
* @return True if there is an Item in the given slot.
*/
public static boolean hasItem(Slot slot) {
return getItemId(slot) != 0;
}

/**
* Check's if the given slot is empty.
*
* @param slot Slot to check for Item.
*
* @return True if the given slot is empty.
*/
public static boolean isEmpty(Slot slot) {
return getItemId(slot) == 0;
}

public enum Slot {
HEAD(0),
CAPE(1),
AMMULET(2),
WEAPON(3),
BODY(4),
SHIELD(5),
LEGS(7),
GLOVES(9),
BOOTS(10),
RING(12),
AMMO(13);

private final int INTERFACE_ID = 1688;
private int slot;

Slot(int slot) {
this.slot = slot;
}

/**
* Get's the ID of the item in slot.
*
* @return ID of the item in slot.
*/
public int id() {
return Loader.getClient().getInterfaceCache()[INTERFACE_ID].getItems()[slot];
}
}
}
Loading