Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2021-12-15 05:39:29 +01:00
80 changed files with 3322 additions and 1734 deletions

View File

@@ -636,6 +636,13 @@ public interface Client extends GameEngine
*/
World[] getWorldList();
/**
* Create a new menu entry
* @param idx the index to create the menu entry at. Accepts negative indexes eg. -1 inserts at the end.
* @return the newly created menu entry
*/
MenuEntry createMenuEntry(int idx);
/**
* Gets an array of currently open right-click menu entries that can be
* clicked and activated.
@@ -1133,7 +1140,7 @@ public interface Client extends GameEngine
* @param id the ID of the animation. Any int is allowed, but implementations in the client
* should be defined in {@link AnimationID}
*/
Sequence loadAnimation(int id);
Animation loadAnimation(int id);
/**
* Gets the music volume
@@ -1341,7 +1348,7 @@ public interface Client extends GameEngine
/**
* Retrieve the nameable container containing friends
*/
NameableContainer<Friend> getFriendContainer();
FriendContainer getFriendContainer();
/**
* Retrieve the nameable container containing ignores

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2021, Trevor <https://github.com/Trevor159>
* Copyright (c) 2021, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,8 +25,13 @@
package net.runelite.api;
/**
* Represents an animation of a renderable
* A nameable container of friends
*/
public interface Sequence
public interface FriendContainer extends NameableContainer<Friend>
{
/**
* Get the recent logins/logouts of friends from the last few seconds
* @return
*/
Deque<PendingLogin> getPendingLogins();
}

View File

@@ -24,6 +24,8 @@
*/
package net.runelite.api;
import java.util.Arrays;
import java.util.function.Consumer;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -94,6 +96,113 @@ public class MenuEntry implements Cloneable
}
}
public String getOption()
{
return option;
}
public MenuEntry setOption(String option)
{
this.option = option;
return this;
}
public String getTarget()
{
return target;
}
public MenuEntry setTarget(String target)
{
this.target = target;
return this;
}
public int getIdentifier()
{
return this.identifier;
}
public MenuEntry setIdentifier(int identifier)
{
this.identifier = identifier;
return this;
}
public MenuAction getType()
{
return MenuAction.of(this.opcode);
}
public MenuEntry setType(MenuAction type)
{
this.opcode = type.getId();
return this;
}
public int getParam0()
{
return this.param0;
}
public MenuEntry setParam0(int param0)
{
this.param0 = param0;
return this;
}
public int getParam1()
{
return this.param1;
}
public MenuEntry setParam1(int param1)
{
this.param1 = param1;
return this;
}
public boolean isForceLeftClick()
{
return this.forceLeftClick;
}
public MenuEntry setForceLeftClick(boolean forceLeftClick)
{
this.forceLeftClick = forceLeftClick;
return this;
}
public boolean isDeprioritized()
{
return opcode >= MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET;
}
public MenuEntry setDeprioritized(boolean deprioritized)
{
if (deprioritized)
{
if (opcode < MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET)
{
opcode += MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET;
}
}
else
{
if (opcode >= MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET)
{
opcode -= MenuAction.MENU_ACTION_DEPRIORITIZE_OFFSET;
}
}
return this;
}
public MenuEntry onClick(Consumer<MenuEntry> callback)
{
return this;
}
public void setActionParam0(int i)
{
this.param0 = i;
@@ -104,26 +213,6 @@ public class MenuEntry implements Cloneable
return this.param0;
}
public int getParam0()
{
return this.param0;
}
public void setParam0(int i)
{
this.param0 = i;
}
public void setParam1(int i)
{
this.param1 = i;
}
public int getParam1()
{
return this.param1;
}
public void setActionParam1(int i)
{
this.param1 = i;
@@ -139,11 +228,6 @@ public class MenuEntry implements Cloneable
this.opcode = i;
}
public int getType()
{
return this.opcode;
}
public void setId(int i)
{
this.identifier = i;
@@ -161,4 +245,19 @@ public class MenuEntry implements Cloneable
{
return MenuAction.of(getOpcode());
}
// TODO: Remove this after properly implementing the menu
public void add(Client client)
{
MenuEntry[] menuEntries = client.getMenuEntries();
menuEntries = Arrays.copyOf(menuEntries, menuEntries.length + 1);
MenuEntry menuEntry = menuEntries[menuEntries.length - 1] = new MenuEntry();
menuEntry.setOption(option);
menuEntry.setTarget(target);
menuEntry.setParam0(param0);
menuEntry.setParam1(param1);
menuEntry.setIdentifier(identifier);
menuEntry.setType(MenuAction.of(getOpcode()));
client.setMenuEntries(menuEntries);
}
}

View File

@@ -55,13 +55,13 @@ public interface Model extends Renderable
int[] getVerticesZ();
int getTrianglesCount();
int getFaceCount();
int[] getTrianglesX();
int[] getFaceIndices1();
int[] getTrianglesY();
int[] getFaceIndices2();
int[] getTrianglesZ();
int[] getFaceIndices3();
int[] getFaceColors1();
@@ -69,7 +69,7 @@ public interface Model extends Renderable
int[] getFaceColors3();
byte[] getTriangleTransparencies();
byte[] getFaceTransparencies();
int getSceneId();
void setSceneId(int sceneId);
@@ -109,4 +109,9 @@ public interface Model extends Renderable
int[] getVertexNormalsX();
int[] getVertexNormalsY();
int[] getVertexNormalsZ();
byte getOverrideAmount();
byte getOverrideHue();
byte getOverrideSaturation();
byte getOverrideLuminance();
}

View File

@@ -0,0 +1,45 @@
/*
* Copyright (c) 2021, 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;
/**
* A pending friend login/out. This is used to suppress world hop notifications
* by buffering the pending logins to try to match a pending logout with a pending
* login and cancel both.
*/
public interface PendingLogin
{
/**
* The name of the player
* @return
*/
String getName();
/**
* The world the player logged into, or 0 if a logout.
* @return
*/
short getWorld();
}

View File

@@ -782,9 +782,9 @@ public class Perspective
final int radius = 5;
int[][] tris = new int[][]{
m.getTrianglesX(),
m.getTrianglesY(),
m.getTrianglesZ()
m.getFaceIndices1(),
m.getFaceIndices2(),
m.getFaceIndices3()
};
int vpX1 = client.getViewportXOffset();
@@ -792,10 +792,10 @@ public class Perspective
int vpX2 = vpX1 + client.getViewportWidth();
int vpY2 = vpY1 + client.getViewportHeight();
List<RectangleUnion.Rectangle> rects = new ArrayList<>(m.getTrianglesCount());
List<RectangleUnion.Rectangle> rects = new ArrayList<>(m.getFaceCount());
nextTri:
for (int tri = 0; tri < m.getTrianglesCount(); tri++)
for (int tri = 0; tri < m.getFaceCount(); tri++)
{
if (faceColors3[tri] == -2)
{

View File

@@ -41,7 +41,7 @@ public interface RuneLiteObject extends GraphicsObject
* Sets the animation of the RuneLiteObject
* If animation is null model will be static
*/
void setAnimation(Sequence animation);
void setAnimation(Animation animation);
/**
* Sets whether the animation of the RuneLiteObject should loop when the animation ends.

View File

@@ -257,6 +257,12 @@ public final class ScriptID
@ScriptArguments(integer = 15)
public static final int FRIENDS_CHAT_CHANNEL_REBUILD = 1658;
/**
* Builds the widget that holds all of the players inside a clan chat
*/
@ScriptArguments(integer = 7)
public static final int CLAN_SIDEPANEL_DRAW = 4396;
/**
* Builds the widget for making an offer in Grand Exchange
*/

View File

@@ -31,7 +31,7 @@ public class ClientTick
{
public static final ClientTick INSTANCE = new ClientTick();
private ClientTick()
public ClientTick()
{
// noop
}

View File

@@ -25,24 +25,50 @@
package net.runelite.api.events;
import lombok.Getter;
import net.runelite.api.MenuEntry;
/**
* An event when a new entry is added to a right-click menu.
*/
public class MenuEntryAdded extends MenuEntry
public class MenuEntryAdded
{
// Here for RuneLite compatibility (different parameter order)
public MenuEntryAdded(String option, String target, int type, int identifier, int actionParam0, int actionParam1)
{
super(option, target, identifier, type, actionParam0, actionParam1, false);
this(option, target, identifier, type, actionParam0, actionParam1, false);
}
public MenuEntryAdded(String option, String target, int identifier, int opcode, int param0, int param1, boolean forceLeftClick)
public MenuEntryAdded(String option, String target, int identifier, int type, int param0, int param1, boolean forceLeftClick)
{
super(option, target, identifier, opcode, param0, param1, forceLeftClick);
this.option = option;
this.target = target;
this.identifier = identifier;
this.type = type;
this.actionParam0 = param0;
this.actionParam1 = param1;
this.forceLeftClick = forceLeftClick;
}
@Getter
private final String option;
@Getter
private final String target;
@Getter
private final int type;
@Getter
private final int identifier;
@Getter
private final int actionParam0;
@Getter
private final int actionParam1;
@Getter
private final boolean forceLeftClick;
/**
* If this is set to true client mixin will update
* the menu entry with the modified values.

View File

@@ -91,33 +91,9 @@ public class MenuOptionClicked
{
this.setMenuOption(entry.getOption());
this.setMenuTarget(entry.getTarget());
this.setId(entry.getId());
this.setMenuAction(MenuAction.of(entry.getOpcode()));
this.setId(entry.getIdentifier());
this.setMenuAction(entry.getType());
this.setParam0(entry.getParam0());
this.setParam1(entry.getParam1());
}
@Deprecated
public int getActionParam()
{
return param0;
}
@Deprecated
public void setActionParam(int i)
{
param0 = i;
}
@Deprecated
public int getWidgetId()
{
return param1;
}
@Deprecated
public void setWidgetId(int i)
{
param1 = i;
}
}

View File

@@ -32,6 +32,7 @@ import net.runelite.api.widgets.WidgetInfo;
* A MenuManager widget menu was clicked. This event is fired only for MenuManager managed custom menus.
*/
@Data
@Deprecated
public class WidgetMenuOptionClicked
{
/**
@@ -51,4 +52,4 @@ public class WidgetMenuOptionClicked
* The widget id of the widget that was clicked.
*/
private int widgetId;
}
}

View File

@@ -1352,11 +1352,15 @@ public final class WidgetID
static class Clan
{
static final int LAYER = 0;
static final int HEADER = 1;
static final int MEMBERS = 6;
}
static class ClanGuest
{
static final int LAYER = 0;
static final int HEADER = 1;
static final int MEMBERS = 6;
}
}

View File

@@ -554,7 +554,12 @@ public enum WidgetInfo
TEMPOROSS_STATUS_INDICATOR(WidgetID.TEMPOROSS_GROUP_ID, WidgetID.TemporossStatus.STATUS_INDICATOR),
CLAN_LAYER(WidgetID.CLAN_GROUP_ID, WidgetID.Clan.LAYER),
CLAN_HEADER(WidgetID.CLAN_GROUP_ID, WidgetID.Clan.HEADER),
CLAN_MEMBER_LIST(WidgetID.CLAN_GROUP_ID, WidgetID.Clan.MEMBERS),
CLAN_GUEST_LAYER(WidgetID.CLAN_GUEST_GROUP_ID, WidgetID.ClanGuest.LAYER),
CLAN_GUEST_HEADER(WidgetID.CLAN_GUEST_GROUP_ID, WidgetID.ClanGuest.HEADER),
CLAN_GUEST_MEMBER_LIST(WidgetID.CLAN_GUEST_GROUP_ID, WidgetID.ClanGuest.MEMBERS),
//OpenOSRS