Add 'runelite-api/' from commit '934060b327413003846e150fd3296421c3ca8a19'

git-subtree-dir: runelite-api
git-subtree-mainline: 3db8786720370327a5c51682c551e2fbb6a497a7
git-subtree-split: 934060b327
This commit is contained in:
Adam
2016-04-25 18:54:52 -04:00
57 changed files with 14135 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
package net.runelite.api;
public abstract class Actor extends Renderable
{
private Client client;
private net.runelite.rs.api.Actor actor;
public Actor(Client client, net.runelite.rs.api.Actor actor)
{
super(actor);
this.client = client;
this.actor = actor;
}
public abstract String getName();
public Actor getInteracting()
{
int i = actor.getInteracting();
if (i == -1)
{
return null;
}
// logic taken from runeloader.
if (i < 32767)
{
return client.getNpcs()[i];
}
// XXX is this correct for i = 32767 ?
i = i - 32767 - 1;
return client.getPlayers()[i];
}
public int getHealth()
{
return actor.getHealth();
}
public int getMaxHealth()
{
return actor.getMaxHealth();
}
}

View File

@@ -0,0 +1,60 @@
package net.runelite.api;
import java.util.Arrays;
public class Client
{
private net.runelite.rs.api.Client client;
public Client(net.runelite.rs.api.Client client)
{
this.client = client;
}
public Player getLocalPlayer()
{
if (client.getLocalPlayer() == null)
return null;
return new Player(this, client.getLocalPlayer());
}
public NPC[] getNpcs()
{
return Arrays.stream(client.getCachedNPCs())
.map(npc -> npc != null ? new NPC(this, npc) : null)
.toArray(size -> new NPC[size]);
}
public Player[] getPlayers()
{
return Arrays.stream(client.getCachedPlayers())
.map(player -> player != null ? new Player(this, player) : null)
.toArray(size -> new Player[size]);
}
public int[] getBoostedSkillLevels()
{
return client.getBoostedSkillLevels();
}
public int[] getRealSkillLevels()
{
return client.getRealSkillLevels();
}
public int[] getSkillExperiences()
{
return client.getSkillExperiences();
}
public void sendGameMessage(String message)
{
client.sendGameMessage(99, "", message);
}
public GameState getGameState()
{
return GameState.of(client.getGameState());
}
}

View File

@@ -0,0 +1,27 @@
package net.runelite.api;
public enum GameState
{
UNKNOWN(-1),
STARTING(0),
LOGIN_SCREEN(10),
LOGGING_IN(20),
LOADING(25),
LOGGED_IN(30),
HOPPING(45);
private final int state;
GameState(int state)
{
this.state = state;
}
public static GameState of(int state)
{
for (GameState gs : GameState.values())
if (gs.state == state)
return gs;
return UNKNOWN;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
package net.runelite.api;
import net.runelite.rs.api.NPCComposition;
public class NPC extends Actor
{
private net.runelite.rs.api.NPC npc;
public NPC(Client client, net.runelite.rs.api.NPC npc)
{
super(client, npc);
this.npc = npc;
}
@Override
public String getName()
{
return npc.getComposition().getName();
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,21 @@
package net.runelite.api;
public class Player extends Actor
{
private Client client;
private net.runelite.rs.api.Player player;
public Player(Client client, net.runelite.rs.api.Player player)
{
super(client, player);
this.player = player;
this.client = client;
}
@Override
public String getName()
{
return player.getName();
}
}

View File

@@ -0,0 +1,11 @@
package net.runelite.api;
public class Renderable
{
private net.runelite.rs.api.Renderable renderable;
public Renderable(net.runelite.rs.api.Renderable renderable)
{
this.renderable = renderable;
}
}

View File

@@ -0,0 +1,40 @@
package net.runelite.api;
public enum Skill
{
ATTACK("Attack"),
DEFENCE("Defence"),
STRENGTH("Strength"),
HITPOINTS("Hitpoints"),
RANGED("Ranged"),
PRAYER("Prayer"),
MAGIC("Magic"),
COOKING("Cooking"),
WOODCUTTING("Woodcutting"),
FLETCHING("Fletching"),
FISHING("Fishing"),
FIREMARKING("Firemarking"),
CRAFTING("Crafting"),
SMITHING("Smithing"),
MINING("Mining"),
HERBLORE("Herblore"),
AGILITY("Agility"),
THIEVING("Thieving"),
SLAYER("Slayer"),
FARMING("Farming"),
RUNECRAFT("Runecraft"),
HUNTER("Hunter"),
CONSTRUCTION("Construction");
private final String name;
Skill(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
}

View File

@@ -0,0 +1,13 @@
package net.runelite.mapping;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface Export
{
String value();
}

View File

@@ -0,0 +1,13 @@
package net.runelite.mapping;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Implements
{
String value();
}

View File

@@ -0,0 +1,13 @@
package net.runelite.mapping;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD})
public @interface Import
{
String value();
}

View File

@@ -0,0 +1,15 @@
package net.runelite.mapping;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ObfuscatedGetter
{
int intValue() default 0;
long longValue() default 0L;
}

View File

@@ -0,0 +1,13 @@
package net.runelite.mapping;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.FIELD, ElementType.METHOD, ElementType.TYPE})
public @interface ObfuscatedName
{
String value();
}

View File

@@ -0,0 +1,13 @@
package net.runelite.mapping;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface ObfuscatedOverride
{
String value();
}

View File

@@ -0,0 +1,15 @@
package net.runelite.mapping;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.CONSTRUCTOR})
public @interface ObfuscatedSignature
{
String signature();
String garbageValue() default ""; // valid garbage value for last parameter. can't be an Object because Java.
}

View File

@@ -0,0 +1,13 @@
package net.runelite.mapping;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Replace
{
String value();
}

View File

@@ -0,0 +1,39 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Actor extends Renderable
{
@Import("interacting")
int getInteracting();
@Import("interactingObjects")
int getInteractingObjects();
@Import("inSequence")
boolean inSequence();
@Import("overhead")
String getOverhead();
@Import("loopCycle")
int getLoopCycle();
@Import("health")
int getHealth();
@Import("maxHealth")
int getMaxHealth();
@Import("x")
int getX();
@Import("y")
int getY();
@Import("animation")
int getAnimation();
@Import("hitSplats")
int[] getHitSplats();
}

View File

@@ -0,0 +1,12 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Buffer
{
@Import("payload")
byte[] getPayload();
@Import("offset")
int getOffset();
}

View File

@@ -0,0 +1,12 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface CacheableNode
{
@Import("next")
CacheableNode getNext();
@Import("previous")
CacheableNode getPrevious();
}

View File

@@ -0,0 +1,17 @@
package net.runelite.rs.api;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import net.runelite.mapping.Import;
public interface ClassInfo
{
@Import("methods")
Method[] getMethods();
@Import("fields")
Field[] getFields();
@Import("args")
byte[][][] getArgs();
}

View File

@@ -0,0 +1,186 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Client extends GameEngine
{
@Import("cameraX")
int getCameraX();
@Import("cameraY")
int getCameraY();
@Import("cameraZ")
int getCameraZ();
@Import("plane")
int getPlane();
@Import("cameraPitch")
int getCameraPitch();
@Import("cameraYaw")
int getCameraYaw();
@Import("world")
int getWorld();
@Import("FPS")
int getFPS();
@Import("mapScale")
int getMapScale();
@Import("mapAngle")
int getMapAngle();
@Import("tileHeights")
int[][][] getTileHeights();
@Import("tileSettings")
byte[][][] getTileSettings();
@Import("settings")
int[] getSettings();
@Import("widgetSettings")
int[] getWidgetSettings();
@Import("energy")
int getEnergy();
@Import("weight")
int getWeight();
@Import("baseX")
int getBaseX();
@Import("baseY")
int getBaseY();
@Import("boostedSkillLevels")
int[] getBoostedSkillLevels();
@Import("realSkillLevels")
int[] getRealSkillLevels();
@Import("skillExperiences")
int[] getSkillExperiences();
@Import("gameState")
int getGameState();
@Import("widgets")
Widget[][] getWidgets();
@Import("region")
Region getRegion();
@Import("localPlayer")
Player getLocalPlayer();
@Import("cachedNPCs")
NPC[] getCachedNPCs();
@Import("collisionMaps")
CollisionData[] getCollisionMaps();
@Import("cachedPlayers")
Player[] getCachedPlayers();
@Import("groundItemDeque")
Deque[][][] getGroundItemDeque();
@Import("username")
String getUsername();
@Import("menuActions")
String[] getMenuActions();
@Import("menuTargets")
String[] getMenuTargets();
@Import("menuOptions")
String[] getMenuOptions();
@Import("menuOptionCount")
int getMenuOptionCount();
@Import("menuTypes")
int[] getMenuTypes();
@Import("menuIdentifiers")
int[] getMenuIdentifiers();
@Import("friends")
Friend[] getFriends();
@Import("ignores")
Ignore[] getIgnores();
@Import("worldList")
World[] getWorldList();
@Import("rootInterface")
int getRootInterface();
//void setUsername(String var1);
@Import("sendGameMessage")
void sendGameMessage(int var1, String var2, String var3);
//void hopToWorld(String var1, int var2, int var3);
@Import("objectDefinition")
ObjectComposition getObjectDefinition(int var1);
//void setScale(int var1);
@Import("scale")
int getScale();
@Import("camera2")
int getCamera2();
@Import("camera3")
int getCamera3();
@Import("validInterfaces")
boolean[] getValidInterfaces();
@Import("isResized")
boolean isResized();
@Import("widgetPositionX")
int[] getWidgetPositionsX();
@Import("widgetPositionY")
int[] getWidgetPositionsY();
@Import("itemContainers")
XHashTable getItemContainers();
@Import("componentTable")
XHashTable getComponentTable();
@Import("grandExchangeOffers")
XGrandExchangeOffer[] getGrandExchangeOffers();
@Import("activeInterface")
Widget getActiveInterface();
@Import("clanMembers")
XClanMember[] getClanMembers();
@Import("isMenuOpen")
boolean isMenuOpen();
@Import("packetOpcode")
int getPacketOpcode();
@Import("gameCycle")
int getGameCycle();
@Import("packetHandler")
void packetHandler();
}

View File

@@ -0,0 +1,9 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface CollisionData
{
@Import("flags")
int[][] getFlags();
}

View File

@@ -0,0 +1,12 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Deque
{
@Import("current")
Node getCurrent();
@Import("head")
Node getHead();
}

View File

@@ -0,0 +1,16 @@
package net.runelite.rs.api;
import java.io.RandomAccessFile;
import net.runelite.mapping.Import;
public interface FileOnDisk
{
@Import("file")
RandomAccessFile getFile();
@Import("position")
long getPosition();
@Import("length")
long getLength();
}

View File

@@ -0,0 +1,15 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Friend
{
@Import("name")
String getName();
@Import("previousName")
String getPreviousName();
@Import("world")
int getWorld();
}

View File

@@ -0,0 +1,5 @@
package net.runelite.rs.api;
public interface GameEngine
{
}

View File

@@ -0,0 +1,42 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface GameObject
{
@Import("renderable")
Renderable getRenderable();
@Import("plane")
int getPlane();
@Import("relativeX")
int getRelativeX();
@Import("relativeY")
int getRelativeY();
@Import("offsetX")
int getOffsetX();
@Import("offsetY")
int getOffsetY();
@Import("x")
int getX();
@Import("y")
int getY();
@Import("height")
int getHeight();
@Import("orientation")
int getOrientation();
@Import("hash")
int getHash();
@Import("flags")
int getFlags();
}

View File

@@ -0,0 +1,12 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Ignore
{
@Import("name")
String getName();
@Import("previousName")
String getPreviousName();
}

View File

@@ -0,0 +1,12 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Item extends Renderable
{
@Import("id")
int getId();
@Import("quantity")
int getQuantity();
}

View File

@@ -0,0 +1,15 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface ItemComposition
{
@Import("name")
String getName();
@Import("isMembers")
boolean isMembers();
@Import("maleModel")
int getMaleModel();
}

View File

@@ -0,0 +1,30 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface ItemLayer
{
@Import("x")
int getX();
@Import("y")
int getY();
@Import("hash")
int getHash();
@Import("flags")
int getFlags();
@Import("height")
int getHeight();
@Import("bottom")
Renderable getBottom();
@Import("middle")
Renderable getMiddle();
@Import("top")
Renderable getTop();
}

View File

@@ -0,0 +1,15 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface MessageNode
{
@Import("type")
int getType();
@Import("sender")
String getSender();
@Import("value")
String getValue();
}

View File

@@ -0,0 +1,5 @@
package net.runelite.rs.api;
public interface Model
{
}

View File

@@ -0,0 +1,9 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface NPC extends Actor
{
@Import("composition")
NPCComposition getComposition();
}

View File

@@ -0,0 +1,30 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface NPCComposition
{
@Import("name")
String getName();
@Import("models")
int[] getModels();
@Import("actions")
String[] getActions();
@Import("isClickable")
boolean isClickable();
@Import("isMinimapVisible")
boolean isMinimapVisable();
@Import("isVisible")
boolean isVisable();
@Import("id")
int getId();
@Import("combatLevel")
int getCombatLevel();
}

View File

@@ -0,0 +1,15 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Node
{
@Import("next")
Node getNext();
@Import("hash")
long getHash();
@Import("previous")
Node getPrevious();
}

View File

@@ -0,0 +1,12 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface ObjectComposition
{
@Import("name")
String getName();
@Import("actions")
String[] getActions();
}

View File

@@ -0,0 +1,24 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Player extends Actor
{
@Import("composition")
PlayerComposition getComposition();
@Import("name")
String getName();
@Import("model")
Model getModel();
@Import("combatLevel")
int getCombatLevel();
@Import("totalLevel")
int getTotalLevel();
@Import("team")
int getTeam();
}

View File

@@ -0,0 +1,18 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface PlayerComposition
{
@Import("isFemale")
boolean isFemale();
@Import("equipment")
int[] getEquipment();
@Import("bodyPartColours")
int[] getBodyPartColours();
@Import("bodyParts")
int[] getBodyParts();
}

View File

@@ -0,0 +1,24 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Projectile
{
@Import("isMoving")
boolean isMoving();
@Import("animationSequence")
Sequence getAnimationSequence();
@Import("velocityY")
double getVelocityY();
@Import("velocityX")
double getVelocityX();
@Import("velocityZ")
double getVelocityZ();
@Import("scalar")
double getScalar();
}

View File

@@ -0,0 +1,5 @@
package net.runelite.rs.api;
public interface RSCanvas
{
}

View File

@@ -0,0 +1,12 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Region
{
@Import("objects")
GameObject[] getObjects();
@Import("tiles")
Tile[][][] getTiles();
}

View File

@@ -0,0 +1,9 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Renderable extends Node
{
@Import("modelHeight")
int getModelHeight();
}

View File

@@ -0,0 +1,21 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Sequence
{
@Import("stretches")
boolean getStretches();
@Import("maxLoops")
int getMaxLoops();
@Import("precedenceAnimating")
int getPrecedenceAnimating();
@Import("replyMode")
int getReplyMode();
@Import("interleaveLeave")
int[] getInterleaveLeave();
}

View File

@@ -0,0 +1,5 @@
package net.runelite.rs.api;
public interface SpritePixels
{
}

View File

@@ -0,0 +1,21 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Tile
{
@Import("objects")
GameObject[] getObjects();
@Import("itemLayer")
ItemLayer getItemLayer();
@Import("x")
int getX();
@Import("y")
int getY();
@Import("plane")
int getPlane();
}

View File

@@ -0,0 +1,108 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface Widget
{
@Import("parent")
Widget getParent();
@Import("dynamicValues")
int[][] getDynamicValues();
@Import("children")
Widget[] getChildren();
@Import("id")
int getId();
@Import("parentId")
int getParentId();
@Import("boundsIndex")
int getBoundsIndex();
@Import("modelId")
int getModelId();
@Import("itemIds")
int[] getItemIds();
@Import("itemQuantities")
int[] getItemQuantities();
@Import("modelType")
int getModelType();
@Import("actions")
String[] getActions();
@Import("text")
String getText();
@Import("name")
String getName();
@Import("textColor")
int getTextColor();
@Import("opacity")
int getOpacity();
@Import("relativeX")
int getRelativeX();
@Import("relativeY")
int getRelativeY();
@Import("width")
int getWidth();
@Import("height")
int getHeight();
@Import("isHidden")
boolean isHidden();
@Import("index")
int getIndex();
@Import("rotationX")
int getRotationX();
@Import("rotationY")
int getRotationY();
@Import("rotationZ")
int getRotationZ();
@Import("contentType")
int getContentType();
@Import("type")
int getType();
@Import("scrollX")
int getScrollX();
@Import("scrollY")
int getScrollY();
@Import("textureId")
int getTextureId();
@Import("borderThickness")
int getBorderThickness();
@Import("itemId")
int getItemId();
@Import("itemQuantity")
int getItemQuantity();
@Import("x")
int getX();
@Import("y")
int getY();
}

View File

@@ -0,0 +1,9 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface WidgetNode
{
@Import("id")
int getId();
}

View File

@@ -0,0 +1,27 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface World
{
@Import("mask")
int getMask();
@Import("playerCount")
int getPlayerCount();
@Import("location")
int getLocation();
@Import("index")
int getIndex();
@Import("id")
int getId();
@Import("activity")
String getActivity();
@Import("address")
String getAddress();
}

View File

@@ -0,0 +1,15 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface XClanMember
{
@Import("username")
String getUsernameName();
@Import("world")
int getWorld();
@Import("rank")
byte getRank();
}

View File

@@ -0,0 +1,24 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface XGrandExchangeOffer
{
@Import("quantitySold")
int getQuantitySold();
@Import("itemId")
int getItemId();
@Import("totalQuantity")
int getTotalQuantity();
@Import("price")
int getPrice();
@Import("spent")
int getSpent();
@Import("progress")
byte getProgress();
}

View File

@@ -0,0 +1,6 @@
package net.runelite.rs.api;
public interface XHashTable
{
//Node get(long var1);
}

View File

@@ -0,0 +1,12 @@
package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface XItemContainer extends Node
{
@Import("itemIds")
int[] getItemIds();
@Import("stackSizes")
int[] getStackSizes();
}

View File

@@ -0,0 +1,5 @@
package net.runelite.rs.api;
public interface XSprite
{
}