Merge remote-tracking branch 'runelite/master' into 0908-merge

This commit is contained in:
Owain van Brakel
2019-08-11 02:20:12 +02:00
24 changed files with 203 additions and 174 deletions

View File

@@ -1255,11 +1255,10 @@ public interface Client extends GameShell
* *
* This method must be ran on the client thread and is not reentrant * This method must be ran on the client thread and is not reentrant
* *
* @param id the script ID * @param args the script id, then any additional arguments to execute the script with
* @param args additional arguments to execute the script with
* @see ScriptID * @see ScriptID
*/ */
void runScript(int id, Object... args); void runScript(Object... args);
/** /**
* Checks whether or not there is any active hint arrow. * Checks whether or not there is any active hint arrow.

View File

@@ -0,0 +1,47 @@
/*
* Copyright (c) 2019 Abex
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.api;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.SOURCE)
@Documented
@Target(ElementType.FIELD)
@interface ScriptArguments
{
/**
* The number of int arguments the script takes
*/
int integer() default 0;
/**
* The number of string arguments the script takes
*/
int string() default 0;
}

View File

@@ -34,6 +34,7 @@ public final class ScriptID
* <li> int how far down to scroll </li> * <li> int how far down to scroll </li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 3)
public static final int UPDATE_SCROLLBAR = 72; public static final int UPDATE_SCROLLBAR = 72;
/** /**
@@ -43,11 +44,13 @@ public final class ScriptID
* <li> String Message to send </li> * <li> String Message to send </li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 1, string = 1)
public static final int CHATBOX_INPUT = 96; public static final int CHATBOX_INPUT = 96;
/** /**
* Rebuilds the chatbox * Rebuilds the chatbox
*/ */
@ScriptArguments()
public static final int BUILD_CHATBOX = 216; public static final int BUILD_CHATBOX = 216;
/** /**
@@ -58,6 +61,7 @@ public final class ScriptID
* <li> String Player to send private message to</li> * <li> String Player to send private message to</li>
* </ul> * </ul>
*/ */
@ScriptArguments(string = 1)
public static final int OPEN_PRIVATE_MESSAGE_INTERFACE = 107; public static final int OPEN_PRIVATE_MESSAGE_INTERFACE = 107;
/** /**
@@ -66,15 +70,9 @@ public final class ScriptID
* <li> String Message Prefix. Only used inside the GE search interfaces * <li> String Message Prefix. Only used inside the GE search interfaces
* </ul> * </ul>
*/ */
@ScriptArguments(string = 1)
public static final int CHAT_TEXT_INPUT_REBUILD = 222; public static final int CHAT_TEXT_INPUT_REBUILD = 222;
/**
* Layouts the bank widgets
*
* Takes 13 widget ids of various parts of the bank interface
*/
public static final int BANK_LAYOUT = 277;
/** /**
* Closes the chatbox input * Closes the chatbox input
* <ul> * <ul>
@@ -82,17 +80,23 @@ public final class ScriptID
* <li> int (boolean) Restore to chat view </li> * <li> int (boolean) Restore to chat view </li>
* </ul> * </ul>
*/ */
public static final int RESET_CHATBOX_INPUT = 299; @ScriptArguments(integer = 2)
public static final int MESSAGE_LAYER_CLOSE = 299;
/** /**
* Readies the chatbox panel for things like the chatbox input * Readies the chatbox panel for things like the chatbox input
* Inverse of RESET_CHATBOX_INPUT * Inverse of MESSAGE_LAYER_CLOSE
* <ul>
* <li> int (InputType) message layer type we are changing to </li>
* </ul>
*/ */
public static final int CLEAR_CHATBOX_PANEL = 677; @ScriptArguments(integer = 1)
public static final int MESSAGE_LAYER_OPEN = 677;
/** /**
* Builds the chatbox input widget * Builds the chatbox input widget
*/ */
@ScriptArguments()
public static final int CHAT_PROMPT_INIT = 223; public static final int CHAT_PROMPT_INIT = 223;
/** /**
@@ -103,6 +107,7 @@ public final class ScriptID
* <li> String Item Name </li> * <li> String Item Name </li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 2, string = 1)
public static final int DEATH_KEEP_ITEM_EXAMINE = 1603; public static final int DEATH_KEEP_ITEM_EXAMINE = 1603;
/** /**
@@ -116,6 +121,7 @@ public final class ScriptID
* <p> * <p>
* Returns a pair of booleans indicating if the stash unit is built and if it is filled * Returns a pair of booleans indicating if the stash unit is built and if it is filled
*/ */
@ScriptArguments(integer = 4)
public static final int WATSON_STASH_UNIT_CHECK = 1479; public static final int WATSON_STASH_UNIT_CHECK = 1479;
/** /**
@@ -128,6 +134,7 @@ public final class ScriptID
* <li> int (QuestState) the normalized state of the quest * <li> int (QuestState) the normalized state of the quest
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 1)
public static final int QUESTLIST_PROGRESS = 2267; public static final int QUESTLIST_PROGRESS = 2267;
/** /**
@@ -137,6 +144,7 @@ public final class ScriptID
* <li> int Number of lines </li> * <li> int Number of lines </li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 2)
public static final int DIARY_QUEST_UPDATE_LINECOUNT = 2523; public static final int DIARY_QUEST_UPDATE_LINECOUNT = 2523;
/** /**
@@ -157,6 +165,7 @@ public final class ScriptID
* <li> int Reset zoom position </li> * <li> int Reset zoom position </li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 2)
public static final int CAMERA_DO_ZOOM = 42; public static final int CAMERA_DO_ZOOM = 42;
/** /**
@@ -165,11 +174,13 @@ public final class ScriptID
* This is used to eat events when you want a menu action attached to it * This is used to eat events when you want a menu action attached to it
* because you need an op listener attached to it for it to work * because you need an op listener attached to it for it to work
*/ */
@ScriptArguments()
public static final int NULL = 10003; public static final int NULL = 10003;
/** /**
* Send a private message. * Send a private message.
*/ */
@ScriptArguments(string = 2)
public static final int PRIVMSG = 10004; public static final int PRIVMSG = 10004;
/** /**
@@ -180,6 +191,7 @@ public final class ScriptID
* <li>int Amount of exp to drop</li> * <li>int Amount of exp to drop</li>
* </ul> * </ul>
*/ */
@ScriptArguments(integer = 2)
public static final int XPDROP_DISABLED = 2091; public static final int XPDROP_DISABLED = 2091;
/** /**

View File

@@ -42,6 +42,10 @@ public enum VarClientInt
*/ */
TOOLTIP_VISIBLE(2), TOOLTIP_VISIBLE(2),
/**
* Current message layer mode
* @see net.runelite.api.vars.InputType
*/
INPUT_TYPE(5), INPUT_TYPE(5),
MEMBERSHIP_STATUS(103), MEMBERSHIP_STATUS(103),

View File

@@ -623,6 +623,8 @@ public interface Widget
*/ */
Object[] getOnLoadListener(); Object[] getOnLoadListener();
Object[] getOnInvTransmitListener();
/** /**
* Returns the archive id of the font used * Returns the archive id of the font used
* *

View File

@@ -72,8 +72,9 @@ public class Notifier
private static final int MINIMUM_FLASH_DURATION_MILLIS = 2000; private static final int MINIMUM_FLASH_DURATION_MILLIS = 2000;
private static final int MINIMUM_FLASH_DURATION_TICKS = MINIMUM_FLASH_DURATION_MILLIS / Constants.CLIENT_TICK_LENGTH; private static final int MINIMUM_FLASH_DURATION_TICKS = MINIMUM_FLASH_DURATION_MILLIS / Constants.CLIENT_TICK_LENGTH;
private static final String appName = RuneLiteProperties.getTitle();
private final Client client; private final Client client;
private final String appName;
private final RuneLiteConfig runeLiteConfig; private final RuneLiteConfig runeLiteConfig;
private final ClientUI clientUI; private final ClientUI clientUI;
private final ScheduledExecutorService executorService; private final ScheduledExecutorService executorService;
@@ -88,12 +89,10 @@ public class Notifier
final ClientUI clientUI, final ClientUI clientUI,
final Client client, final Client client,
final RuneLiteConfig runeliteConfig, final RuneLiteConfig runeliteConfig,
final RuneLiteProperties runeLiteProperties,
final ScheduledExecutorService executorService, final ScheduledExecutorService executorService,
final ChatMessageManager chatMessageManager) final ChatMessageManager chatMessageManager)
{ {
this.client = client; this.client = client;
this.appName = runeLiteProperties.getTitle();
this.clientUI = clientUI; this.clientUI = clientUI;
this.runeLiteConfig = runeliteConfig; this.runeLiteConfig = runeliteConfig;
this.executorService = executorService; this.executorService = executorService;

View File

@@ -346,10 +346,7 @@ public class RuneLite
splashScreen.setProgress(5, 5); splashScreen.setProgress(5, 5);
// Initialize UI // Initialize UI
clientUI.open(this); clientUI.init(this);
// Close the splash screen
splashScreen.close();
if (!isOutdated) if (!isOutdated)
{ {
@@ -374,6 +371,11 @@ public class RuneLite
overlayManager.add(arrowMinimapOverlay.get()); overlayManager.add(arrowMinimapOverlay.get());
} }
// Close the splash screen
splashScreen.close();
clientUI.show();
// Start plugins // Start plugins
pluginManager.startCorePlugins(); pluginManager.startCorePlugins();
@@ -398,4 +400,4 @@ public class RuneLite
{ {
RuneLite.injector = injector; RuneLite.injector = injector;
} }
} }

View File

@@ -24,16 +24,12 @@
*/ */
package net.runelite.client; package net.runelite.client;
import com.google.inject.Singleton;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.Properties; import java.util.Properties;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.client.config.RuneLitePlusConfig;
@Singleton @Singleton
@Slf4j
public class RuneLiteProperties public class RuneLiteProperties
{ {
private static final String RUNELITE_TITLE = "runelite.plus.title"; private static final String RUNELITE_TITLE = "runelite.plus.title";
@@ -47,32 +43,25 @@ public class RuneLiteProperties
private static final String WIKI_LINK = "runelite.wiki.link"; private static final String WIKI_LINK = "runelite.wiki.link";
private static final String PATREON_LINK = "runelite.patreon.link"; private static final String PATREON_LINK = "runelite.patreon.link";
private static final String LAUNCHER_VERSION_PROPERTY = "runelite.launcher.version"; private static final String LAUNCHER_VERSION_PROPERTY = "runelite.launcher.version";
private static final String TROUBLESHOOTING_LINK = "runelite.wiki.troubleshooting.link";
private static final String BUILDING_LINK = "runelite.wiki.building.link";
private static final String DNS_CHANGE_LINK = "runelite.dnschange.link";
private final Properties properties = new Properties(); private static final Properties properties = new Properties();
private final RuneLitePlusConfig runeLitePlusConfig; static
@Inject
public RuneLiteProperties(final RuneLitePlusConfig runeLiteConfig)
{ {
this.runeLitePlusConfig = runeLiteConfig; try (InputStream in = RuneLiteProperties.class.getResourceAsStream("/runelite.plus.properties"))
try (InputStream in = getClass().getResourceAsStream("/runelite.plus.properties"))
{ {
properties.load(in); properties.load(in);
} }
catch (IOException ex) catch (IOException ex)
{ {
log.warn("unable to load propertries", ex); throw new RuntimeException(ex);
} }
} }
public RuneLiteProperties() public static String getTitle()
{
runeLitePlusConfig = null;
}
public String getTitle()
{ {
final StringBuilder sb = new StringBuilder(properties.getProperty(RUNELITE_TITLE)); final StringBuilder sb = new StringBuilder(properties.getProperty(RUNELITE_TITLE));
String proxy; String proxy;
@@ -83,48 +72,63 @@ public class RuneLiteProperties
return sb.toString(); return sb.toString();
} }
public String getVersion() public static String getVersion()
{ {
return properties.getProperty(RUNELITE_VERSION); return properties.getProperty(RUNELITE_VERSION);
} }
public String getPlusVersion() public static String getPlusVersion()
{ {
return properties.getProperty(RUNELITE_PLUS_VERSION); return properties.getProperty(RUNELITE_PLUS_VERSION);
} }
public String getPlusDate() public static String getPlusDate()
{ {
return properties.getProperty(RUNELITE_PLUS_DATE); return properties.getProperty(RUNELITE_PLUS_DATE);
} }
public String getRunescapeVersion() public static String getRunescapeVersion()
{ {
return properties.getProperty(RUNESCAPE_VERSION); return properties.getProperty(RUNESCAPE_VERSION);
} }
public String getDiscordAppId() public static String getDiscordAppId()
{ {
return properties.getProperty(DISCORD_APP_ID); return properties.getProperty(DISCORD_APP_ID);
} }
public String getDiscordInvite() public static String getDiscordInvite()
{ {
return properties.getProperty(DISCORD_INVITE); return properties.getProperty(DISCORD_INVITE);
} }
public String getGithubLink() public static String getGithubLink()
{ {
return properties.getProperty(GITHUB_LINK); return properties.getProperty(GITHUB_LINK);
} }
public String getWikiLink() public static String getWikiLink()
{ {
return properties.getProperty(WIKI_LINK); return properties.getProperty(WIKI_LINK);
} }
public String getPatreonLink() public static String getPatreonLink()
{ {
return properties.getProperty(PATREON_LINK); return properties.getProperty(PATREON_LINK);
} }
}
public static String getTroubleshootingLink()
{
return properties.getProperty(TROUBLESHOOTING_LINK);
}
public static String getBuildingLink()
{
return properties.getProperty(BUILDING_LINK);
}
public static String getDNSChangeLink()
{
return properties.getProperty(DNS_CHANGE_LINK);
}
}

View File

@@ -49,7 +49,6 @@ import net.runelite.discord.DiscordUser;
public class DiscordService implements AutoCloseable public class DiscordService implements AutoCloseable
{ {
private final EventBus eventBus; private final EventBus eventBus;
private final RuneLiteProperties runeLiteProperties;
private final ScheduledExecutorService executorService; private final ScheduledExecutorService executorService;
private final DiscordRPC discordRPC; private final DiscordRPC discordRPC;
@@ -62,12 +61,10 @@ public class DiscordService implements AutoCloseable
@Inject @Inject
private DiscordService( private DiscordService(
final EventBus eventBus, final EventBus eventBus,
final RuneLiteProperties runeLiteProperties,
final ScheduledExecutorService executorService) final ScheduledExecutorService executorService)
{ {
this.eventBus = eventBus; this.eventBus = eventBus;
this.runeLiteProperties = runeLiteProperties;
this.executorService = executorService; this.executorService = executorService;
DiscordRPC discordRPC = null; DiscordRPC discordRPC = null;
@@ -106,7 +103,7 @@ public class DiscordService implements AutoCloseable
discordEventHandlers.joinGame = this::joinGame; discordEventHandlers.joinGame = this::joinGame;
discordEventHandlers.spectateGame = this::spectateGame; discordEventHandlers.spectateGame = this::spectateGame;
discordEventHandlers.joinRequest = this::joinRequest; discordEventHandlers.joinRequest = this::joinRequest;
discordRPC.Discord_Initialize(runeLiteProperties.getDiscordAppId(), discordEventHandlers, true, null); discordRPC.Discord_Initialize(RuneLiteProperties.getDiscordAppId(), discordEventHandlers, true, null);
executorService.scheduleAtFixedRate(discordRPC::Discord_RunCallbacks, 0, 2, TimeUnit.SECONDS); executorService.scheduleAtFixedRate(discordRPC::Discord_RunCallbacks, 0, 2, TimeUnit.SECONDS);
} }

View File

@@ -34,6 +34,7 @@ import java.util.Arrays;
import java.util.Objects; import java.util.Objects;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Singleton; import javax.inject.Singleton;
import net.runelite.api.ClanMember; import net.runelite.api.ClanMember;
@@ -94,7 +95,7 @@ public class ClanManager
} }
}); });
private int modIconsLength; private int offset;
@Inject @Inject
private ClanManager( private ClanManager(
@@ -115,6 +116,7 @@ public class ClanManager
return clanRanksCache.getUnchecked(playerName); return clanRanksCache.getUnchecked(playerName);
} }
@Nullable
public BufferedImage getClanImage(final ClanMemberRank clanMemberRank) public BufferedImage getClanImage(final ClanMemberRank clanMemberRank)
{ {
if (clanMemberRank == ClanMemberRank.UNRANKED) if (clanMemberRank == ClanMemberRank.UNRANKED)
@@ -127,13 +129,12 @@ public class ClanManager
public int getIconNumber(final ClanMemberRank clanMemberRank) public int getIconNumber(final ClanMemberRank clanMemberRank)
{ {
return modIconsLength - CLANCHAT_IMAGES.length + clanMemberRank.ordinal() - 1; return offset + clanMemberRank.ordinal() - 1;
} }
private void onGameStateChanged(GameStateChanged gameStateChanged) private void onGameStateChanged(GameStateChanged gameStateChanged)
{ {
if (gameStateChanged.getGameState() == GameState.LOGGED_IN if (gameStateChanged.getGameState() == GameState.LOGIN_SCREEN && offset == 0)
&& modIconsLength == 0)
{ {
loadClanChatIcons(); loadClanChatIcons();
} }
@@ -146,19 +147,31 @@ public class ClanManager
private void loadClanChatIcons() private void loadClanChatIcons()
{ {
final IndexedSprite[] modIcons = client.getModIcons();
final IndexedSprite[] newModIcons = Arrays.copyOf(modIcons, modIcons.length + CLANCHAT_IMAGES.length);
int curPosition = newModIcons.length - CLANCHAT_IMAGES.length;
for (int i = 0; i < CLANCHAT_IMAGES.length; i++, curPosition++)
{ {
final int resource = CLANCHAT_IMAGES[i]; IndexedSprite[] modIcons = client.getModIcons();
clanChatImages[i] = clanChatImageFromSprite(spriteManager.getSprite(resource, 0)); offset = modIcons.length;
newModIcons[curPosition] = ImageUtil.getImageIndexedSprite(clanChatImages[i], client);
IndexedSprite blank = ImageUtil.getImageIndexedSprite(
new BufferedImage(modIcons[0].getWidth(), modIcons[0].getHeight(), BufferedImage.TYPE_INT_ARGB),
client);
modIcons = Arrays.copyOf(modIcons, offset + CLANCHAT_IMAGES.length);
Arrays.fill(modIcons, offset, modIcons.length, blank);
client.setModIcons(modIcons);
} }
client.setModIcons(newModIcons); for (int i = 0; i < CLANCHAT_IMAGES.length; i++)
modIconsLength = newModIcons.length; {
final int fi = i;
spriteManager.getSpriteAsync(CLANCHAT_IMAGES[i], 0, sprite ->
{
IndexedSprite[] modIcons = client.getModIcons();
clanChatImages[fi] = clanChatImageFromSprite(sprite);
modIcons[offset + fi] = ImageUtil.getImageIndexedSprite(clanChatImages[fi], client);
});
}
} }
private static String sanitize(String lookup) private static String sanitize(String lookup)

View File

@@ -92,7 +92,7 @@ public class ChatboxPanelManager
private void unsafeCloseInput() private void unsafeCloseInput()
{ {
client.runScript( client.runScript(
ScriptID.RESET_CHATBOX_INPUT, ScriptID.MESSAGE_LAYER_CLOSE,
0, 0,
1 1
); );
@@ -104,7 +104,7 @@ public class ChatboxPanelManager
private void unsafeOpenInput(ChatboxInput input) private void unsafeOpenInput(ChatboxInput input)
{ {
client.runScript(ScriptID.CLEAR_CHATBOX_PANEL); client.runScript(ScriptID.MESSAGE_LAYER_OPEN, 0);
// eventBus.register(input); // eventBus.register(input);
if (input instanceof KeyListener) if (input instanceof KeyListener)

View File

@@ -37,20 +37,6 @@ import net.runelite.client.callback.ClientThread;
public class BankSearch public class BankSearch
{ {
// Widget indexes for searching
private static final int INNER_CONTAINER_IDX = 2;
private static final int SETTINGS_IDX = 4;
private static final int ITEM_CONTAINER_IDX = 7;
private static final int SCROLLBAR_IDX = 8;
private static final int BOTTOM_BAR_IDX = 9;
private static final int SEARCH_BUTTON_BACKGROUND_IDX = 15;
private static final int TITLE_BAR_IDX = 16;
private static final int ITEM_COUNT_IDX = 17;
private static final int TAB_BAR_IDX = 18;
private static final int INCINERATOR_IDX = 19;
private static final int INCINERATOR_CONFIRM_IDX = 20;
private static final int HIDDEN_WIDGET_IDX = 21;
private final Client client; private final Client client;
private final ClientThread clientThread; private final ClientThread clientThread;
@@ -64,51 +50,38 @@ public class BankSearch
this.clientThread = clientThread; this.clientThread = clientThread;
} }
public void search(InputType inputType, String search, Boolean closeInput) public void search(InputType inputType, String search, boolean closeInput)
{ {
clientThread.invoke(() -> clientThread.invoke(() ->
{ {
Widget bankContainer = client.getWidget(WidgetInfo.BANK_CONTAINER); Widget bankContainer = client.getWidget(WidgetInfo.BANK_ITEM_CONTAINER);
if (bankContainer == null || bankContainer.isHidden()) if (bankContainer == null || bankContainer.isHidden())
{ {
return; return;
} }
Object[] widgetIds = bankContainer.getOnLoadListener(); Object[] scriptArgs = bankContainer.getOnInvTransmitListener();
// In case the widget ids array is incorrect, do not proceed if (scriptArgs == null)
if (widgetIds == null || widgetIds.length < 21)
{ {
return; return;
} }
// This ensures that any chatbox input (e.g from search) will not remain visible when // This ensures that any chatbox input (e.g from search) will not remain visible when
// selecting/changing tab // selecting/changing tab
if (closeInput) if (closeInput)
{ {
client.runScript(ScriptID.RESET_CHATBOX_INPUT, 0, 0); client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0);
} }
client.setVar(VarClientInt.INPUT_TYPE, inputType.getType()); client.setVar(VarClientInt.INPUT_TYPE, inputType.getType());
client.setVar(VarClientStr.INPUT_TEXT, search); client.setVar(VarClientStr.INPUT_TEXT, search);
client.runScript(ScriptID.BANK_LAYOUT, client.runScript(scriptArgs);
WidgetInfo.BANK_CONTAINER.getId(),
widgetIds[INNER_CONTAINER_IDX],
widgetIds[SETTINGS_IDX],
widgetIds[ITEM_CONTAINER_IDX],
widgetIds[SCROLLBAR_IDX],
widgetIds[BOTTOM_BAR_IDX],
widgetIds[TITLE_BAR_IDX],
widgetIds[ITEM_COUNT_IDX],
widgetIds[SEARCH_BUTTON_BACKGROUND_IDX],
widgetIds[TAB_BAR_IDX],
widgetIds[INCINERATOR_IDX],
widgetIds[INCINERATOR_CONFIRM_IDX],
widgetIds[HIDDEN_WIDGET_IDX]);
}); });
} }
public void reset(Boolean closeChat) public void reset(boolean closeChat)
{ {
search(InputType.NONE, "", closeChat); search(InputType.NONE, "", closeChat);
} }

View File

@@ -339,7 +339,7 @@ public class TabInterface
{ {
bankSearch.reset(true); bankSearch.reset(true);
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT, 0, 0)); clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0));
} }
else else
{ {

View File

@@ -62,7 +62,7 @@ public class ChatboxPerformancePlugin extends Plugin
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent); eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
if (client.getGameState() == GameState.LOGGED_IN) if (client.getGameState() == GameState.LOGGED_IN)
{ {
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT)); clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0));
} }
} }
@@ -71,7 +71,7 @@ public class ChatboxPerformancePlugin extends Plugin
{ {
if (client.getGameState() == GameState.LOGGED_IN) if (client.getGameState() == GameState.LOGGED_IN)
{ {
clientThread.invokeLater(() -> client.runScript(ScriptID.RESET_CHATBOX_INPUT)); clientThread.invokeLater(() -> client.runScript(ScriptID.MESSAGE_LAYER_CLOSE, 0, 0));
} }
eventBus.unregister(this); eventBus.unregister(this);
} }

View File

@@ -73,9 +73,6 @@ public class ChatNotificationsPlugin extends Plugin
@Inject @Inject
private Notifier notifier; private Notifier notifier;
@Inject
private RuneLiteProperties runeLiteProperties;
@Inject @Inject
private EventBus eventBus; private EventBus eventBus;
@@ -183,7 +180,7 @@ public class ChatNotificationsPlugin extends Plugin
break; break;
case CONSOLE: case CONSOLE:
// Don't notify for notification messages // Don't notify for notification messages
if (chatMessage.getName().equals(runeLiteProperties.getTitle())) if (chatMessage.getName().equals(RuneLiteProperties.getTitle()))
{ {
return; return;
} }

View File

@@ -95,9 +95,6 @@ public class DiscordPlugin extends Plugin
@Inject @Inject
private ClientToolbar clientToolbar; private ClientToolbar clientToolbar;
@Inject
private RuneLiteProperties properties;
@Inject @Inject
private DiscordState discordState; private DiscordState discordState;
@@ -148,7 +145,7 @@ public class DiscordPlugin extends Plugin
.tab(false) .tab(false)
.tooltip("Join Discord") .tooltip("Join Discord")
.icon(icon) .icon(icon)
.onClick(() -> LinkBrowser.browse(properties.getDiscordInvite())) .onClick(() -> LinkBrowser.browse(RuneLiteProperties.getDiscordInvite()))
.build(); .build();
clientToolbar.addNavigation(discordButton); clientToolbar.addNavigation(discordButton);

View File

@@ -58,16 +58,14 @@ class DiscordState
private final DiscordService discordService; private final DiscordService discordService;
private final DiscordPlugin plugin; private final DiscordPlugin plugin;
private final PartyService party; private final PartyService party;
private final RuneLiteProperties properties;
private DiscordPresence lastPresence; private DiscordPresence lastPresence;
@Inject @Inject
private DiscordState(final DiscordService discordService, final DiscordPlugin plugin, final PartyService party, final RuneLiteProperties properties) private DiscordState(final DiscordService discordService, final DiscordPlugin plugin, final PartyService party)
{ {
this.discordService = discordService; this.discordService = discordService;
this.plugin = plugin; this.plugin = plugin;
this.party = party; this.party = party;
this.properties = properties;
} }
/** /**
@@ -173,12 +171,12 @@ class DiscordState
} }
// Replace snapshot with + to make tooltip shorter (so it will span only 1 line) // Replace snapshot with + to make tooltip shorter (so it will span only 1 line)
final String versionShortHand = properties.getVersion().replace("-SNAPSHOT", "+"); final String versionShortHand = RuneLiteProperties.getVersion().replace("-SNAPSHOT", "+");
final DiscordPresence.DiscordPresenceBuilder presenceBuilder = DiscordPresence.builder() final DiscordPresence.DiscordPresenceBuilder presenceBuilder = DiscordPresence.builder()
.state(MoreObjects.firstNonNull(state, "")) .state(MoreObjects.firstNonNull(state, ""))
.details(MoreObjects.firstNonNull(details, "")) .details(MoreObjects.firstNonNull(details, ""))
.largeImageText(properties.getTitle() + " v" + versionShortHand) .largeImageText(RuneLiteProperties.getTitle() + " v" + versionShortHand)
.startTimestamp(event.getStart()) .startTimestamp(event.getStart())
.smallImageKey(imageKey) .smallImageKey(imageKey)
.partyMax(PARTY_MAX) .partyMax(PARTY_MAX)

View File

@@ -51,7 +51,6 @@ import static net.runelite.client.RuneLite.LOGS_DIR;
import net.runelite.client.RuneLiteProperties; import net.runelite.client.RuneLiteProperties;
import net.runelite.client.account.SessionManager; import net.runelite.client.account.SessionManager;
import net.runelite.client.config.ConfigManager; import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.events.SessionClose; import net.runelite.client.events.SessionClose;
import net.runelite.client.events.SessionOpen; import net.runelite.client.events.SessionOpen;
import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.ColorScheme;
@@ -81,12 +80,6 @@ public class InfoPanel extends PluginPanel
@Nullable @Nullable
private Client client; private Client client;
@Inject
private RuneLiteProperties runeLiteProperties;
@Inject
private EventBus eventBus;
@Inject @Inject
private SessionManager sessionManager; private SessionManager sessionManager;
@@ -119,10 +112,10 @@ public class InfoPanel extends PluginPanel
final Font smallFont = FontManager.getRunescapeSmallFont(); final Font smallFont = FontManager.getRunescapeSmallFont();
JLabel version = new JLabel(htmlLabel("RuneLite version: ", runeLiteProperties.getVersion())); JLabel version = new JLabel(htmlLabel("RuneLite version: ", RuneLiteProperties.getVersion()));
version.setFont(smallFont); version.setFont(smallFont);
JLabel plusVersion = new JLabel(htmlLabel("RuneLitePlus version: ", runeLiteProperties.getPlusVersion())); JLabel plusVersion = new JLabel(htmlLabel("RuneLitePlus version: ", RuneLiteProperties.getPlusVersion()));
version.setFont(smallFont); version.setFont(smallFont);
JLabel revision = new JLabel(); JLabel revision = new JLabel();
@@ -177,14 +170,13 @@ public class InfoPanel extends PluginPanel
actionsContainer.add(buildLinkPanel(GITHUB_ICON, "License info", "for distribution", "https://github.com/runelite-extended/runelite/blob/master/LICENSE")); actionsContainer.add(buildLinkPanel(GITHUB_ICON, "License info", "for distribution", "https://github.com/runelite-extended/runelite/blob/master/LICENSE"));
actionsContainer.add(buildLinkPanel(FOLDER_ICON, "Open logs directory", "(for bug reports)", LOGS_DIR)); actionsContainer.add(buildLinkPanel(FOLDER_ICON, "Open logs directory", "(for bug reports)", LOGS_DIR));
actionsContainer.add(buildLinkPanel(DISCORD_ICON, "Talk to us on our", "discord server", "https://discord.gg/HN5gf3m")); actionsContainer.add(buildLinkPanel(DISCORD_ICON, "Talk to us on our", "discord server", "https://discord.gg/HN5gf3m"));
actionsContainer.add(buildLinkPanel(PATREON_ICON, "Patreon to support", "the RuneLitePlus devs", runeLiteProperties.getPatreonLink())); actionsContainer.add(buildLinkPanel(PATREON_ICON, "Patreon to support", "the RuneLitePlus devs", RuneLiteProperties.getPatreonLink()));
/* actionsContainer.add(buildLinkPanel(WIKI_ICON, "Information about", "RuneLite and plugins", runeLiteProperties.getWikiLink()));*/ /* actionsContainer.add(buildLinkPanel(WIKI_ICON, "Information about", "RuneLite and plugins", runeLiteProperties.getWikiLink()));*/
add(versionPanel, BorderLayout.NORTH); add(versionPanel, BorderLayout.NORTH);
add(actionsContainer, BorderLayout.CENTER); add(actionsContainer, BorderLayout.CENTER);
updateLoggedIn(); updateLoggedIn();
// eventBus.register(this);
} }
/** /**

View File

@@ -44,6 +44,7 @@ import java.time.Instant;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
@@ -1151,18 +1152,17 @@ public class LootTrackerPlugin extends Plugin
private Collection<LootTrackerRecord> convertToLootTrackerRecord(final Collection<LootRecord> records) private Collection<LootTrackerRecord> convertToLootTrackerRecord(final Collection<LootRecord> records)
{ {
Collection<LootTrackerRecord> trackerRecords = new ArrayList<>(); return records.stream()
for (LootRecord record : records) .sorted(Comparator.comparing(LootRecord::getTime))
{ .map(record ->
LootTrackerItem[] drops = record.getDrops().stream().map(itemStack -> {
buildLootTrackerItem(itemStack.getId(), itemStack.getQty()) LootTrackerItem[] drops = record.getDrops().stream().map(itemStack ->
).toArray(LootTrackerItem[]::new); buildLootTrackerItem(itemStack.getId(), itemStack.getQty())
).toArray(LootTrackerItem[]::new);
trackerRecords.add(new LootTrackerRecord(record.getEventId(), record.getUsername(), return new LootTrackerRecord(record.getEventId(), record.getUsername(),
"", drops, record.getTime())); "", drops, record.getTime());
} })
.collect(Collectors.toCollection(ArrayList::new));
return trackerRecords;
} }
private Collection<LTItemEntry> convertToLTItemEntries(Collection<ItemStack> stacks) private Collection<LTItemEntry> convertToLTItemEntries(Collection<ItemStack> stacks)

View File

@@ -43,7 +43,6 @@ import net.runelite.client.input.KeyListener;
import net.runelite.client.input.KeyManager; import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.ui.ClientUI;
@PluginDescriptor( @PluginDescriptor(
loadWhenOutdated = true, // prevent users from disabling loadWhenOutdated = true, // prevent users from disabling
@@ -77,8 +76,6 @@ public class RuneLitePlusPlugin extends Plugin
protected void startUp() throws Exception protected void startUp() throws Exception
{ {
addSubscriptions(); addSubscriptions();
ClientUI.currentPresenceName = ("RuneLitePlus");
ClientUI.frame.setTitle(ClientUI.currentPresenceName);
entered = -1; entered = -1;
enterIdx = 0; enterIdx = 0;
@@ -103,7 +100,7 @@ public class RuneLitePlusPlugin extends Plugin
return; return;
} }
else if (!config.keyboardPin()) if (!config.keyboardPin())
{ {
entered = 0; entered = 0;
enterIdx = 0; enterIdx = 0;

View File

@@ -24,7 +24,7 @@
*/ */
package net.runelite.client.rs; package net.runelite.client.rs;
class VerificationException extends Exception public class VerificationException extends Exception
{ {
public VerificationException(String message) public VerificationException(String message)
{ {

View File

@@ -60,7 +60,6 @@ import javax.swing.JButton;
import javax.swing.JComponent; import javax.swing.JComponent;
import javax.swing.JFrame; import javax.swing.JFrame;
import javax.swing.JOptionPane; import javax.swing.JOptionPane;
import static javax.swing.JOptionPane.ERROR_MESSAGE;
import static javax.swing.JOptionPane.INFORMATION_MESSAGE; import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
import javax.swing.JPanel; import javax.swing.JPanel;
import javax.swing.JRootPane; import javax.swing.JRootPane;
@@ -116,13 +115,11 @@ public class ClientUI
private static final int CLIENT_WELL_HIDDEN_MARGIN = 160; private static final int CLIENT_WELL_HIDDEN_MARGIN = 160;
private static final int CLIENT_WELL_HIDDEN_MARGIN_TOP = 10; private static final int CLIENT_WELL_HIDDEN_MARGIN_TOP = 10;
public static boolean allowInput = false; public static boolean allowInput = false;
public static String currentPresenceName = "RuneLitePlus";
public static final BufferedImage ICON = ImageUtil.getResourceStreamFromClass(ClientUI.class, "/runeliteplus.png"); public static final BufferedImage ICON = ImageUtil.getResourceStreamFromClass(ClientUI.class, "/runeliteplus.png");
@Getter @Getter
private TrayIcon trayIcon; private TrayIcon trayIcon;
private final RuneLiteProperties properties;
private final RuneLiteConfig config; private final RuneLiteConfig config;
private final KeyManager keyManager; private final KeyManager keyManager;
private final MouseManager mouseManager; private final MouseManager mouseManager;
@@ -152,7 +149,6 @@ public class ClientUI
@Inject @Inject
private ClientUI( private ClientUI(
RuneLiteProperties properties,
RuneLiteConfig config, RuneLiteConfig config,
KeyManager keyManager, KeyManager keyManager,
MouseManager mouseManager, MouseManager mouseManager,
@@ -161,7 +157,6 @@ public class ClientUI
Provider<ClientThread> clientThreadProvider, Provider<ClientThread> clientThreadProvider,
EventBus eventbus) EventBus eventbus)
{ {
this.properties = properties;
this.config = config; this.config = config;
this.keyManager = keyManager; this.keyManager = keyManager;
this.mouseManager = mouseManager; this.mouseManager = mouseManager;
@@ -305,18 +300,17 @@ public class ClientUI
return false; return false;
} }
frame.setTitle(currentPresenceName + " - " + name); frame.setTitle(RuneLiteProperties.getTitle() + " - " + name);
return true; return true;
}); });
} }
/** /**
* Initialize UI. * Initialize UI.
*
* @param runelite runelite instance that will be shut down on exit * @param runelite runelite instance that will be shut down on exit
* @throws Exception exception that can occur during creation of the UI * @throws Exception exception that can occur during creation of the UI
*/ */
public void open(final RuneLite runelite) throws Exception public void init(final RuneLite runelite) throws Exception
{ {
SwingUtilities.invokeAndWait(() -> SwingUtilities.invokeAndWait(() ->
{ {
@@ -328,7 +322,7 @@ public class ClientUI
// Try to enable fullscreen on OSX // Try to enable fullscreen on OSX
OSXUtil.tryEnableFullscreen(frame); OSXUtil.tryEnableFullscreen(frame);
frame.setTitle(ClientUI.currentPresenceName); frame.setTitle(RuneLiteProperties.getTitle());
frame.setIconImage(ICON); frame.setIconImage(ICON);
frame.getLayeredPane().setCursor(Cursor.getDefaultCursor()); // Prevent substance from using a resize cursor for pointing frame.getLayeredPane().setCursor(Cursor.getDefaultCursor()); // Prevent substance from using a resize cursor for pointing
frame.setLocationRelativeTo(frame.getOwner()); frame.setLocationRelativeTo(frame.getOwner());
@@ -465,13 +459,19 @@ public class ClientUI
titleToolbar.addComponent(sidebarNavigationButton, sidebarNavigationJButton); titleToolbar.addComponent(sidebarNavigationButton, sidebarNavigationJButton);
toggleSidebar(); toggleSidebar();
});
}
public void show()
{
SwingUtilities.invokeLater(() ->
{
// Layout frame // Layout frame
frame.pack(); frame.pack();
frame.revalidateMinimumSize(); frame.revalidateMinimumSize();
// Create tray icon (needs to be created after frame is packed) // Create tray icon (needs to be created after frame is packed)
trayIcon = SwingUtil.createTrayIcon(ICON, properties.getTitle(), frame); trayIcon = SwingUtil.createTrayIcon(ICON, RuneLiteProperties.getTitle(), frame);
// Move frame around (needs to be done after frame is packed) // Move frame around (needs to be done after frame is packed)
if (config.rememberScreenBounds()) if (config.rememberScreenBounds())
@@ -528,14 +528,7 @@ public class ClientUI
}); });
// Show out of date dialog if needed // Show out of date dialog if needed
if (client == null) if (client != null && !(client instanceof Client))
{
SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(frame,
"Error loading client! Check your logs for more details.",
"Unable to load client",
ERROR_MESSAGE));
}
else if (!(client instanceof Client))
{ {
SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(frame, SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(frame,
"RuneLite has not yet been updated to work with the latest\n" "RuneLite has not yet been updated to work with the latest\n"
@@ -615,7 +608,7 @@ public class ClientUI
} }
/** /**
* Changes cursor for client window. Requires ${@link ClientUI#open(RuneLite)} to be called first. * Changes cursor for client window. Requires ${@link ClientUI#init(RuneLite)} to be called first.
* FIXME: This is working properly only on Windows, Linux and Mac are displaying cursor incorrectly * FIXME: This is working properly only on Windows, Linux and Mac are displaying cursor incorrectly
* *
* @param image cursor image * @param image cursor image
@@ -854,12 +847,12 @@ public class ClientUI
if (player != null && player.getName() != null) if (player != null && player.getName() != null)
{ {
frame.setTitle(currentPresenceName + " - " + player.getName()); frame.setTitle(RuneLiteProperties.getTitle() + " - " + player.getName());
} }
} }
else else
{ {
frame.setTitle(currentPresenceName); frame.setTitle(RuneLiteProperties.getTitle());
} }
if (frame.isAlwaysOnTopSupported()) if (frame.isAlwaysOnTopSupported())

View File

@@ -7,4 +7,7 @@ runelite.wiki.link=https://github.com/runelite-extended/runelite/wiki
runelite.patreon.link=https://www.patreon.com/RuneLitePlus runelite.patreon.link=https://www.patreon.com/RuneLitePlus
runelite.plus.title=RuneLitePlus runelite.plus.title=RuneLitePlus
runelite.plus.version=@runelite.plus.version@ runelite.plus.version=@runelite.plus.version@
runelite.plus.builddate=@runelite.plus.builddate@ runelite.plus.builddate=@runelite.plus.builddate@
runelite.wiki.troubleshooting.link=https://github.com/runelite/runelite/wiki/Troubleshooting-problems-with-the-client
runelite.wiki.building.link=https://github.com/runelite-extended/runelite/wiki/Building-with-IntelliJ-IDEA
runelite.dnschange.link=https://1.1.1.1/dns/

View File

@@ -142,12 +142,12 @@ public abstract class ScriptVMMixin implements RSClient
@Inject @Inject
@Override @Override
public void runScript(int id, Object... args) public void runScript(Object... args)
{ {
assert isClientThread(); assert isClientThread();
assert currentScript == null; assert currentScript == null;
Object[] cargs = new Object[args.length + 1]; Object[] cargs = new Object[args.length + 1];
cargs[0] = id; // cargs[0] = id;
System.arraycopy(args, 0, cargs, 1, args.length); System.arraycopy(args, 0, cargs, 1, args.length);
RSScriptEvent se = createScriptEvent(); RSScriptEvent se = createScriptEvent();
se.setArguments(cargs); se.setArguments(cargs);