runelite-api: add PlayerComposition and KitType enum
This commit is contained in:
@@ -22,7 +22,6 @@
|
|||||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.runelite.api;
|
package net.runelite.api;
|
||||||
|
|
||||||
public class Player extends Actor
|
public class Player extends Actor
|
||||||
@@ -49,5 +48,9 @@ public class Player extends Actor
|
|||||||
{
|
{
|
||||||
return player.getCombatLevel();
|
return player.getCombatLevel();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
public PlayerComposition getPlayerComposition()
|
||||||
|
{
|
||||||
|
return new PlayerComposition(player.getComposition());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.api;
|
||||||
|
|
||||||
|
import net.runelite.api.kit.KitType;
|
||||||
|
|
||||||
|
public class PlayerComposition
|
||||||
|
{
|
||||||
|
private final net.runelite.rs.api.PlayerComposition playerComposition;
|
||||||
|
|
||||||
|
public PlayerComposition(net.runelite.rs.api.PlayerComposition playerComposition)
|
||||||
|
{
|
||||||
|
this.playerComposition = playerComposition;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get equipment ids. If id is >= 256 && < 512 then subtract 256 and the id is a kit definition.
|
||||||
|
* If the id is >= 512 then subtract 512 and the id is an item id.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public int[] getEquipmentIds()
|
||||||
|
{
|
||||||
|
return playerComposition.getEquipmentIds();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getEquipmentId(KitType type)
|
||||||
|
{
|
||||||
|
int id = getEquipmentIds()[type.getIndex()];
|
||||||
|
if (id < 512)
|
||||||
|
{
|
||||||
|
return -1; // not an item
|
||||||
|
}
|
||||||
|
return id - 512;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getKitId(KitType type)
|
||||||
|
{
|
||||||
|
int id = getEquipmentIds()[type.getIndex()];
|
||||||
|
if (id < 256 || id >= 512)
|
||||||
|
{
|
||||||
|
return -1; // not a kit
|
||||||
|
}
|
||||||
|
return id - 256;
|
||||||
|
}
|
||||||
|
}
|
||||||
53
runelite-api/src/main/java/net/runelite/api/kit/KitType.java
Normal file
53
runelite-api/src/main/java/net/runelite/api/kit/KitType.java
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Adam <Adam@sigterm.info>
|
||||||
|
* All rights reserved.
|
||||||
|
*
|
||||||
|
* Redistribution and use in source and binary forms, with or without
|
||||||
|
* modification, are permitted provided that the following conditions are met:
|
||||||
|
*
|
||||||
|
* 1. Redistributions of source code must retain the above copyright notice, this
|
||||||
|
* list of conditions and the following disclaimer.
|
||||||
|
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||||
|
* this list of conditions and the following disclaimer in the documentation
|
||||||
|
* and/or other materials provided with the distribution.
|
||||||
|
*
|
||||||
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||||
|
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||||
|
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||||
|
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||||
|
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||||
|
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||||
|
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||||
|
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||||
|
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||||
|
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
*/
|
||||||
|
package net.runelite.api.kit;
|
||||||
|
|
||||||
|
public enum KitType
|
||||||
|
{
|
||||||
|
CAPE(1),
|
||||||
|
AMULET(2),
|
||||||
|
WEAPON(3),
|
||||||
|
TORSO(4),
|
||||||
|
SHIELD(5),
|
||||||
|
LEGS(7),
|
||||||
|
HEAD(8),
|
||||||
|
HANDS(9),
|
||||||
|
BOOTS(10),
|
||||||
|
JAW(11);
|
||||||
|
|
||||||
|
/** index into player composition equipment ids
|
||||||
|
*/
|
||||||
|
private final int index;
|
||||||
|
|
||||||
|
private KitType(int index)
|
||||||
|
{
|
||||||
|
this.index = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getIndex()
|
||||||
|
{
|
||||||
|
return index;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -32,9 +32,6 @@ public interface PlayerComposition
|
|||||||
@Import("isFemale")
|
@Import("isFemale")
|
||||||
boolean isFemale();
|
boolean isFemale();
|
||||||
|
|
||||||
@Import("equipment")
|
|
||||||
int[] getEquipment();
|
|
||||||
|
|
||||||
@Import("bodyPartColours")
|
@Import("bodyPartColours")
|
||||||
int[] getBodyPartColours();
|
int[] getBodyPartColours();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user