Merge remote-tracking branch 'runelite/master'

This commit is contained in:
Owain van Brakel
2020-06-18 11:01:33 +02:00
92 changed files with 555 additions and 360 deletions

View File

@@ -27,7 +27,7 @@ object ProjectVersions {
const val launcherVersion = "2.2.0"
const val rlVersion = "1.6.19"
const val openosrsVersion = "3.3.7"
const val openosrsVersion = "3.3.8"
const val rsversion = 189
const val cacheversion = 165

View File

@@ -127,6 +127,23 @@ public interface Actor extends Entity, Locatable
*/
int getAnimation();
/**
* Gets the secondary animation the actor is performing.
*
* @return the animation ID
* @see AnimationID
*/
int getPoseAnimation();
/**
* If this is equal to the pose animation, the pose animation is ignored when
* you are doing another action.
*
* @return the animation ID
* @see AnimationID
*/
int getIdlePoseAnimation();
/**
* Sets an animation for the actor to perform.
*
@@ -268,11 +285,4 @@ public interface Actor extends Entity, Locatable
int getWalkRightAnimation();
int getRunAnimation();
/**
* This gets used for drawing the correct animation.
*
* The client moves one of the other animation fields into this field based off the actor's state
*/
int getMovementAnimation();
}

View File

@@ -69,11 +69,11 @@ public enum ChatMessageType
*/
MODPRIVATECHAT(7),
/**
* A message received in clan chat.
* A message received in friends chat.
*/
FRIENDSCHAT(9),
/**
* A message received with information about the current clan chat.
* A message received with information about the current friends chat.
*/
FRIENDSCHATNOTIFICATION(11),
/**
@@ -133,7 +133,7 @@ public enum ChatMessageType
*/
CHALREQ_TRADE(103),
/**
* A message received when someone sends a clan challenge offer.
* A message received when someone sends a friends chat challenge offer.
*/
CHALREQ_FRIENDSCHAT(104),
/**

View File

@@ -1199,10 +1199,12 @@ public interface Client extends GameShell
boolean isFriended(String name, boolean mustBeLoggedIn);
/**
* Retrieve the clan member manager
* Retrieve the friends chat manager
*
* @return
*/
@Nullable
ClanMemberManager getClanMemberManager();
FriendsChatManager getFriendsChatManager();
/**
* Retrieve the nameable container containing friends
@@ -1527,11 +1529,11 @@ public interface Client extends GameShell
void setFriendsHidden(boolean state);
/**
* Sets whether or not clan mates are hidden.
* Sets whether or not friends chat members are hidden.
*
* @param state the new clan mates hidden state
* @param state the new friends chat member hidden state
*/
void setClanMatesHidden(boolean state);
void setFriendsChatMembersHidden(boolean state);
/**
* Sets whether the local player is hidden.

View File

@@ -24,22 +24,20 @@
*/
package net.runelite.api;
/**
* Represents the friend and ignore list manager.
*/
public interface ClanMemberManager extends NameableContainer<ClanMember>
public interface FriendsChatManager extends NameableContainer<FriendsChatMember>
{
/**
* Gets the clan owner of the currently joined clan chat
* Gets the owner of the currently joined friends chat
*
* @return
*/
String getClanOwner();
String getOwner();
/**
* Gets the clan chat name of the currently joined clan chat
* Gets the name of the currently joined friends chat
*
* @return
*/
String getClanChatName();
String getName();
}

View File

@@ -25,9 +25,9 @@
package net.runelite.api;
/**
* Represents a clan member.
* Represents a friends chat member.
*/
public interface ClanMember extends ChatPlayer
public interface FriendsChatMember extends ChatPlayer
{
/**
* Gets the world the member is in.
@@ -37,9 +37,9 @@ public interface ClanMember extends ChatPlayer
int getWorld();
/**
* Gets the rank of the clan member.
* Gets the rank of the friends chat member.
*
* @return the rank
*/
ClanMemberRank getRank();
FriendsChatRank getRank();
}

View File

@@ -30,14 +30,14 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* An enumeration of ranks of clan members.
* An enumeration of ranks of friends chat members.
*/
@AllArgsConstructor
@Getter
public enum ClanMemberRank
public enum FriendsChatRank
{
/**
* Not in a clan.
* Not ranked.
*/
UNRANKED(-1),
/**
@@ -77,30 +77,30 @@ public enum ClanMemberRank
*/
JMOD(127);
private static final Map<Integer, ClanMemberRank> RANKS = new HashMap<>();
private static final Map<Integer, FriendsChatRank> RANKS = new HashMap<>();
static
{
for (final ClanMemberRank clanMemberRank : ClanMemberRank.values())
for (final FriendsChatRank friendsChatRank : FriendsChatRank.values())
{
RANKS.put(clanMemberRank.value, clanMemberRank);
RANKS.put(friendsChatRank.value, friendsChatRank);
}
}
/**
* Utility method that maps the rank value to its respective
* {@link ClanMemberRank} value.
* {@link FriendsChatRank} value.
*
* @param rank the rank value
* @return rank type
*/
public static ClanMemberRank valueOf(int rank)
public static FriendsChatRank valueOf(int rank)
{
return RANKS.get(rank);
}
/**
* The value of the clan rank.
* The value of the rank.
*/
private final int value;
}

View File

@@ -284,6 +284,10 @@ public enum MenuOpcode
* a player and have its identifier set to a player index.
*/
RUNELITE_PLAYER(1503),
/**
* Menu action for InfoBox menu entries
*/
RUNELITE_INFOBOX(1504),
FOLLOW(2046),
TRADE(2047),

View File

@@ -58,7 +58,7 @@ public interface MessageNode extends Node
void setName(String name);
/**
* Gets the sender of the message (ie. clan name).
* Gets the sender of the message (ie. friends chat name).
*
* @return the message sender
*/

View File

@@ -60,12 +60,12 @@ public interface Player extends Actor
int getTeam();
/**
* Checks whether this player is a member of the same clan as
* Checks whether this player is a member of the same friends chat
* the local player.
*
* @return true if the player is a clan member, false otherwise
* @return true if the player is a friends chat member, false otherwise
*/
boolean isClanMember();
boolean isFriendsChatMember();
/**
* Checks whether this player is a friend of the local player.

View File

@@ -219,13 +219,13 @@ public final class ScriptID
public static final int PUBLICMSG = 13337;
/**
* Attempts to kick the specified player from the Clan Chat
* Attempts to kick the specified player from the friends chat
* <ul>
* <li>String Players in-game name</li>
* </ul>
*/
@ScriptArguments(string = 1)
public static final int CLAN_SEND_KICK = 215;
public static final int FRIENDS_CHAT_SEND_KICK = 215;
/**
* Toggles the bank search
@@ -248,10 +248,10 @@ public final class ScriptID
public static final int DEATH_KEEP_BUILD = 1601;
/**
* Builds the widget that holds all of the players inside a clan chat
* Builds the widget that holds all of the players inside a friends chat
*/
@ScriptArguments(integer = 15)
public static final int CLAN_CHAT_CHANNEL_BUILD = 1658;
public static final int FRIENDS_CHAT_CHANNEL_REBUILD = 1658;
/**
* Builds the widget for making an offer in Grand Exchange

View File

@@ -776,7 +776,7 @@ public final class SpriteID
public static final int RS2_TAB_EQUIPMENT = 778;
public static final int RS2_TAB_PRAYER = 779;
public static final int TAB_MAGIC = 780;
public static final int RS2_TAB_CLAN_CHAT = 781;
public static final int RS2_TAB_FRIENDS_CHAT = 781;
public static final int TAB_FRIENDS = 782;
public static final int TAB_IGNORES = 783;
public static final int RS2_TAB_LOGOUT = 784;
@@ -888,7 +888,7 @@ public final class SpriteID
public static final int TAB_EQUIPMENT = 901;
public static final int TAB_PRAYER = 902;
public static final int UNUSED_TAB_MAGIC_903 = 903;
public static final int TAB_CLAN_CHAT = 904;
public static final int TAB_FRIENDS_CHAT = 904;
public static final int TAB_LOGOUT = 907;
public static final int TAB_OPTIONS = 908;
public static final int TAB_EMOTES = 909;
@@ -977,15 +977,15 @@ public final class SpriteID
public static final int STASH_UNITS_SLANTED_TAB_EDGE_LEFT_HOVERED = 1001;
public static final int STASH_UNITS_SLANTED_TAB_MIDDLE_HOVERED = 1002;
public static final int STASH_UNITS_SLANTED_TAB_EDGE_RIGHT_HOVERED = 1003;
public static final int CLAN_CHAT_RANK_SMILEY_FRIEND = 1004;
public static final int CLAN_CHAT_RANK_CROWN_JAGEX_MODERATOR = 1005;
public static final int CLAN_CHAT_RANK_KEY_CHANNEL_OWNER = 1006;
public static final int CLAN_CHAT_RANK_GOLD_STAR_GENERAL = 1007;
public static final int CLAN_CHAT_RANK_SILVER_STAR_CAPTAIN = 1008;
public static final int CLAN_CHAT_RANK_BRONZE_STAR_LIEUTENANT = 1009;
public static final int CLAN_CHAT_RANK_TRIPLE_CHEVRON_SERGEANT = 1010;
public static final int CLAN_CHAT_RANK_DOUBLE_CHEVRON_CORPORAL = 1011;
public static final int CLAN_CHAT_RANK_SINGLE_CHEVRON_RECRUIT = 1012;
public static final int FRIENDS_CHAT_RANK_SMILEY_FRIEND = 1004;
public static final int FRIENDS_CHAT_RANK_CROWN_JAGEX_MODERATOR = 1005;
public static final int FRIENDS_CHAT_RANK_KEY_CHANNEL_OWNER = 1006;
public static final int FRIENDS_CHAT_RANK_GOLD_STAR_GENERAL = 1007;
public static final int FRIENDS_CHAT_RANK_SILVER_STAR_CAPTAIN = 1008;
public static final int FRIENDS_CHAT_RANK_BRONZE_STAR_LIEUTENANT = 1009;
public static final int FRIENDS_CHAT_RANK_TRIPLE_CHEVRON_SERGEANT = 1010;
public static final int FRIENDS_CHAT_RANK_DOUBLE_CHEVRON_CORPORAL = 1011;
public static final int FRIENDS_CHAT_RANK_SINGLE_CHEVRON_RECRUIT = 1012;
public static final int UNKNOWN_BUTTON_METAL_CORNERS = 1013;
public static final int UNKNOWN_BUTTON_METAL_CORNERS_HOVERED = 1014;
public static final int UNKNOWN_SLANTED_TAB_LONG = 1015;
@@ -1017,7 +1017,7 @@ public final class SpriteID
public static final int BANK_DEPOSIT_INVENTORY = 1041;
public static final int BANK_DEPOSIT_EQUIPMENT = 1042;
public static final int BANK_SEARCH = 1043;
public static final int MINIMAP_MARKER_PURPLE_PLAYER_CLAN_CHAT = 1044;
public static final int MINIMAP_MARKER_PURPLE_PLAYER_FRIENDS_CHAT = 1044;
public static final int OPTIONS_PROFANITY_FILTER = 1045;
public static final int PLAYER_KILLER_SKULL_1046 = 1046;
public static final int PLAYER_KILLING_DISABLED_OVERLAY = 1047;

View File

@@ -42,7 +42,7 @@ public enum VarClientStr
CHATBOX_TYPED_TEXT(335),
INPUT_TEXT(359),
PRIVATE_MESSAGE_TARGET(360),
RECENT_CLAN_CHAT(362);
RECENT_FRIENDS_CHAT(362);
private final int index;
}

View File

@@ -64,11 +64,11 @@ public enum VarPlayer
/**
* The ID of the party. This Var is only set in the raid bank area and the raid lobby
*
* This gets set to -1 when the raid starts. This is first set when the first player of the clan forms a party
* This gets set to -1 when the raid starts. This is first set when the first player of the friends chat forms a party
* on the recruiting board and it changes again when the first person actually enters the raid.
*
* -1 : Not in a party or in the middle of an ongoing raid
* Anything else : This means that your clan has a raid party being formed and has not started yet
* Anything else : This means that your friends chat has a raid party being formed and has not started yet
*/
IN_RAID_PARTY(1427),

View File

@@ -37,10 +37,10 @@ public class CannonChanged implements Event
* The projectile id.
*/
@Nullable
private final Integer cannonballId;
Integer cannonballId;
/**
* The amount of cannonballs left.
*/
private final int cannonballs;
int cannonballs;
}

View File

@@ -38,17 +38,17 @@ public class CannonPlaced implements Event
/**
* Cannon placed or picked up.
*/
private final boolean placed;
boolean placed;
/**
* The location of the cannon.
*/
@Nullable
private final WorldPoint cannonLocation;
WorldPoint cannonLocation;
/**
* The cannon object.
*/
@Nullable
private final GameObject cannon;
GameObject cannon;
}

View File

@@ -62,8 +62,8 @@ public class ChatMessage implements Event
/**
* The sender of the message.
* <p>
* This field is only used for clan messages and refers to the
* current name of the clan chat the client is in.
* This field is only used for friends chat messages and refers to the
* current name of the friends chat the client is in.
*/
private String sender;
/**

View File

@@ -47,9 +47,9 @@ public class CommandExecuted implements Event
/**
* The name of the command entered.
*/
private String command;
String command;
/**
* The command arguments that have been entered.
*/
private String[] arguments;
String[] arguments;
}

View File

@@ -30,6 +30,6 @@ import net.runelite.api.Skill;
@Value
public class FakeXpDrop implements Event
{
private final Skill skill;
private final int xp;
Skill skill;
int xp;
}

View File

@@ -11,5 +11,5 @@ public class FriendAdded implements Event
/**
* The name of the added friend.
*/
private final String name;
String name;
}

View File

@@ -35,5 +35,5 @@ public class FriendRemoved implements Event
/**
* The name of the removed friend.
*/
private final String name;
String name;
}

View File

@@ -27,13 +27,13 @@ package net.runelite.api.events;
import lombok.Value;
/**
* An event where the client has joined or left a clan chat.
* An event where the client has joined or left a friends chat.
*/
@Value
public class ClanChanged implements Event
public class FriendsChatChanged implements Event
{
/**
* Whether or not the client is now in a clan chat.
* Whether or not the client is now in a friends chat.
*/
private boolean joined;
boolean joined;
}

View File

@@ -24,14 +24,14 @@
*/
package net.runelite.api.events;
import net.runelite.api.ClanMember;
import lombok.Value;
import net.runelite.api.FriendsChatMember;
@Value
public class ClanMemberJoined implements Event
public class FriendsChatMemberJoined implements Event
{
/**
* The ClanMember that joined
* The member that joined
*/
private ClanMember member;
FriendsChatMember member;
}

View File

@@ -24,14 +24,14 @@
*/
package net.runelite.api.events;
import net.runelite.api.ClanMember;
import lombok.Value;
import net.runelite.api.FriendsChatMember;
@Value
public class ClanMemberLeft implements Event
public class FriendsChatMemberLeft implements Event
{
/**
* The ClanMember that left
* The member that left
*/
private ClanMember member;
FriendsChatMember member;
}

View File

@@ -36,5 +36,5 @@ public class GraphicsObjectCreated implements Event
/**
* The newly created graphics object.
*/
private final GraphicsObject graphicsObject;
GraphicsObject graphicsObject;
}

View File

@@ -9,10 +9,10 @@ import lombok.Value;
@Value
public class InteractingChanged implements Event
{
private final Actor source;
Actor source;
/**
* Target actor, may be null
*/
private final Actor target;
Actor target;
}

View File

@@ -44,10 +44,10 @@ public class ItemContainerChanged implements Event
/**
* The modified container's ID.
*/
private final int containerId;
int containerId;
/**
* The modified item container.
*/
private final ItemContainer itemContainer;
ItemContainer itemContainer;
}

View File

@@ -36,6 +36,6 @@ import lombok.Value;
@Value
public class ItemDespawned implements Event
{
private final Tile tile;
private final TileItem item;
Tile tile;
TileItem item;
}

View File

@@ -35,8 +35,8 @@ import lombok.Value;
@Value
public class ItemQuantityChanged implements Event
{
private final TileItem item;
private final Tile tile;
private final int oldQuantity;
private final int newQuantity;
TileItem item;
Tile tile;
int oldQuantity;
int newQuantity;
}

View File

@@ -36,6 +36,6 @@ import lombok.Value;
@Value
public class ItemSpawned implements Event
{
private final Tile tile;
private final TileItem item;
Tile tile;
TileItem item;
}

View File

@@ -36,5 +36,5 @@ public class NameableNameChanged implements Event
/**
* The nameable that changed names.
*/
private final Nameable nameable;
Nameable nameable;
}

View File

@@ -36,5 +36,5 @@ public class NpcDefinitionChanged implements Event
/**
* The NPC of which the composition changed.
*/
private final NPC npc;
NPC npc;
}

View File

@@ -37,7 +37,7 @@ public class NpcDespawned implements Event
/**
* The despawned NPC.
*/
private final NPC npc;
NPC npc;
public Actor getActor()
{

View File

@@ -37,7 +37,7 @@ public class NpcSpawned implements Event
/**
* The spawned NPC.
*/
private final NPC npc;
NPC npc;
public Actor getActor()
{

View File

@@ -6,7 +6,7 @@ import lombok.Value;
@Value
public class OverheadTextChanged implements Event
{
private final Actor actor;
Actor actor;
private final String overheadText;
String overheadText;
}

View File

@@ -9,5 +9,5 @@ import net.runelite.api.Player;
@Value
public class PlayerAppearanceChanged implements Event
{
private Player player;
Player player;
}

View File

@@ -33,5 +33,5 @@ import net.runelite.api.Player;
@Value
public class PlayerDeath implements Event
{
private final Player player;
Player player;
}

View File

@@ -39,7 +39,7 @@ public class PlayerDespawned implements Event
/**
* The despawned player.
*/
private final Player player;
Player player;
public Actor getActor()
{

View File

@@ -37,7 +37,7 @@ public class PlayerSpawned implements Event
/**
* The spawned player.
*/
private final Player player;
Player player;
public Actor getActor()
{

View File

@@ -35,5 +35,5 @@ public class ScriptPostFired implements Event
/**
* The script id of the invoked script
*/
private final int scriptId;
int scriptId;
}

View File

@@ -33,8 +33,8 @@ import net.runelite.api.Skill;
@Value
public class StatChanged implements Event
{
private final Skill skill;
private final int xp;
private final int level;
private final int boostedLevel;
Skill skill;
int xp;
int level;
int boostedLevel;
}

View File

@@ -34,5 +34,5 @@ import lombok.Value;
@Value
public class VarClientIntChanged implements Event
{
private int index;
int index;
}

View File

@@ -34,5 +34,5 @@ import lombok.Value;
@Value
public class VarClientStrChanged implements Event
{
private int index;
int index;
}

View File

@@ -37,5 +37,5 @@ public class VolumeChanged implements Event
AREA
}
private final Type type;
Type type;
}

View File

@@ -33,5 +33,5 @@ import lombok.Value;
@Value
public class WorldListLoad implements Event
{
private final World[] worlds;
World[] worlds;
}

View File

@@ -61,7 +61,7 @@ public class WidgetID
public static final int PEST_CONTROL_GROUP_ID = 408;
public static final int PEST_CONTROL_EXCHANGE_WINDOW_GROUP_ID = 243;
public static final int DIALOG_MINIGAME_GROUP_ID = 229;
public static final int CLAN_CHAT_GROUP_ID = 7;
public static final int FRIENDS_CHAT_GROUP_ID = 7;
public static final int MINIMAP_GROUP_ID = 160;
public static final int LOGIN_CLICK_TO_PLAY_GROUP_ID = 378;
public static final int CLUE_SCROLL_GROUP_ID = 203;
@@ -300,7 +300,7 @@ public class WidgetID
static final int PREVIOUS_NAME_HOLDER = 16;
}
static class ClanChat
static class FriendsChat
{
static final int TITLE = 1;
static final int NAME = 4;
@@ -469,14 +469,14 @@ public class WidgetID
static final int MINIMAP_DRAW_AREA = 8;
static final int MULTICOMBAT_INDICATOR = 21;
static final int BANK_PIN = 22;
static final int CLAN_CHAT_TAB = 33;
static final int FRIENDS_CHAT_TAB = 33;
static final int FRIENDS_TAB = 35;
static final int IGNORES_TAB = 34;
static final int LOGOUT_TAB = 36;
static final int OPTIONS_TAB = 37;
static final int EMOTES_TAB = 38;
static final int MUSIC_TAB = 39;
static final int CLAN_CHAT_ICON = 40;
static final int FRIENDS_CHAT_ICON = 40;
static final int FRIENDS_ICON = 42;
static final int IGNORES_ICON = 41;
static final int LOGOUT_ICON = 43;
@@ -508,14 +508,14 @@ public class WidgetID
static final int ITEMS_KEPT_ON_DEATH = 13;
static final int BANK_PIN = 13;
static final int MULTICOMBAT_INDICATOR = 17;
static final int CLAN_CHAT_TAB = 37;
static final int FRIENDS_CHAT_TAB = 37;
static final int FRIENDS_TAB = 39;
static final int IGNORES_TAB = 38;
static final int LOGOUT_TAB = 40;
static final int OPTIONS_TAB = 41;
static final int EMOTES_TAB = 42;
static final int MUSIC_TAB = 43;
static final int CLAN_CHAT_ICON = 44;
static final int FRIENDS_CHAT_ICON = 44;
static final int FRIENDS_ICON = 46;
static final int IGNORES_ICON = 45;
static final int LOGOUT_ICON = 47;

View File

@@ -46,7 +46,7 @@ public enum WidgetInfo
INVENTORY(WidgetID.INVENTORY_GROUP_ID, 0),
FRIENDS_LIST(WidgetID.FRIENDS_LIST_GROUP_ID, 0),
IGNORE_LIST(WidgetID.IGNORE_LIST_GROUP_ID, 0),
CLAN_CHAT(WidgetID.CLAN_CHAT_GROUP_ID, 0),
FRIENDS_CHAT(WidgetID.FRIENDS_CHAT_GROUP_ID, 0),
RAIDING_PARTY(WidgetID.RAIDING_PARTY_GROUP_ID, 0),
WORLD_MAP_VIEW(WidgetID.WORLD_MAP_GROUP_ID, WidgetID.WorldMap.MAPVIEW),
@@ -144,10 +144,10 @@ public enum WidgetInfo
EXPLORERS_RING_ALCH_INVENTORY(WidgetID.EXPLORERS_RING_ALCH_GROUP_ID, WidgetID.ExplorersRing.INVENTORY),
CLAN_CHAT_TITLE(WidgetID.CLAN_CHAT_GROUP_ID, WidgetID.ClanChat.TITLE),
CLAN_CHAT_NAME(WidgetID.CLAN_CHAT_GROUP_ID, WidgetID.ClanChat.NAME),
CLAN_CHAT_OWNER(WidgetID.CLAN_CHAT_GROUP_ID, WidgetID.ClanChat.OWNER),
CLAN_CHAT_LIST(WidgetID.CLAN_CHAT_GROUP_ID, WidgetID.ClanChat.LIST),
FRIENDS_CHAT_TITLE(WidgetID.FRIENDS_CHAT_GROUP_ID, WidgetID.FriendsChat.TITLE),
FRIENDS_CHAT_NAME(WidgetID.FRIENDS_CHAT_GROUP_ID, WidgetID.FriendsChat.NAME),
FRIENDS_CHAT_OWNER(WidgetID.FRIENDS_CHAT_GROUP_ID, WidgetID.FriendsChat.OWNER),
FRIENDS_CHAT_LIST(WidgetID.FRIENDS_CHAT_GROUP_ID, WidgetID.FriendsChat.LIST),
BANK_CONTAINER(WidgetID.BANK_GROUP_ID, WidgetID.Bank.BANK_CONTAINER),
BANK_SEARCH_BUTTON_BACKGROUND(WidgetID.BANK_GROUP_ID, WidgetID.Bank.SEARCH_BUTTON_BACKGROUND),
@@ -246,7 +246,7 @@ public enum WidgetInfo
FIXED_VIEWPORT_EQUIPMENT_TAB(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.EQUIPMENT_TAB),
FIXED_VIEWPORT_PRAYER_TAB(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.PRAYER_TAB),
FIXED_VIEWPORT_MAGIC_TAB(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.MAGIC_TAB),
FIXED_VIEWPORT_CLAN_CHAT_TAB(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.CLAN_CHAT_TAB),
FIXED_VIEWPORT_FRIENDS_CHAT_TAB(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.FRIENDS_CHAT_TAB),
FIXED_VIEWPORT_FRIENDS_TAB(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.FRIENDS_TAB),
FIXED_VIEWPORT_IGNORES_TAB(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.IGNORES_TAB),
FIXED_VIEWPORT_LOGOUT_TAB(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.LOGOUT_TAB),
@@ -260,7 +260,7 @@ public enum WidgetInfo
FIXED_VIEWPORT_EQUIPMENT_ICON(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.EQUIPMENT_ICON),
FIXED_VIEWPORT_PRAYER_ICON(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.PRAYER_ICON),
FIXED_VIEWPORT_MAGIC_ICON(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.MAGIC_ICON),
FIXED_VIEWPORT_CLAN_CHAT_ICON(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.CLAN_CHAT_ICON),
FIXED_VIEWPORT_FRIENDS_CHAT_ICON(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.FRIENDS_CHAT_ICON),
FIXED_VIEWPORT_FRIENDS_ICON(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.FRIENDS_ICON),
FIXED_VIEWPORT_IGNORES_ICON(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.IGNORES_ICON),
FIXED_VIEWPORT_LOGOUT_ICON(WidgetID.FIXED_VIEWPORT_GROUP_ID, WidgetID.FixedViewport.LOGOUT_ICON),
@@ -291,7 +291,7 @@ public enum WidgetInfo
RESIZABLE_VIEWPORT_EQUIPMENT_TAB(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.EQUIPMENT_TAB),
RESIZABLE_VIEWPORT_PRAYER_TAB(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.PRAYER_TAB),
RESIZABLE_VIEWPORT_MAGIC_TAB(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.MAGIC_TAB),
RESIZABLE_VIEWPORT_CLAN_CHAT_TAB(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.CLAN_CHAT_TAB),
RESIZABLE_VIEWPORT_FRIENDS_CHAT_TAB(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.FRIENDS_CHAT_TAB),
RESIZABLE_VIEWPORT_FRIENDS_TAB(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.FRIENDS_TAB),
RESIZABLE_VIEWPORT_IGNORES_TAB(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.IGNORES_TAB),
RESIZABLE_VIEWPORT_LOGOUT_TAB(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.LOGOUT_TAB),
@@ -305,7 +305,7 @@ public enum WidgetInfo
RESIZABLE_VIEWPORT_EQUIPMENT_ICON(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.EQUIPMENT_ICON),
RESIZABLE_VIEWPORT_PRAYER_ICON(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.PRAYER_ICON),
RESIZABLE_VIEWPORT_MAGIC_ICON(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.MAGIC_ICON),
RESIZABLE_VIEWPORT_CLAN_CHAT_ICON(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.CLAN_CHAT_ICON),
RESIZABLE_VIEWPORT_FRIENDS_CHAT_ICON(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.FRIENDS_CHAT_ICON),
RESIZABLE_VIEWPORT_FRIENDS_ICON(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.FRIENDS_ICON),
RESIZABLE_VIEWPORT_IGNORES_ICON(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.IGNORES_ICON),
RESIZABLE_VIEWPORT_LOGOUT_ICON(WidgetID.RESIZABLE_VIEWPORT_OLD_SCHOOL_BOX_GROUP_ID, WidgetID.ResizableViewport.LOGOUT_ICON),

View File

@@ -74,7 +74,7 @@ import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.discord.DiscordService;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.events.ExternalPluginsLoaded;
import net.runelite.client.game.ClanManager;
import net.runelite.client.game.FriendChatManager;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.LootManager;
import net.runelite.client.game.PlayerManager;
@@ -167,7 +167,7 @@ public class RuneLite
private Provider<OverlayRenderer> overlayRenderer;
@Inject
private Provider<ClanManager> clanManager;
private Provider<FriendChatManager> friendChatManager;
@Inject
private Provider<ChatMessageManager> chatMessageManager;
@@ -237,6 +237,7 @@ public class RuneLite
final OptionParser parser = new OptionParser();
parser.accepts("developer-mode", "Enable developer tools");
parser.accepts("debug", "Show extra debugging output");
parser.accepts("safe-mode", "Disables external plugins and the GPU plugin");
parser.accepts("no-splash", "Do not show the splash screen");
final ArgumentAcceptingOptionSpec<String> proxyInfo = parser
.accepts("proxy")
@@ -392,10 +393,15 @@ public class RuneLite
PROFILES_DIR.mkdirs();
log.info("OpenOSRS {} Runelite {} (launcher version {}) starting up, args: {}",
RuneLiteProperties.getPlusVersion(), RuneLiteProperties.getVersion(), RuneLiteProperties.getLauncherVersion() == null ? "unknown" : RuneLiteProperties.getLauncherVersion(),
args.length == 0 ? "none" : String.join(" ", args));
final long start = System.currentTimeMillis();
injector = Guice.createInjector(new RuneLiteModule(
clientLoader,
options.has("safe-mode"),
options.valueOf(configfile)));
injector.getInstance(RuneLite.class).start();
@@ -480,7 +486,7 @@ public class RuneLite
chatMessageManager.get().loadColors();
overlayRenderer.get();
clanManager.get();
friendChatManager.get();
itemManager.get();
menuManager.get();
chatMessageManager.get();
@@ -490,6 +496,7 @@ public class RuneLite
playerManager.get();
chatboxPanelManager.get();
partyService.get();
infoBoxOverlay.get();
eventBus.subscribe(GameStateChanged.class, this, hooks::onGameStateChanged);
eventBus.subscribe(ScriptCallbackEvent.class, this, hooks::onScriptCallbackEvent);

View File

@@ -39,6 +39,7 @@ import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
import javax.annotation.Nullable;
import javax.inject.Singleton;
import lombok.AllArgsConstructor;
import net.runelite.api.Client;
import net.runelite.api.hooks.Callbacks;
import net.runelite.client.account.SessionManager;
@@ -63,22 +64,19 @@ import okhttp3.OkHttpClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@AllArgsConstructor
public class RuneLiteModule extends AbstractModule
{
private static final int MAX_OKHTTP_CACHE_SIZE = 20 * 1024 * 1024; // 20mb
private final Supplier<Applet> clientLoader;
private final boolean safeMode;
private final File config;
public RuneLiteModule(final Supplier<Applet> clientLoader, File config)
{
this.clientLoader = clientLoader;
this.config = config;
}
@Override
protected void configure()
{
bindConstant().annotatedWith(Names.named("safeMode")).to(safeMode);
bind(File.class).annotatedWith(Names.named("config")).toInstance(config);
bind(OkHttpClient.class).toInstance(RuneLiteAPI.CLIENT.newBuilder()
.cache(new Cache(new File(RuneLite.CACHE_DIR, "okhttp"), MAX_OKHTTP_CACHE_SIZE))

View File

@@ -128,7 +128,7 @@ public class ChatCommandManager
String message = chatboxInput.getValue();
if (message.startsWith("/"))
{
message = message.substring(1); // clan chat input
message = message.substring(1); // friends chat input
}
onInput(chatboxInput, message);

View File

@@ -140,11 +140,11 @@ public class ChatMessageManager
break;
}
case FRIENDSCHAT:
usernameColor = isChatboxTransparent ? chatColorConfig.transparentClanUsernames() : chatColorConfig.opaqueClanUsernames();
usernameColor = isChatboxTransparent ? chatColorConfig.transparentFriendsChatUsernames() : chatColorConfig.opaqueFriendsChatUsernames();
break;
}
senderColor = isChatboxTransparent ? chatColorConfig.transparentClanChannelName() : chatColorConfig.opaqueClanChannelName();
senderColor = isChatboxTransparent ? chatColorConfig.transparentFriendsChatChannelName() : chatColorConfig.opaqueFriendsChatChannelName();
if (usernameColor != null)
{
@@ -218,7 +218,7 @@ public class ChatMessageManager
case PRIVATECHAT:
return JagexColors.CHAT_PRIVATE_MESSAGE_TEXT_OPAQUE_BACKGROUND;
case FRIENDSCHAT:
return JagexColors.CHAT_CLAN_TEXT_OPAQUE_BACKGROUND;
return JagexColors.CHAT_FC_TEXT_OPAQUE_BACKGROUND;
case ITEM_EXAMINE:
case OBJECT_EXAMINE:
case NPC_EXAMINE:
@@ -238,7 +238,7 @@ public class ChatMessageManager
case PRIVATECHAT:
return JagexColors.CHAT_PRIVATE_MESSAGE_TEXT_TRANSPARENT_BACKGROUND;
case FRIENDSCHAT:
return JagexColors.CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND;
return JagexColors.CHAT_FC_TEXT_TRANSPARENT_BACKGROUND;
case ITEM_EXAMINE:
case OBJECT_EXAMINE:
case NPC_EXAMINE:
@@ -311,24 +311,24 @@ public class ChatMessageManager
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaquePrivateMessageReceivedHighlight(), false),
ChatMessageType.MODPRIVATECHAT);
}
if (chatColorConfig.opaqueClanChatInfo() != null)
if (chatColorConfig.opaqueFriendsChatInfo() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatInfo(), false),
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueFriendsChatInfo(), false),
ChatMessageType.FRIENDSCHATNOTIFICATION);
}
if (chatColorConfig.opaqueClanChatInfoHighlight() != null)
if (chatColorConfig.opaqueFriendsChatInfoHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueClanChatInfoHighlight(), false),
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueFriendsChatInfoHighlight(), false),
ChatMessageType.FRIENDSCHATNOTIFICATION);
}
if (chatColorConfig.opaqueClanChatMessage() != null)
if (chatColorConfig.opaqueFriendsChatMessage() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueClanChatMessage(), false),
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.opaqueFriendsChatMessage(), false),
ChatMessageType.FRIENDSCHAT);
}
if (chatColorConfig.opaqueClanChatMessageHighlight() != null)
if (chatColorConfig.opaqueFriendsChatMessageHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueClanChatMessageHighlight(), false),
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.opaqueFriendsChatMessageHighlight(), false),
ChatMessageType.FRIENDSCHAT);
}
if (chatColorConfig.opaqueAutochatMessage() != null)
@@ -444,24 +444,24 @@ public class ChatMessageManager
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentPrivateMessageReceivedHighlight(), true),
ChatMessageType.MODPRIVATECHAT);
}
if (chatColorConfig.transparentClanChatInfo() != null)
if (chatColorConfig.transparentFriendsChatInfo() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatInfo(), true),
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentFriendsChatInfo(), true),
ChatMessageType.FRIENDSCHATNOTIFICATION);
}
if (chatColorConfig.transparentClanChatInfoHighlight() != null)
if (chatColorConfig.transparentFriendsChatInfoHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentClanChatInfoHighlight(), true),
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentFriendsChatInfoHighlight(), true),
ChatMessageType.FRIENDSCHATNOTIFICATION);
}
if (chatColorConfig.transparentClanChatMessage() != null)
if (chatColorConfig.transparentFriendsChatMessage() != null)
{
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentClanChatMessage(), true),
cacheColor(new ChatColor(ChatColorType.NORMAL, chatColorConfig.transparentFriendsChatMessage(), true),
ChatMessageType.FRIENDSCHAT);
}
if (chatColorConfig.transparentClanChatMessageHighlight() != null)
if (chatColorConfig.transparentFriendsChatMessageHighlight() != null)
{
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentClanChatMessageHighlight(), true),
cacheColor(new ChatColor(ChatColorType.HIGHLIGHT, chatColorConfig.transparentFriendsChatMessageHighlight(), true),
ChatMessageType.FRIENDSCHAT);
}
if (chatColorConfig.transparentAutochatMessage() != null)

View File

@@ -118,11 +118,11 @@ public interface ChatColorConfig extends Config
@ConfigItem(
position = 7,
keyName = "opaqueClanChatInfo",
name = "Clan chat info",
description = "Clan Chat Information (eg. when joining a channel)",
name = "Friends chat info",
description = "Friends Chat Information (eg. when joining a channel)",
titleSection = "opaqueTitle"
)
default Color opaqueClanChatInfo()
default Color opaqueFriendsChatInfo()
{
return JagexColors.CHAT_GAME_EXAMINE_TEXT_OPAQUE_BACKGROUND;
}
@@ -130,11 +130,11 @@ public interface ChatColorConfig extends Config
@ConfigItem(
position = 8,
keyName = "opaqueClanChatInfoHighlight",
name = "Clan chat info highlight",
description = "Clan Chat Information highlight (used for the Raids plugin)",
name = "Friends chat info highlight",
description = "Friends Chat Information highlight (used for the Raids plugin)",
titleSection = "opaqueTitle"
)
default Color opaqueClanChatInfoHighlight()
default Color opaqueFriendsChatInfoHighlight()
{
return Color.RED;
}
@@ -142,20 +142,20 @@ public interface ChatColorConfig extends Config
@ConfigItem(
position = 9,
keyName = "opaqueClanChatMessage",
name = "Clan chat message",
description = "Color of Clan Chat Messages",
name = "Friends chat message",
description = "Color of Friends chat messages",
titleSection = "opaqueTitle"
)
Color opaqueClanChatMessage();
Color opaqueFriendsChatMessage();
@ConfigItem(
position = 10,
keyName = "opaqueClanChatMessageHighlight",
name = "Clan chat message highlight",
description = "Color of highlights in Clan Chat Messages",
name = "Friends chat message highlight",
description = "Color of highlights in Friends Chat messages",
titleSection = "opaqueTitle"
)
default Color opaqueClanChatMessageHighlight()
default Color opaqueFriendsChatMessageHighlight()
{
return Color.decode("#000000");
}
@@ -295,20 +295,20 @@ public interface ChatColorConfig extends Config
@ConfigItem(
position = 25,
keyName = "opaqueClanChannelName",
name = "Clan channel name",
description = "Color of Clan Channel Name",
name = "Friends chat channel name",
description = "Color of Friends chat channel name",
titleSection = "opaqueTitle"
)
Color opaqueClanChannelName();
Color opaqueFriendsChatChannelName();
@ConfigItem(
position = 26,
keyName = "opaqueClanUsernames",
name = "Clan usernames",
description = "Color of Usernames in Clan Chat",
name = "Friends chat usernames",
description = "Color of usernames in Friends chat",
titleSection = "opaqueTitle"
)
Color opaqueClanUsernames();
Color opaqueFriendsChatUsernames();
@ConfigItem(
position = 27,
@@ -385,11 +385,11 @@ public interface ChatColorConfig extends Config
@ConfigItem(
position = 57,
keyName = "transparentClanChatInfo",
name = "Clan chat info (transparent)",
description = "Clan Chat Information (eg. when joining a channel) (transparent)",
name = "Friends chat info (transparent)",
description = "Friends chat information (eg. when joining a channel) (transparent)",
titleSection = "transparentTitle"
)
default Color transparentClanChatInfo()
default Color transparentFriendsChatInfo()
{
return JagexColors.CHAT_GAME_EXAMINE_TEXT_TRANSPARENT_BACKGROUND;
}
@@ -397,11 +397,11 @@ public interface ChatColorConfig extends Config
@ConfigItem(
position = 58,
keyName = "transparentClanChatInfoHighlight",
name = "Clan chat info highlight (transparent)",
description = "Clan Chat Information highlight (used for the Raids plugin) (transparent)",
name = "Friends chat info highlight (transparent)",
description = "Friends chat information highlight (used for the Raids plugin) (transparent)",
titleSection = "transparentTitle"
)
default Color transparentClanChatInfoHighlight()
default Color transparentFriendsChatInfoHighlight()
{
return Color.RED;
}
@@ -409,20 +409,20 @@ public interface ChatColorConfig extends Config
@ConfigItem(
position = 59,
keyName = "transparentClanChatMessage",
name = "Clan chat message (transparent)",
description = "Color of Clan Chat Messages (transparent)",
name = "Friends chat message (transparent)",
description = "Color of Friends chat messages (transparent)",
titleSection = "transparentTitle"
)
Color transparentClanChatMessage();
Color transparentFriendsChatMessage();
@ConfigItem(
position = 60,
keyName = "transparentClanChatMessageHighlight",
name = "Clan chat message highlight (transparent)",
description = "Color of highlights in Clan Chat Messages (transparent)",
name = "Friends chat message highlight (transparent)",
description = "Color of highlights in Friends chat messages (transparent)",
titleSection = "transparentTitle"
)
default Color transparentClanChatMessageHighlight()
default Color transparentFriendsChatMessageHighlight()
{
return Color.decode("#FFFFFF");
}
@@ -562,20 +562,20 @@ public interface ChatColorConfig extends Config
@ConfigItem(
position = 75,
keyName = "transparentClanChannelName",
name = "Clan channel name (transparent)",
description = "Color of Clan Channel Name (transparent)",
name = "Friends chat channel name (transparent)",
description = "Color of Friends chat channel name (transparent)",
titleSection = "transparentTitle"
)
Color transparentClanChannelName();
Color transparentFriendsChatChannelName();
@ConfigItem(
position = 76,
keyName = "transparentClanUsernames",
name = "Clan usernames (transparent)",
description = "Color of Usernames in Clan Chat (transparent)",
name = "Friends chat usernames (transparent)",
description = "Color of usernames in Friends chat (transparent)",
titleSection = "transparentTitle"
)
Color transparentClanUsernames();
Color transparentFriendsChatUsernames();
@ConfigItem(
position = 77,

View File

@@ -40,7 +40,7 @@ class ConfigInvocationHandler implements InvocationHandler
private final ConfigManager manager;
private final Cache<Method, Object> cache = CacheBuilder.newBuilder()
.maximumSize(128)
.maximumSize(256)
.build();
ConfigInvocationHandler(ConfigManager manager)

View File

@@ -16,19 +16,19 @@ public class AttackStyleChanged implements Event
/**
* The player that changed styles.
*/
private final Player player;
Player player;
/**
* Can be Unknown(nullable)
*
* @see net.runelite.client.game.AttackStyle
*/
private final AttackStyle oldStyle;
AttackStyle oldStyle;
/**
* Can be Unknown(nullable)
*
* @see net.runelite.client.game.AttackStyle
*/
private final AttackStyle newStyle;
AttackStyle newStyle;
}

View File

@@ -37,7 +37,7 @@ import net.runelite.api.events.Event;
@Slf4j
public class ClientShutdown implements Event
{
private Queue<Future<?>> tasks = new ConcurrentLinkedQueue<>();
Queue<Future<?>> tasks = new ConcurrentLinkedQueue<>();
public void waitFor(Future<?> future)
{

View File

@@ -0,0 +1,37 @@
/*
* Copyright (c) 2020, 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.client.events;
import lombok.Value;
import net.runelite.api.events.Event;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
import net.runelite.client.ui.overlay.infobox.InfoBox;
@Value
public class InfoBoxMenuClicked implements Event
{
OverlayMenuEntry entry;
InfoBox infoBox;
}

View File

@@ -31,5 +31,5 @@ import net.runelite.client.ui.NavigationButton;
@Value
public class NavigationButtonAdded implements Event
{
private NavigationButton button;
NavigationButton button;
}

View File

@@ -31,5 +31,5 @@ import net.runelite.client.ui.NavigationButton;
@Value
public class NavigationButtonRemoved implements Event
{
private NavigationButton button;
NavigationButton button;
}

View File

@@ -31,6 +31,6 @@ import net.runelite.api.events.Event;
@Value
public class NotificationFired implements Event
{
final String message;
final TrayIcon.MessageType type;
String message;
TrayIcon.MessageType type;
}

View File

@@ -33,6 +33,6 @@ import net.runelite.client.game.ItemStack;
@Value
public class NpcLootReceived implements Event
{
private final NPC npc;
private final Collection<ItemStack> items;
NPC npc;
Collection<ItemStack> items;
}

View File

@@ -39,4 +39,4 @@ public class OverlayMenuClicked implements Event
{
private OverlayMenuEntry entry;
private Overlay overlay;
}
}

View File

@@ -31,5 +31,5 @@ import net.runelite.api.events.Event;
@Value
public class PartyChanged implements Event
{
private final UUID partyId;
UUID partyId;
}

View File

@@ -33,6 +33,6 @@ import net.runelite.client.game.ItemStack;
@Value
public class PlayerLootReceived implements Event
{
private final Player player;
private final Collection<ItemStack> items;
Player player;
Collection<ItemStack> items;
}

View File

@@ -34,5 +34,5 @@ import net.runelite.http.api.worlds.WorldResult;
@Value
public class WorldsFetch implements Event
{
private final WorldResult worldResult;
WorldResult worldResult;
}

View File

@@ -171,13 +171,13 @@ public enum FishingSpot
MINNOW("Minnow", ItemID.MINNOW,
FISHING_SPOT_7730, FISHING_SPOT_7731, FISHING_SPOT_7732, FISHING_SPOT_7733
),
INFERNAL_EEL("Infernal Eel", "Leaping sturgeon", ItemID.INFERNAL_EEL,
INFERNAL_EEL("Infernal Eel", ItemID.INFERNAL_EEL,
ROD_FISHING_SPOT_7676
),
KARAMBWAN("Karambwan", "Karambwanji", ItemID.RAW_KARAMBWAN,
KARAMBWAN("Karambwan", ItemID.RAW_KARAMBWAN,
FISHING_SPOT_4712, FISHING_SPOT_4713
),
KARAMBWANJI("Karambwanji, Shrimp", ItemID.KARAMBWANJI,
KARAMBWANJI("Karambwanji, Shrimp", "Karambwanji", ItemID.KARAMBWANJI,
FISHING_SPOT_4710
),
SACRED_EEL("Sacred eel", ItemID.SACRED_EEL,

View File

@@ -36,118 +36,115 @@ import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.ClanMember;
import net.runelite.api.ClanMemberManager;
import net.runelite.api.ClanMemberRank;
import net.runelite.api.Client;
import net.runelite.api.FriendsChatManager;
import net.runelite.api.FriendsChatMember;
import net.runelite.api.FriendsChatRank;
import net.runelite.api.GameState;
import net.runelite.api.IndexedSprite;
import net.runelite.api.SpriteID;
import net.runelite.api.events.ClanChanged;
import net.runelite.api.events.FriendsChatChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.util.Text;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.util.ImageUtil;
@Singleton
public class ClanManager
public class FriendChatManager
{
private static final int[] CLANCHAT_IMAGES =
private static final int[] RANK_IMAGES =
{
SpriteID.CLAN_CHAT_RANK_SMILEY_FRIEND,
SpriteID.CLAN_CHAT_RANK_SINGLE_CHEVRON_RECRUIT,
SpriteID.CLAN_CHAT_RANK_DOUBLE_CHEVRON_CORPORAL,
SpriteID.CLAN_CHAT_RANK_TRIPLE_CHEVRON_SERGEANT,
SpriteID.CLAN_CHAT_RANK_BRONZE_STAR_LIEUTENANT,
SpriteID.CLAN_CHAT_RANK_SILVER_STAR_CAPTAIN,
SpriteID.CLAN_CHAT_RANK_GOLD_STAR_GENERAL,
SpriteID.CLAN_CHAT_RANK_KEY_CHANNEL_OWNER,
SpriteID.CLAN_CHAT_RANK_CROWN_JAGEX_MODERATOR,
SpriteID.FRIENDS_CHAT_RANK_SMILEY_FRIEND,
SpriteID.FRIENDS_CHAT_RANK_SINGLE_CHEVRON_RECRUIT,
SpriteID.FRIENDS_CHAT_RANK_DOUBLE_CHEVRON_CORPORAL,
SpriteID.FRIENDS_CHAT_RANK_TRIPLE_CHEVRON_SERGEANT,
SpriteID.FRIENDS_CHAT_RANK_BRONZE_STAR_LIEUTENANT,
SpriteID.FRIENDS_CHAT_RANK_SILVER_STAR_CAPTAIN,
SpriteID.FRIENDS_CHAT_RANK_GOLD_STAR_GENERAL,
SpriteID.FRIENDS_CHAT_RANK_KEY_CHANNEL_OWNER,
SpriteID.FRIENDS_CHAT_RANK_CROWN_JAGEX_MODERATOR,
};
private static final Dimension CLANCHAT_IMAGE_DIMENSION = new Dimension(11, 11);
private static final Color CLANCHAT_IMAGE_OUTLINE_COLOR = new Color(33, 33, 33);
private static final Dimension IMAGE_DIMENSION = new Dimension(11, 11);
private static final Color IMAGE_OUTLINE_COLOR = new Color(33, 33, 33);
private final Client client;
private final SpriteManager spriteManager;
private final BufferedImage[] clanChatImages = new BufferedImage[CLANCHAT_IMAGES.length];
private final BufferedImage[] rankImages = new BufferedImage[RANK_IMAGES.length];
private final LoadingCache<String, ClanMemberRank> clanRanksCache = CacheBuilder.newBuilder()
private final LoadingCache<String, FriendsChatRank> ranksCache = CacheBuilder.newBuilder()
.maximumSize(100)
.expireAfterWrite(1, TimeUnit.MINUTES)
.build(new CacheLoader<String, ClanMemberRank>()
.build(new CacheLoader<>()
{
@Override
public ClanMemberRank load(@Nonnull String key)
public FriendsChatRank load(@Nonnull String key)
{
final ClanMemberManager clanMemberManager = client.getClanMemberManager();
if (clanMemberManager == null)
final FriendsChatManager friendsChatManager = client.getFriendsChatManager();
if (friendsChatManager == null)
{
return ClanMemberRank.UNRANKED;
return FriendsChatRank.UNRANKED;
}
ClanMember clanMember = clanMemberManager.findByName(sanitize(key));
return clanMember != null ? clanMember.getRank() : ClanMemberRank.UNRANKED;
FriendsChatMember friendsChatMember = friendsChatManager.findByName(sanitize(key));
return friendsChatMember != null ? friendsChatMember.getRank() : FriendsChatRank.UNRANKED;
}
});
private int offset;
@Inject
private ClanManager(
final Client client,
final SpriteManager spriteManager,
final EventBus eventbus
)
private FriendChatManager(final Client client,
final SpriteManager spriteManager,
final EventBus eventbus)
{
this.client = client;
this.spriteManager = spriteManager;
eventbus.subscribe(GameStateChanged.class, this, this::onGameStateChanged);
eventbus.subscribe(ClanChanged.class, this, this::onClanChanged);
eventbus.subscribe(FriendsChatChanged.class, this, this::onFriendsChatChanged);
}
public boolean isClanMember(String name)
public boolean isMember(String name)
{
ClanMemberManager clanMemberManager = client.getClanMemberManager();
return clanMemberManager != null && clanMemberManager.findByName(name) != null;
FriendsChatManager friendsChatManager = client.getFriendsChatManager();
return friendsChatManager != null && friendsChatManager.findByName(name) != null;
}
public ClanMemberRank getRank(String playerName)
public FriendsChatRank getRank(String playerName)
{
return clanRanksCache.getUnchecked(playerName);
return ranksCache.getUnchecked(playerName);
}
@Nullable
public BufferedImage getClanImage(final ClanMemberRank clanMemberRank)
public BufferedImage getRankImage(final FriendsChatRank friendsChatRank)
{
if (clanMemberRank == ClanMemberRank.UNRANKED)
if (friendsChatRank == FriendsChatRank.UNRANKED)
{
return null;
}
return clanChatImages[clanMemberRank.ordinal() - 1];
return rankImages[friendsChatRank.ordinal() - 1];
}
public int getIconNumber(final ClanMemberRank clanMemberRank)
public int getIconNumber(final FriendsChatRank friendsChatRank)
{
return offset + clanMemberRank.ordinal() - 1;
return offset + friendsChatRank.ordinal() - 1;
}
private void onGameStateChanged(GameStateChanged gameStateChanged)
{
if (gameStateChanged.getGameState() == GameState.LOGGED_IN && offset == 0)
{
loadClanChatIcons();
loadRankIcons();
}
}
private void onClanChanged(ClanChanged clanChanged)
public void onFriendsChatChanged(FriendsChatChanged friendsChatChanged)
{
clanRanksCache.invalidateAll();
ranksCache.invalidateAll();
}
private void loadClanChatIcons()
private void loadRankIcons()
{
{
IndexedSprite[] modIcons = client.getModIcons();
@@ -157,21 +154,21 @@ public class ClanManager
new BufferedImage(modIcons[0].getWidth(), modIcons[0].getHeight(), BufferedImage.TYPE_INT_ARGB),
client);
modIcons = Arrays.copyOf(modIcons, offset + CLANCHAT_IMAGES.length);
modIcons = Arrays.copyOf(modIcons, offset + RANK_IMAGES.length);
Arrays.fill(modIcons, offset, modIcons.length, blank);
client.setModIcons(modIcons);
}
for (int i = 0; i < CLANCHAT_IMAGES.length; i++)
for (int i = 0; i < RANK_IMAGES.length; i++)
{
final int fi = i;
spriteManager.getSpriteAsync(CLANCHAT_IMAGES[i], 0, sprite ->
spriteManager.getSpriteAsync(RANK_IMAGES[i], 0, sprite ->
{
IndexedSprite[] modIcons = client.getModIcons();
clanChatImages[fi] = clanChatImageFromSprite(sprite);
modIcons[offset + fi] = ImageUtil.getImageIndexedSprite(clanChatImages[fi], client);
rankImages[fi] = friendsChatImageFromSprite(sprite);
modIcons[offset + fi] = ImageUtil.getImageIndexedSprite(rankImages[fi], client);
});
}
}
@@ -182,9 +179,9 @@ public class ClanManager
return cleaned.replace('\u00A0', ' ');
}
private static BufferedImage clanChatImageFromSprite(final BufferedImage clanSprite)
private static BufferedImage friendsChatImageFromSprite(final BufferedImage sprite)
{
final BufferedImage clanChatCanvas = ImageUtil.resizeCanvas(clanSprite, CLANCHAT_IMAGE_DIMENSION.width, CLANCHAT_IMAGE_DIMENSION.height);
return ImageUtil.outlineImage(clanChatCanvas, CLANCHAT_IMAGE_OUTLINE_COLOR);
final BufferedImage canvas = ImageUtil.resizeCanvas(sprite, IMAGE_DIMENSION.width, IMAGE_DIMENSION.height);
return ImageUtil.outlineImage(canvas, IMAGE_OUTLINE_COLOR);
}
}

View File

@@ -29,6 +29,7 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ListMultimap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -423,4 +424,25 @@ public class LootManager
return new WorldPoint(x, y, worldLocation.getPlane());
}
/**
* Get the list of items present at the provided WorldPoint that spawned this tick.
*
* @param worldPoint the location in question
* @return the list of item stacks
*/
public Collection<ItemStack> getItemSpawns(WorldPoint worldPoint)
{
LocalPoint localPoint = LocalPoint.fromWorld(client, worldPoint);
if (localPoint == null)
{
return Collections.emptyList();
}
final int sceneX = localPoint.getSceneX();
final int sceneY = localPoint.getSceneY();
final int packed = sceneX << 8 | sceneY;
final List<ItemStack> itemStacks = itemSpawns.get(packed);
return Collections.unmodifiableList(itemStacks);
}
}

View File

@@ -44,7 +44,7 @@ public class PlayerManager
private final Client client;
private final ItemManager itemManager;
private final EventBus eventBus;
private final ClanManager clanManager;
private final FriendChatManager friendChatManager;
private final Map<String, PlayerContainer> playerMap = new ConcurrentHashMap<>();
private final Map<String, HiscoreResult> resultCache = new ConcurrentHashMap<>();
private final ExecutorService executorService = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors() * 2);
@@ -54,13 +54,13 @@ public class PlayerManager
final Client client,
final EventBus eventBus,
final ItemManager itemManager,
final ClanManager clanManager
final FriendChatManager friendChatManager
)
{
this.client = client;
this.itemManager = itemManager;
this.eventBus = eventBus;
this.clanManager = clanManager;
this.friendChatManager = friendChatManager;
eventBus.subscribe(PlayerDespawned.class, this, this::onPlayerDespawned);
eventBus.subscribe(AnimationChanged.class, this, this::onAnimationChanged);
eventBus.subscribe(PlayerAppearanceChanged.class, this, this::onAppearenceChanged);
@@ -211,7 +211,7 @@ public class PlayerManager
PlayerContainer player = playerMap.computeIfAbsent(event.getPlayer().getName(), s -> new PlayerContainer(event.getPlayer()));
update(player);
player.setFriend(client.isFriended(player.getName(), false));
player.setClan(clanManager.isClanMember(player.getName()));
player.setClan(friendChatManager.isMember(player.getName()));
}
private void onPlayerDespawned(PlayerDespawned event)

View File

@@ -54,6 +54,7 @@ import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.inject.Inject;
import javax.inject.Named;
import javax.inject.Singleton;
import javax.swing.JOptionPane;
import lombok.AccessLevel;
@@ -66,6 +67,7 @@ import net.runelite.client.RuneLiteProperties;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.ExternalPluginChanged;
@@ -112,9 +114,11 @@ public class ExternalPluginManager
@Getter(AccessLevel.PUBLIC)
private UpdateManager updateManager;
private final Set<PluginType> pluginTypes = Set.of(PluginType.values());
private final boolean safeMode;
@Inject
public ExternalPluginManager(
@Named("safeMode") final boolean safeMode,
PluginManager pluginManager,
OpenOSRSConfig openOSRSConfig,
EventBus eventBus,
@@ -122,6 +126,7 @@ public class ExternalPluginManager
ConfigManager configManager,
Groups groups)
{
this.safeMode = safeMode;
this.runelitePluginManager = pluginManager;
this.openOSRSConfig = openOSRSConfig;
this.eventBus = eventBus;
@@ -449,6 +454,14 @@ public class ExternalPluginManager
continue;
}
if (safeMode && !pluginDescriptor.loadInSafeMode())
{
log.debug("Disabling {} due to safe mode", clazz);
// also disable the plugin from autostarting later
configManager.unsetConfiguration(RuneLiteConfig.GROUP_NAME, clazz.getSimpleName().toLowerCase());
continue;
}
@SuppressWarnings("unchecked") Class<Plugin> pluginClass = (Class<Plugin>) clazz;
graph.addNode(pluginClass);
}

View File

@@ -58,4 +58,6 @@ public @interface PluginDescriptor
PluginType type() default PluginType.UNCATEGORIZED;
boolean enabledByDefault() default true;
boolean loadInSafeMode() default true;
}

View File

@@ -92,6 +92,7 @@ public class PluginManager
*/
private static final String PLUGIN_PACKAGE = "net.runelite.client.plugins";
private final boolean safeMode;
private final EventBus eventBus;
private final Scheduler scheduler;
private final ExecutorService executorService;
@@ -112,6 +113,7 @@ public class PluginManager
@Inject
@VisibleForTesting
PluginManager(
@Named("safeMode") final boolean safeMode,
final EventBus eventBus,
final Scheduler scheduler,
final ExecutorService executorService,
@@ -120,6 +122,7 @@ public class PluginManager
final Groups groups,
final @Named("config") File config)
{
this.safeMode = safeMode;
this.eventBus = eventBus;
this.scheduler = scheduler;
this.executorService = executorService;
@@ -376,6 +379,14 @@ public class PluginManager
continue;
}
if (safeMode && !pluginDescriptor.loadInSafeMode())
{
log.debug("Disabling {} due to safe mode", clazz);
// also disable the plugin from autostarting later
configManager.unsetConfiguration(RuneLiteConfig.GROUP_NAME, clazz.getSimpleName().toLowerCase());
continue;
}
@SuppressWarnings("unchecked") Class<Plugin> pluginClass = (Class<Plugin>) clazz;
graph.addNode(pluginClass);
}

View File

@@ -537,7 +537,32 @@ public class ClientUI
if (clientBounds != null)
{
frame.setBounds(clientBounds);
frame.revalidateMinimumSize();
// frame.getGraphicsConfiguration().getBounds() returns the bounds for the primary display.
// We have to find the correct graphics configuration by using the intersection of the client boundaries.
GraphicsConfiguration gc = getIntersectingDisplay(clientBounds);
if (gc != null)
{
double scale = gc.getDefaultTransform().getScaleX();
// When Windows screen scaling is on, the position/bounds will be wrong when they are set.
// The bounds saved in shutdown are the full, non-scaled co-ordinates.
if (scale != 1)
{
clientBounds.setRect(
clientBounds.getX() / scale,
clientBounds.getY() / scale,
clientBounds.getWidth() / scale,
clientBounds.getHeight() / scale);
frame.setMinimumSize(clientBounds.getSize());
frame.setBounds(clientBounds);
}
}
else
{
frame.setLocationRelativeTo(frame.getOwner());
}
}
else
{
@@ -560,25 +585,13 @@ public class ClientUI
frame.setLocationRelativeTo(frame.getOwner());
}
// If the frame is well hidden (e.g. unplugged 2nd screen),
// we want to move it back to default position as it can be
// hard for the user to reposition it themselves otherwise.
Rectangle clientBounds = frame.getBounds();
Rectangle screenBounds = frame.getGraphicsConfiguration().getBounds();
if (clientBounds.x + clientBounds.width - CLIENT_WELL_HIDDEN_MARGIN < screenBounds.getX() ||
clientBounds.x + CLIENT_WELL_HIDDEN_MARGIN > screenBounds.getX() + screenBounds.getWidth() ||
clientBounds.y + CLIENT_WELL_HIDDEN_MARGIN_TOP < screenBounds.getY() ||
clientBounds.y + CLIENT_WELL_HIDDEN_MARGIN > screenBounds.getY() + screenBounds.getHeight())
{
frame.setLocationRelativeTo(frame.getOwner());
}
// Show frame
frame.setVisible(true);
frame.toFront();
requestFocus();
giveClientFocus();
log.info("Showing frame {}", frame);
frame.revalidateMinimumSize();
});
// Show out of date dialog if needed
@@ -591,6 +604,24 @@ public class ClientUI
}
}
private GraphicsConfiguration getIntersectingDisplay(final Rectangle bounds)
{
GraphicsDevice[] gds = GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices();
for (GraphicsDevice gd : gds)
{
GraphicsConfiguration gc = gd.getDefaultConfiguration();
final Rectangle displayBounds = gc.getBounds();
if (displayBounds.intersects(bounds))
{
return gc;
}
}
return null;
}
private boolean showWarningOnExit()
{
if (config.warningOnExit() == WarningOnExit.ALWAYS)
@@ -1125,14 +1156,14 @@ public class ClientUI
private void saveClientBoundsConfig()
{
final Rectangle bounds = frame.getBounds();
if ((frame.getExtendedState() & JFrame.MAXIMIZED_BOTH) != 0)
{
configManager.setConfiguration(CONFIG_GROUP, CONFIG_CLIENT_BOUNDS, bounds);
configManager.setConfiguration(CONFIG_GROUP, CONFIG_CLIENT_MAXIMIZED, true);
}
else
{
final Rectangle bounds = frame.getBounds();
// Try to expand sidebar
if (!sidebarOpen)
{

View File

@@ -36,8 +36,8 @@ public class JagexColors
*/
public static final Color CHAT_PUBLIC_TEXT_OPAQUE_BACKGROUND = Color.BLUE;
public static final Color CHAT_PRIVATE_MESSAGE_TEXT_OPAQUE_BACKGROUND = Color.CYAN;
public static final Color CHAT_CLAN_TEXT_OPAQUE_BACKGROUND = new Color(127, 0, 0);
public static final Color CHAT_CLAN_NAME_OPAQUE_BACKGROUND = Color.BLUE;
public static final Color CHAT_FC_TEXT_OPAQUE_BACKGROUND = new Color(127, 0, 0);
public static final Color CHAT_FC_NAME_OPAQUE_BACKGROUND = Color.BLUE;
public static final Color CHAT_GAME_EXAMINE_TEXT_OPAQUE_BACKGROUND = Color.BLACK;
public static final Color CHAT_TYPED_TEXT_OPAQUE_BACKGROUND = Color.BLUE;
@@ -46,8 +46,8 @@ public class JagexColors
*/
public static final Color CHAT_PUBLIC_TEXT_TRANSPARENT_BACKGROUND = new Color(144, 144, 255);
public static final Color CHAT_PRIVATE_MESSAGE_TEXT_TRANSPARENT_BACKGROUND = Color.CYAN;
public static final Color CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND = new Color(239, 80, 80);
public static final Color CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND = new Color(144, 112, 255);
public static final Color CHAT_FC_TEXT_TRANSPARENT_BACKGROUND = new Color(239, 80, 80);
public static final Color CHAT_FC_NAME_TRANSPARENT_BACKGROUND = new Color(144, 112, 255);
public static final Color CHAT_GAME_EXAMINE_TEXT_TRANSPARENT_BACKGROUND = Color.WHITE;
public static final Color CHAT_TYPED_TEXT_TRANSPARENT_BACKGROUND = new Color(144, 144, 255);

View File

@@ -137,17 +137,17 @@ public class OverlayManager
private void onMenuOptionClicked(MenuOptionClicked event)
{
if (event.getMenuOpcode() != MenuOpcode.RUNELITE_OVERLAY)
MenuOpcode menuOpcode = event.getMenuOpcode();
if (menuOpcode != MenuOpcode.RUNELITE_OVERLAY && menuOpcode != MenuOpcode.RUNELITE_OVERLAY_CONFIG)
{
return;
}
event.consume();
Optional<Overlay> optionalOverlay = overlays.stream().filter(o -> overlays.indexOf(o) == event.getIdentifier()).findAny();
if (optionalOverlay.isPresent())
Overlay overlay = overlays.get(event.getIdentifier());
if (overlay != null)
{
Overlay overlay = optionalOverlay.get();
List<OverlayMenuEntry> menuEntries = overlay.getMenuEntries();
Optional<OverlayMenuEntry> optionalOverlayMenuEntry = menuEntries.stream()
.filter(me -> me.getOption().equals(event.getOption()))

View File

@@ -50,7 +50,6 @@ import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.MenuEntry;
import net.runelite.api.MenuOpcode;
import net.runelite.api.events.BeforeRender;
import net.runelite.api.events.ClientTick;
import net.runelite.api.events.FocusChanged;
@@ -818,6 +817,11 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
private MenuEntry[] createRightClickMenuEntries(Overlay overlay)
{
List<OverlayMenuEntry> menuEntries = overlay.getMenuEntries();
if (menuEntries.isEmpty())
{
return null;
}
final MenuEntry[] entries = new MenuEntry[menuEntries.size()];
// Add in reverse order so they display correctly in the right-click menu
@@ -828,7 +832,7 @@ public class OverlayRenderer extends MouseAdapter implements KeyListener
final MenuEntry entry = new MenuEntry();
entry.setOption(overlayMenuEntry.getOption());
entry.setTarget(ColorUtil.wrapWithColorTag(overlayMenuEntry.getTarget(), JagexColors.MENU_TARGET));
entry.setOpcode(MenuOpcode.RUNELITE_OVERLAY.getId());
entry.setOpcode(overlayMenuEntry.getMenuOpcode().getId());
entry.setIdentifier(overlayManager.getOverlays().indexOf(overlay)); // overlay id
entries[i] = entry;

View File

@@ -35,6 +35,7 @@ import java.awt.image.BufferedImage;
import lombok.Getter;
import lombok.Setter;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.overlay.infobox.InfoBox;
@Setter
public class InfoBoxComponent implements LayoutableRenderableEntity
@@ -54,6 +55,8 @@ public class InfoBoxComponent implements LayoutableRenderableEntity
private Color color = Color.WHITE;
private Color backgroundColor = ComponentConstants.STANDARD_BACKGROUND_COLOR;
private BufferedImage image;
@Getter
private InfoBox infoBox;
@Override
public Dimension render(Graphics2D graphics)

View File

@@ -26,11 +26,14 @@ package net.runelite.client.ui.overlay.infobox;
import java.awt.Color;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.List;
import javax.annotation.Nonnull;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.Setter;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
public abstract class InfoBox
{
@@ -54,6 +57,10 @@ public abstract class InfoBox
@Setter
private String tooltip;
@Getter
@Setter
private List<OverlayMenuEntry> menuEntries = new ArrayList<>();
public InfoBox(BufferedImage image, @Nonnull Plugin plugin)
{
this.plugin = plugin;

View File

@@ -31,11 +31,17 @@ import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.Collections;
import java.util.List;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.MenuOpcode;
import net.runelite.api.events.MenuOptionClicked;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.events.InfoBoxMenuClicked;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
import net.runelite.client.ui.overlay.OverlayPanel;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.components.ComponentOrientation;
@@ -54,18 +60,23 @@ public class InfoBoxOverlay extends OverlayPanel
private final TooltipManager tooltipManager;
private final Client client;
private final RuneLiteConfig config;
private final EventBus eventBus;
private InfoBoxComponent hoveredComponent;
@Inject
private InfoBoxOverlay(
InfoBoxManager infoboxManager,
TooltipManager tooltipManager,
Client client,
RuneLiteConfig config)
RuneLiteConfig config,
EventBus eventBus)
{
this.tooltipManager = tooltipManager;
this.infoboxManager = infoboxManager;
this.client = client;
this.config = config;
this.eventBus = eventBus;
setPosition(OverlayPosition.TOP_LEFT);
setClearChildren(false);
@@ -73,6 +84,8 @@ public class InfoBoxOverlay extends OverlayPanel
panelComponent.setBackgroundColor(null);
panelComponent.setBorder(new Rectangle());
panelComponent.setGap(new Point(GAP, GAP));
eventBus.subscribe(MenuOptionClicked.class, this, this::onMenuOptionClicked);
}
@Override
@@ -80,6 +93,12 @@ public class InfoBoxOverlay extends OverlayPanel
{
final List<InfoBox> infoBoxes = infoboxManager.getInfoBoxes();
final boolean menuOpen = client.isMenuOpen();
if (!menuOpen)
{
hoveredComponent = null;
}
if (infoBoxes.isEmpty())
{
return null;
@@ -112,6 +131,7 @@ public class InfoBoxOverlay extends OverlayPanel
infoBoxComponent.setTooltip(box.getTooltip());
infoBoxComponent.setPreferredSize(new Dimension(config.infoBoxSize(), config.infoBoxSize()));
infoBoxComponent.setBackgroundColor(config.overlayBackgroundColor());
infoBoxComponent.setInfoBox(box);
panelComponent.getChildren().add(infoBoxComponent);
}
@@ -122,25 +142,49 @@ public class InfoBoxOverlay extends OverlayPanel
for (final LayoutableRenderableEntity child : panelComponent.getChildren())
{
if (child instanceof InfoBoxComponent)
final InfoBoxComponent component = (InfoBoxComponent) child;
// Create intersection rectangle
final Rectangle intersectionRectangle = new Rectangle(component.getBounds());
intersectionRectangle.translate(getBounds().x, getBounds().y);
if (intersectionRectangle.contains(mouse))
{
final InfoBoxComponent component = (InfoBoxComponent) child;
if (!Strings.isNullOrEmpty(component.getTooltip()))
final String tooltip = component.getTooltip();
if (!Strings.isNullOrEmpty(tooltip))
{
// Create intersection rectangle
final Rectangle intersectionRectangle = new Rectangle(component.getBounds());
intersectionRectangle.translate(getBounds().x, getBounds().y);
if (intersectionRectangle.contains(mouse))
{
tooltipManager.add(new Tooltip(component.getTooltip()));
}
tooltipManager.add(new Tooltip(tooltip));
}
if (!menuOpen)
{
hoveredComponent = component;
}
break;
}
}
panelComponent.getChildren().clear();
return dimension;
}
@Override
public List<OverlayMenuEntry> getMenuEntries()
{
// we dynamically build the menu options based on which infobox is hovered
return hoveredComponent == null ? Collections.emptyList() : hoveredComponent.getInfoBox().getMenuEntries();
}
public void onMenuOptionClicked(MenuOptionClicked menuOptionClicked)
{
if (menuOptionClicked.getMenuOpcode() != MenuOpcode.RUNELITE_INFOBOX)
{
return;
}
InfoBox infoBox = hoveredComponent.getInfoBox();
infoBox.getMenuEntries().stream()
.filter(me -> me.getOption().equals(menuOptionClicked.getOption()))
.findAny().ifPresent(overlayMenuEntry -> eventBus.post(InfoBoxMenuClicked.class, new InfoBoxMenuClicked(overlayMenuEntry, infoBox)));
}
}

View File

@@ -39,8 +39,8 @@ import net.runelite.client.plugins.Plugin;
public class Timer extends InfoBox
{
private final Instant startTime;
private final Instant endTime;
private final Duration duration;
private Instant endTime;
private Duration duration;
public Timer(long period, ChronoUnit unit, BufferedImage image, Plugin plugin)
{
@@ -94,4 +94,9 @@ public class Timer extends InfoBox
return timeLeft.isZero() || timeLeft.isNegative();
}
public void setDuration(Duration duration)
{
this.duration = duration;
endTime = startTime.plus(duration);
}
}

View File

@@ -38,7 +38,7 @@ LABEL20:
iconst 1
if_icmpeq LABEL31
iconst 0 ; Modified to enable clanchat input
sconst "clanchatInput"
sconst "friendsChatInput"
runelite_callback
iconst 1
if_icmpeq LABEL31 ; Compare to 1

View File

@@ -3,9 +3,9 @@
.string_stack_count 1
.int_var_count 0
.string_var_count 1
; callback "confirmClanKick"
; Used by the ClanChat plugin to show a chatbox panel confirming the requested kick
; Also requires the "confirmKicks" option of ClanChatConfig to be enabled
; callback "confirmFriendsChatKick"
; Used by the friends chat plugin to show a chatbox panel confirming the requested kick
; Also requires the "confirmKicks" option of FriendsChatConfig to be enabled
invoke 1942
iconst 1
if_icmpeq LABEL4
@@ -26,7 +26,7 @@ LABEL73:
CONFIRM_KICK:
sload 0 ; Username we are trying to kick
iconst 0 ; Modified if we are confirming the kick inside the plugin
sconst "confirmClanKick"
sconst "confirmFriendsChatKick"
runelite_callback
pop_string ; Pop username
iconst 0 ; Compare against zero

View File

@@ -95,7 +95,7 @@ public class PluginManagerTest
executorService = Executors.newSingleThreadScheduledExecutor();
Injector injector = Guice.createInjector(Modules
.override(new RuneLiteModule(() -> null, RuneLite.DEFAULT_CONFIG_FILE))
.override(new RuneLiteModule(() -> null, false, RuneLite.DEFAULT_CONFIG_FILE))
.with(BoundFieldModule.of(this)));
RuneLite.setInjector(injector);
@@ -130,7 +130,7 @@ public class PluginManagerTest
@Test
public void testLoadPlugins() throws Exception
{
PluginManager pluginManager = new PluginManager(null, null, executorService, null, null, null, null);
PluginManager pluginManager = new PluginManager(false, null, null, executorService, null, null, null, null);
pluginManager.setOutdated(true);
pluginManager.loadCorePlugins();
Collection<Plugin> plugins = pluginManager.getPlugins();
@@ -141,7 +141,7 @@ public class PluginManagerTest
.count();
assertEquals(expected, plugins.size());
pluginManager = new PluginManager(null, null, executorService, null, null, null, null);
pluginManager = new PluginManager(false, null, null, executorService, null, null, null, null);
pluginManager.loadCorePlugins();
plugins = pluginManager.getPlugins();
@@ -157,9 +157,9 @@ public class PluginManagerTest
{
List<Module> modules = new ArrayList<>();
modules.add(new GraphvizModule());
modules.add(new RuneLiteModule(() -> null, RuneLite.DEFAULT_CONFIG_FILE));
modules.add(new RuneLiteModule(() -> null, false, RuneLite.DEFAULT_CONFIG_FILE));
PluginManager pluginManager = new PluginManager(null, null, executorService, null, null, null, null);
PluginManager pluginManager = new PluginManager(false, null, null, executorService, null, null, null, null);
pluginManager.loadCorePlugins();
modules.addAll(pluginManager.getPlugins());
@@ -211,7 +211,7 @@ public class PluginManagerTest
public void testEventbusAnnotations() throws Exception
{
EventBus eventbus = new EventBus();
PluginManager pluginManager = new PluginManager(eventbus, null, executorService, null, null, null, null)
PluginManager pluginManager = new PluginManager(false, eventbus, null, executorService, null, null, null, null)
{
@Override
public boolean isPluginEnabled(Plugin plugin)

View File

@@ -118,7 +118,7 @@ public abstract class EntityHiderBridgeMixin implements RSClient
@Inject
@Override
public void setClanMatesHidden(boolean state)
public void setFriendsChatMembersHidden(boolean state)
{
hideClanMates = state;
}

View File

@@ -180,7 +180,7 @@ public abstract class EntityHiderMixin implements RSScene
}
return (!hideFriends && player.isFriend()) ||
(!isLocalPlayer && !hideClanMates && player.isClanMember());
(!isLocalPlayer && !hideClanMates && player.isFriendsChatMember());
}
}
else if (entity instanceof RSNPC)

View File

@@ -1,8 +1,8 @@
package net.runelite.mixins;
import net.runelite.api.ClanMember;
import net.runelite.api.events.ClanMemberJoined;
import net.runelite.api.events.ClanMemberLeft;
import net.runelite.api.FriendsChatMember;
import net.runelite.api.events.FriendsChatMemberJoined;
import net.runelite.api.events.FriendsChatMemberLeft;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.api.mixins.Shadow;
@@ -21,27 +21,27 @@ public abstract class RSClanChatMixin implements RSClanChat
@Override
public void rl$add(RSUsername name, RSUsername prevName)
{
ClanMember member = findByName(name);
FriendsChatMember member = findByName(name);
if (member == null)
{
return;
}
ClanMemberJoined event = new ClanMemberJoined(member);
client.getCallbacks().postDeferred(ClanMemberJoined.class, event);
FriendsChatMemberJoined event = new FriendsChatMemberJoined(member);
client.getCallbacks().postDeferred(FriendsChatMemberJoined.class, event);
}
@Inject
@Override
public void rl$remove(RSUser nameable)
{
ClanMember member = findByName(nameable.getRsName());
FriendsChatMember member = findByName(nameable.getRsName());
if (member == null)
{
return;
}
ClanMemberLeft event = new ClanMemberLeft(member);
client.getCallbacks().postDeferred(ClanMemberLeft.class, event);
FriendsChatMemberLeft event = new FriendsChatMemberLeft(member);
client.getCallbacks().postDeferred(FriendsChatMemberLeft.class, event);
}
}

View File

@@ -1,6 +1,6 @@
package net.runelite.mixins;
import net.runelite.api.ClanMemberRank;
import net.runelite.api.FriendsChatRank;
import net.runelite.api.mixins.Inject;
import net.runelite.api.mixins.Mixin;
import net.runelite.rs.api.RSClanMate;
@@ -10,8 +10,8 @@ public abstract class RSClanMateMixin implements RSClanMate
{
@Override
@Inject
public ClanMemberRank getRank()
public FriendsChatRank getRank()
{
return ClanMemberRank.valueOf(getRSRank());
return FriendsChatRank.valueOf(getRSRank());
}
}

View File

@@ -76,9 +76,9 @@ import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldPoint;
import net.runelite.api.events.CanvasSizeChanged;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ClanChanged;
import net.runelite.api.events.ClientTick;
import net.runelite.api.events.DraggingWidgetChanged;
import net.runelite.api.events.FriendsChatChanged;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GrandExchangeOfferChanged;
import net.runelite.api.events.GrandExchangeSearched;
@@ -1179,7 +1179,7 @@ public abstract class RSClientMixin implements RSClient
@Inject
public static void clanMemberManagerChanged(int idx)
{
client.getCallbacks().post(ClanChanged.class, new ClanChanged(client.getClanMemberManager() != null));
client.getCallbacks().post(FriendsChatChanged.class, new FriendsChatChanged(client.getClanMemberManager() != null));
}
@FieldHook("canvasWidth")
@@ -1713,11 +1713,11 @@ public abstract class RSClientMixin implements RSClient
{
if (client.isSpellSelected())
{
return ((hideFriendCastOptions && p.isFriended()) || (hideClanmateCastOptions && p.isClanMember()))
return ((hideFriendCastOptions && p.isFriended()) || (hideClanmateCastOptions && p.isFriendsChatMember()))
&& !unhiddenCasts.contains(client.getSelectedSpellName().replaceAll("<[^>]*>", "").toLowerCase());
}
return ((hideFriendAttackOptions && p.isFriended()) || (hideClanmateAttackOptions && p.isClanMember()));
return ((hideFriendAttackOptions && p.isFriended()) || (hideClanmateAttackOptions && p.isFriendsChatMember()));
}
@Inject

View File

@@ -102,12 +102,20 @@ public interface RSActor extends RSEntity, Actor
// Idle animation
@Import("idleSequence")
@Override
int getIdlePoseAnimation();
@Import("idleSequence")
@Override
void setIdlePoseAnimation(int animation);
// Movement animation (aka poseAnimation)
@Import("movementSequence")
@Override
int getPoseAnimation();
@Import("movementSequence")
@Override
void setPoseAnimation(int animation);
@@ -147,10 +155,6 @@ public interface RSActor extends RSEntity, Actor
@Import("hitSplatCycles")
int[] getHitsplatCycles();
@Import("idleSequence")
@Override
int getIdleAnimation();
@Import("turnLeftSequence")
@Override
int getTurnLeftAnimation();
@@ -178,8 +182,4 @@ public interface RSActor extends RSEntity, Actor
@Import("runSequence")
@Override
int getRunAnimation();
@Import("movementSequence")
@Override
int getMovementAnimation();
}

View File

@@ -1,10 +1,10 @@
package net.runelite.rs.api;
import net.runelite.api.ClanMember;
import net.runelite.api.ClanMemberManager;
import net.runelite.api.FriendsChatManager;
import net.runelite.api.FriendsChatMember;
import net.runelite.mapping.Import;
public interface RSClanChat extends RSUserList<ClanMember>, ClanMemberManager
public interface RSClanChat extends RSUserList<FriendsChatMember>, FriendsChatManager
{
@Import("owner")
String getClanOwner();

View File

@@ -1,5 +1,5 @@
package net.runelite.rs.api;
import net.runelite.api.ClanMember;
import net.runelite.api.FriendsChatMember;
public interface RSClanMate extends RSBuddy, ClanMember {}
public interface RSClanMate extends RSBuddy, FriendsChatMember {}

View File

@@ -52,7 +52,7 @@ public interface RSPlayer extends RSActor, Player
@Import("isClanMember")
@Override
boolean isClanMember();
boolean isFriendsChatMember();
@Import("isFriend")
@Override