Update API for 162

This commit is contained in:
Adam
2018-02-01 12:20:37 -05:00
parent 0325150267
commit 00ef622144
15 changed files with 306 additions and 71 deletions

View File

@@ -101,7 +101,7 @@ public interface Client extends GameEngine
int[] getWidgetPositionsX();
int[] getWidgetPositionsY();
int getEnergy();
String[] getPlayerOptions();
@@ -132,10 +132,6 @@ public interface Client extends GameEngine
int getSetting(Varbits varbit);
int getClanChatCount();
ClanMember[] getClanMembers();
HashTable getComponentTable();
boolean isPrayerActive(Prayer prayer);
@@ -168,38 +164,37 @@ public interface Client extends GameEngine
IndexedSprite createIndexedSprite();
boolean isFriended(String name, boolean mustBeLoggedIn);
boolean isIgnored(String name);
boolean isClanMember(String name);
Point getSceneDestinationLocation();
List<Projectile> getProjectiles();
/**
* Play a sound effect at the player's current location.
* This is how UI, and player-generated (e.g. mining, woodcutting) sound effects are normally played
* Play a sound effect at the player's current location. This is how UI,
* and player-generated (e.g. mining, woodcutting) sound effects are
* normally played
*
* @param id the ID of the sound to play. Any int is allowed, but see {@link SoundEffectID} for some common ones
* @param id the ID of the sound to play. Any int is allowed, but see
* {@link SoundEffectID} for some common ones
*/
void playSoundEffect(int id);
/**
* Play a sound effect from some point in the world.
*
* @param id the ID of the sound to play. Any int is allowed, but see {@link SoundEffectID} for some common ones
* @param id the ID of the sound to play. Any int is allowed, but see
* {@link SoundEffectID} for some common ones
* @param x the ground coordinate on the x axis
* @param y the ground coordinate on the y axis
* @param range the number of tiles away that the sound can be heard from
* @param range the number of tiles away that the sound can be heard
* from
*/
void playSoundEffect(int id, int x, int y, int range);
boolean getDrawBoundingBoxes2D();
/**
* When {@code shouldDraw} is true, a 2D bounding box will be drawn for all on-screen objects
* When {@code shouldDraw} is true, a 2D bounding box will be drawn for
* all on-screen objects
*
* @param shouldDraw whether or not to draw 2D bounding boxes
*/
@@ -209,8 +204,9 @@ public interface Client extends GameEngine
/**
* When {@code shouldDraw} is true, 3D bounding boxes will be drawn
* either for the object under the cursor, or every object on screen
* according to {@link #setBoundingBoxAlwaysOnMode(boolean) BoundingBoxAlwaysOnMode}
* either for the object under the cursor, or every object on screen
* according to
* {@link #setBoundingBoxAlwaysOnMode(boolean) BoundingBoxAlwaysOnMode}
*
* @param shouldDraw whether or not to draw 3D bounding boxes
*/
@@ -219,7 +215,8 @@ public interface Client extends GameEngine
boolean getdrawObjectGeometry2D();
/**
* When {@code shouldDraw} is true, the clickbox geometry for the object under the cursor will be displayed
* When {@code shouldDraw} is true, the clickbox geometry for the object
* under the cursor will be displayed
*
* @param shouldDraw whether or not to draw the clickbox geometry
*/
@@ -229,10 +226,12 @@ public interface Client extends GameEngine
/**
* Changes how {@link #getDrawBoundingBoxes3D()} behaves when active.
* When {@code alwaysDrawBoxes} is true, 3D bounding boxes will be drawn.
* When false, a 3D bounding box will only be drawn for the object under the cursor
* When {@code alwaysDrawBoxes} is true, 3D bounding boxes will be
* drawn. When false, a 3D bounding box will only be drawn for the
* object under the cursor
*
* @param alwaysDrawBoxes whether or not to draw every 3D bounding box, when 3D bounding boxes are enabled
* @param alwaysDrawBoxes whether or not to draw every 3D bounding box,
* when 3D bounding boxes are enabled
*/
void setBoundingBoxAlwaysOnMode(boolean alwaysDrawBoxes);
@@ -243,14 +242,16 @@ public interface Client extends GameEngine
int getKeyboardIdleTicks();
/**
* Changes how game behaves based on memory mode. Low memory mode skips drawing of all floors and renders ground
* textures in low quality.
* Changes how game behaves based on memory mode. Low memory mode skips
* drawing of all floors and renders ground textures in low quality.
*
* @param lowMemory if we are running in low memory mode or not
*/
void changeMemoryMode(boolean lowMemory);
/**
* Get the item container for an inventory
*
* @param inventory
* @return
*/
@@ -267,4 +268,12 @@ public interface Client extends GameEngine
void setStringStackSize(int stackSize);
String[] getStringStack();
boolean isFriended(String name, boolean mustBeLoggedIn);
int getClanChatCount();
ClanMember[] getClanMembers();
boolean isClanMember(String name);
}

View File

@@ -36,4 +36,8 @@ public interface Player extends Actor
Polygon[] getPolygons();
int getTeam();
boolean isClanMember();
boolean isFriend();
}

View File

@@ -32,6 +32,13 @@ import net.runelite.rs.api.RSClanMember;
@Mixin(RSClanMember.class)
public abstract class RSClanMemberMixin implements RSClanMember
{
@Override
@Inject
public String getUsername()
{
return getName().getName();
}
@Override
@Inject
public ClanMemberRank getRank()

View File

@@ -27,6 +27,7 @@ package net.runelite.mixins;
import java.util.ArrayList;
import java.util.List;
import net.runelite.api.ChatMessageType;
import net.runelite.api.ClanMember;
import net.runelite.api.GameState;
import net.runelite.api.IndexedSprite;
import net.runelite.api.InventoryID;
@@ -40,7 +41,6 @@ import net.runelite.api.Prayer;
import net.runelite.api.Projectile;
import net.runelite.api.Skill;
import net.runelite.api.Varbits;
import net.runelite.api.events.ClanMembersChanged;
import net.runelite.api.events.ExperienceChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.MapRegionChanged;
@@ -54,11 +54,13 @@ import net.runelite.api.mixins.Shadow;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetInfo;
import static net.runelite.client.callback.Hooks.eventBus;
import net.runelite.rs.api.RSClanMemberManager;
import net.runelite.rs.api.RSClient;
import net.runelite.rs.api.RSDeque;
import net.runelite.rs.api.RSHashTable;
import net.runelite.rs.api.RSIndexedSprite;
import net.runelite.rs.api.RSItemContainer;
import net.runelite.rs.api.RSName;
import net.runelite.rs.api.RSWidget;
@Mixin(RSClient.class)
@@ -371,7 +373,7 @@ public abstract class RSClientMixin implements RSClient
@Override
public boolean getBoundingBoxAlwaysOnMode()
{
return getboundingBox3DDrawMode() == getALWAYSDrawMode();
return getboundingBox3DDrawMode() == getALWAYSDrawMode();
}
@Inject
@@ -406,6 +408,38 @@ public abstract class RSClientMixin implements RSClient
return (RSItemContainer) itemContainers.get(inventory.getId());
}
@Inject
@Override
public boolean isFriended(String name, boolean mustBeLoggedIn)
{
RSName rsName = createName(name, getLoginType());
return getFriendManager().isFriended(rsName, mustBeLoggedIn);
}
@Inject
@Override
public int getClanChatCount()
{
final RSClanMemberManager clanMemberManager = getClanMemberManager();
return clanMemberManager != null ? clanMemberManager.getCount() : 0;
}
@Inject
@Override
public ClanMember[] getClanMembers()
{
final RSClanMemberManager clanMemberManager = getClanMemberManager();
return clanMemberManager != null ? (ClanMember[]) getClanMemberManager().getNameables() : null;
}
@Inject
@Override
public boolean isClanMember(String name)
{
final RSClanMemberManager clanMemberManager = getClanMemberManager();
return clanMemberManager != null && clanMemberManager.isMember(createName(name, getLoginType()));
}
@FieldHook("skillExperiences")
@Inject
public static void experiencedChanged(int idx)
@@ -457,14 +491,6 @@ public abstract class RSClientMixin implements RSClient
eventBus.post(varbitChanged);
}
@FieldHook("clanMembers")
@Inject
public static void clanMembersChanged(int idx)
{
ClanMembersChanged clanMembersChanged = new ClanMembersChanged();
eventBus.post(clanMembersChanged);
}
@FieldHook("isResized")
@Inject
public static void resizeChanged(int idx)

View File

@@ -48,7 +48,7 @@ public abstract class RSPlayerMixin implements RSPlayer
@Override
public String getName()
{
String name = getRSName();
String name = getRsName().getName();
if (name == null)
{

View File

@@ -27,12 +27,10 @@ package net.runelite.rs.api;
import net.runelite.api.ClanMember;
import net.runelite.mapping.Import;
public interface RSClanMember extends ClanMember
public interface RSClanMember extends RSNameable, ClanMember
{
@Import("username")
String getUsername();
@Import("world")
@Override
int getWorld();
@Import("rank")

View File

@@ -0,0 +1,30 @@
/*
* Copyright (c) 2018, 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.rs.api;
public interface RSClanMemberManager extends RSNameableContainer
{
}

View File

@@ -201,12 +201,6 @@ public interface RSClient extends RSGameEngine, Client
@Import("menuActionParams1")
int[] getMenuActionParams1();
@Import("friends")
RSFriend[] getFriends();
@Import("ignores")
RSIgnore[] getIgnores();
@Import("worldList")
RSWorld[] getWorldList();
@@ -259,13 +253,6 @@ public interface RSClient extends RSGameEngine, Client
@Import("grandExchangeOffers")
RSGrandExchangeOffer[] getGrandExchangeOffers();
@Import("clanChatCount")
@Override
int getClanChatCount();
@Import("clanMembers")
RSClanMember[] getClanMembers();
@Import("isMenuOpen")
@Override
boolean isMenuOpen();
@@ -345,14 +332,6 @@ public interface RSClient extends RSGameEngine, Client
@Import("destinationY")
int getDestinationY();
@Import("isFriended")
@Override
boolean isFriended(String name, boolean mustBeLoggedIn);
@Import("isIgnored")
@Override
boolean isIgnored(String name);
@Import("audioEffects")
RSSoundEffect[] getAudioEffects();
@@ -460,4 +439,16 @@ public interface RSClient extends RSGameEngine, Client
@Import("scriptStringStack")
@Override
String[] getStringStack();
@Import("friendManager")
RSFriendManager getFriendManager();
@Import("clanMemberManager")
RSClanMemberManager getClanMemberManager();
@Import("loginType")
RSJagexLoginType getLoginType();
@Construct
RSName createName(String name, RSJagexLoginType type);
}

View File

@@ -26,14 +26,8 @@ package net.runelite.rs.api;
import net.runelite.mapping.Import;
public interface RSFriend
public interface RSFriend extends RSNameable
{
@Import("name")
String getName();
@Import("previousName")
String getPreviousName();
@Import("world")
int getWorld();
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2018, 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.rs.api;
import net.runelite.mapping.Import;
public interface RSFriendManager
{
@Import("isFriended")
boolean isFriended(RSName var1, boolean var2);
}

View File

@@ -0,0 +1,30 @@
/*
* Copyright (c) 2018, 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.rs.api;
public interface RSJagexLoginType
{
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2018, 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.rs.api;
import net.runelite.mapping.Import;
public interface RSName
{
@Import("name")
String getName();
}

View File

@@ -0,0 +1,33 @@
/*
* Copyright (c) 2018, 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.rs.api;
import net.runelite.mapping.Import;
public interface RSNameable
{
@Import("name")
RSName getName();
}

View File

@@ -0,0 +1,39 @@
/*
* Copyright (c) 2018, 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.rs.api;
import net.runelite.mapping.Import;
public interface RSNameableContainer
{
@Import("count")
int getCount();
@Import("nameables")
RSNameable[] getNameables();
@Import("isMember")
boolean isMember(RSName var1);
}

View File

@@ -29,13 +29,13 @@ import net.runelite.mapping.Import;
public interface RSPlayer extends RSActor, Player
{
@Import("name")
RSName getRsName();
@Import("composition")
@Override
RSPlayerComposition getPlayerComposition();
@Import("name")
String getRSName();
@Import("combatLevel")
@Override
int getCombatLevel();
@@ -46,4 +46,12 @@ public interface RSPlayer extends RSActor, Player
@Import("team")
@Override
int getTeam();
@Import("isClanMember")
@Override
boolean isClanMember();
@Import("isFriend")
@Override
boolean isFriend();
}