Merge branch 'master' into party-time

This commit is contained in:
Kyle
2020-01-11 23:18:00 +00:00
committed by GitHub
299 changed files with 5164 additions and 2652 deletions

View File

@@ -35,26 +35,26 @@ import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.events.ChatMessage;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ChatInput;
import net.runelite.client.events.ChatboxInput;
import net.runelite.client.events.PrivateMessageInput;
@Singleton
public class ChatCommandManager implements ChatboxInputListener
public class ChatCommandManager
{
private final Map<String, ChatCommand> commands = new ConcurrentHashMap<>();
private final Client client;
private final ScheduledExecutorService scheduledExecutorService;
@Inject
private ChatCommandManager(EventBus eventBus, CommandManager commandManager, Client client, ScheduledExecutorService scheduledExecutorService)
private ChatCommandManager(EventBus eventBus, Client client, ScheduledExecutorService scheduledExecutorService)
{
this.client = client;
this.scheduledExecutorService = scheduledExecutorService;
// eventBus.register(this);
commandManager.register(this);
eventBus.subscribe(ChatboxInput.class, this, this::onChatboxInput);
eventBus.subscribe(PrivateMessageInput.class, this, this::onPrivateMessageInput);
eventBus.subscribe(ChatMessage.class, this, this::onChatMessage);
}
@@ -106,11 +106,6 @@ public class ChatCommandManager implements ChatboxInputListener
String message = chatMessage.getMessage();
String command = extractCommand(message);
if (command == null)
{
return;
}
ChatCommand chatCommand = commands.get(command.toLowerCase());
if (chatCommand == null)
{
@@ -127,8 +122,8 @@ public class ChatCommandManager implements ChatboxInputListener
}
}
@Override
public boolean onChatboxInput(ChatboxInput chatboxInput)
@Subscribe // just for show
private void onChatboxInput(ChatboxInput chatboxInput)
{
String message = chatboxInput.getValue();
if (message.startsWith("/"))
@@ -136,51 +131,30 @@ public class ChatCommandManager implements ChatboxInputListener
message = message.substring(1); // clan chat input
}
String command = extractCommand(message);
if (command == null)
{
return false;
}
ChatCommand chatCommand = commands.get(command.toLowerCase());
if (chatCommand == null)
{
return false;
}
BiPredicate<ChatInput, String> input = chatCommand.getInput();
if (input == null)
{
return false;
}
return input.test(chatboxInput, message);
onInput(chatboxInput, message);
}
@Override
public boolean onPrivateMessageInput(PrivateMessageInput privateMessageInput)
@Subscribe // just for show
private void onPrivateMessageInput(PrivateMessageInput input)
{
final String message = privateMessageInput.getMessage();
onInput(input, input.getMessage());
}
private void onInput(ChatInput chatInput, String message)
{
String command = extractCommand(message);
if (command == null)
{
return false;
}
ChatCommand chatCommand = commands.get(command.toLowerCase());
if (chatCommand == null)
{
return false;
return;
}
BiPredicate<ChatInput, String> input = chatCommand.getInput();
if (input == null)
if (input != null && input.test(chatInput, message))
{
return false;
chatInput.setStop();
}
return input.test(privateMessageInput, message);
}
private static String extractCommand(String message)

View File

@@ -153,7 +153,7 @@ public class ChatMessageManager
messageNode.setName(ColorUtil.wrapWithColorTag(messageNode.getName(), usernameColor));
}
String sender = chatMessage.getSender();
String sender = messageNode.getSender();
if (senderColor != null && !Strings.isNullOrEmpty(sender))
{
messageNode.setSender(ColorUtil.wrapWithColorTag(sender, senderColor));

View File

@@ -26,8 +26,6 @@
package net.runelite.client.chat;
import java.util.Arrays;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
@@ -54,8 +52,6 @@ public class CommandManager
private final ClientThread clientThread;
private boolean sending;
private final List<ChatboxInputListener> chatboxInputListenerList = new CopyOnWriteArrayList<>();
@Inject
private CommandManager(
final Client client,
@@ -70,16 +66,6 @@ public class CommandManager
eventBus.subscribe(ScriptCallbackEvent.class, this, this::onScriptCallbackEvent);
}
public void register(ChatboxInputListener chatboxInputListener)
{
chatboxInputListenerList.add(chatboxInputListener);
}
public void unregister(ChatboxInputListener chatboxInputListener)
{
chatboxInputListenerList.remove(chatboxInputListener);
}
private void onScriptCallbackEvent(ScriptCallbackEvent event)
{
if (sending)
@@ -148,13 +134,10 @@ public class CommandManager
clientThread.invoke(() -> sendChatboxInput(chatType, typedText));
}
};
boolean stop = false;
for (ChatboxInputListener chatboxInputListener : chatboxInputListenerList)
{
stop |= chatboxInputListener.onChatboxInput(chatboxInput);
}
if (stop)
eventBus.post(ChatboxInput.class, chatboxInput);
if (chatboxInput.isStop())
{
// input was blocked.
stringStack[stringStackCount - 1] = ""; // prevent script from sending
@@ -188,13 +171,9 @@ public class CommandManager
}
};
boolean stop = false;
for (ChatboxInputListener chatboxInputListener : chatboxInputListenerList)
{
stop |= chatboxInputListener.onPrivateMessageInput(privateMessageInput);
}
eventBus.post(PrivateMessageInput.class, privateMessageInput);
if (stop)
if (privateMessageInput.isStop())
{
intStack[intStackCount - 1] = 1;
client.setStringStackSize(stringStackCount - 2); // remove both target and message

View File

@@ -64,7 +64,7 @@ public interface OpenOSRSConfig extends Config
@ConfigItem(
position = 3,
keyName = "shareLogs",
name = "Anonymous error data",
name = "Share anonymous error data",
description = "Share anonymous error data with the OpenOSRS developers",
titleSection = "logTitle"
)
@@ -108,101 +108,26 @@ public interface OpenOSRSConfig extends Config
return SortStyle.CATEGORY;
}
@ConfigTitleSection(
keyName = "hidePluginsTitle",
name = "Hide By Type",
description = "",
@ConfigItem(
position = 4,
titleSection = "pluginsTitle"
keyName = "enableCategories",
name = "Categorize plugins",
description = "Show sections in the plugin list for each plugin type",
titleSection = "pluginSortingTitle",
hidden = true,
unhide = "pluginSortMode",
unhideValue = "Category"
)
default Title hidePluginsTitle()
default boolean enableCategories()
{
return new Title();
}
@ConfigItem(
position = 5,
keyName = "hidePlugins",
name = "Hide All Plugins",
description = "Hides all OpenOSRS plugins if checked",
titleSection = "hidePluginsTitle",
hide = "hidePvmPlugins || hidePvpPlugins || hideSkillingPlugins || hideUtilityPlugins || hideExternalPlugins"
)
default boolean hidePlugins()
{
return false;
}
@ConfigItem(
position = 6,
keyName = "hideExternalPlugins",
name = "Hide External Plugins",
description = "Hides all OpenOSRS external plugins if checked",
titleSection = "hidePluginsTitle",
hide = "hidePlugins"
)
default boolean hideExternalPlugins()
{
return false;
}
@ConfigItem(
position = 7,
keyName = "hidePvmPlugins",
name = "Hide PvM Plugins",
description = "Hides all OpenOSRS PvM plugins if checked",
titleSection = "hidePluginsTitle",
hide = "hidePlugins"
)
default boolean hidePvmPlugins()
{
return false;
}
@ConfigItem(
position = 8,
keyName = "hideSkillingPlugins",
name = "Hide Skilling Plugins",
description = "Hides all OpenOSRS skilling plugins if checked",
titleSection = "hidePluginsTitle",
hide = "hidePlugins"
)
default boolean hideSkillingPlugins()
{
return false;
}
@ConfigItem(
position = 9,
keyName = "hidePvpPlugins",
name = "Hide PvP Plugins",
description = "Hides all OpenOSRS Pvp plugins if checked",
titleSection = "hidePluginsTitle",
hide = "hidePlugins"
)
default boolean hidePvpPlugins()
{
return false;
}
@ConfigItem(
position = 10,
keyName = "hideUtilityPlugins",
name = "Hide Utility Plugins",
description = "Hides all OpenOSRS utility plugins if checked",
titleSection = "hidePluginsTitle",
hide = "hidePlugins"
)
default boolean hideUtilityPlugins()
{
return false;
return true;
}
@ConfigTitleSection(
keyName = "pluginsColorTitle",
name = "Colors",
description = "",
position = 11,
position = 5,
titleSection = "pluginsTitle"
)
default Title pluginsColorTitle()
@@ -210,26 +135,27 @@ public interface OpenOSRSConfig extends Config
return new Title();
}
@Alpha
@ConfigItem(
position = 12,
keyName = "externalColor",
name = "External color",
description = "Configure the color of external plugins",
position = 6,
keyName = "enabledColors",
name = "Enable plugin colors",
description = "Configure whether or not the plugins list should be colorcoded",
titleSection = "pluginsColorTitle"
)
default Color externalColor()
default boolean enabledColors()
{
return new Color(177, 156, 217, 255);
return true;
}
@Alpha
@ConfigItem(
position = 13,
position = 7,
keyName = "pvmColor",
name = "PVM color",
description = "Configure the color of PVM related plugins",
titleSection = "pluginsColorTitle"
name = "PvM color",
description = "Configure the color of PvM related plugins",
titleSection = "pluginsColorTitle",
hidden = true,
unhide = "enabledColors"
)
default Color pvmColor()
{
@@ -238,24 +164,13 @@ public interface OpenOSRSConfig extends Config
@Alpha
@ConfigItem(
position = 14,
keyName = "pvpColor",
name = "PVP color",
description = "Configure the color of PVP related plugins",
titleSection = "pluginsColorTitle"
)
default Color pvpColor()
{
return new Color(255, 105, 97, 255);
}
@Alpha
@ConfigItem(
position = 15,
position = 8,
keyName = "skillingColor",
name = "Skilling color",
description = "Configure the color of Skilling related plugins",
titleSection = "pluginsColorTitle"
description = "Configure the color of skilling related plugins",
titleSection = "pluginsColorTitle",
hidden = true,
unhide = "enabledColors"
)
default Color skillingColor()
{
@@ -264,22 +179,99 @@ public interface OpenOSRSConfig extends Config
@Alpha
@ConfigItem(
position = 16,
position = 9,
keyName = "pvpColor",
name = "PvP color",
description = "Configure the color of PvP related plugins",
titleSection = "pluginsColorTitle",
hidden = true,
unhide = "enabledColors"
)
default Color pvpColor()
{
return new Color(255, 105, 97, 255);
}
@Alpha
@ConfigItem(
position = 10,
keyName = "utilityColor",
name = "Utility color",
description = "Configure the color of Utility related plugins",
titleSection = "pluginsColorTitle"
description = "Configure the color of utility related plugins",
titleSection = "pluginsColorTitle",
hidden = true,
unhide = "enabledColors"
)
default Color utilityColor()
{
return new Color(144, 212, 237, 255);
}
@Alpha
@ConfigItem(
position = 11,
keyName = "minigameColor",
name = "Minigame color",
description = "Configure the color of minigame related plugins",
titleSection = "pluginsColorTitle",
hidden = true,
unhide = "enabledColors"
)
default Color minigameColor()
{
return new Color(235, 130, 66, 255);
}
@Alpha
@ConfigItem(
position = 12,
keyName = "miscellaneousColor",
name = "Miscellaneous color",
description = "Configure the color of miscellaneous related plugins",
titleSection = "pluginsColorTitle",
hidden = true,
unhide = "enabledColors"
)
default Color miscellaneousColor()
{
return new Color(243, 85, 136, 255);
}
@Alpha
@ConfigItem(
position = 13,
keyName = "gamemodeColor",
name = "Gamemode color",
description = "Configure the color of gamemode plugins",
titleSection = "pluginsColorTitle",
hidden = true,
unhide = "enabledColors"
)
default Color gamemodeColor()
{
return new Color(244, 239, 211, 255);
}
@Alpha
@ConfigItem(
position = 14,
keyName = "externalColor",
name = "External color",
description = "Configure the color of external plugins",
titleSection = "pluginsColorTitle",
hidden = true,
unhide = "enabledColors"
)
default Color externalColor()
{
return new Color(177, 156, 217, 255);
}
@ConfigTitleSection(
keyName = "externalPluginsTitle",
name = "External",
description = "",
position = 17,
position = 15,
titleSection = "pluginsTitle"
)
default Title externalPluginsTitle()
@@ -291,7 +283,7 @@ public interface OpenOSRSConfig extends Config
keyName = "enablePlugins",
name = "Enable loading of external plugins",
description = "Enable loading of external plugins",
position = 18,
position = 16,
titleSection = "externalPluginsTitle"
)
default boolean enablePlugins()
@@ -303,7 +295,7 @@ public interface OpenOSRSConfig extends Config
keyName = "opacityTitle",
name = "Opacity",
description = "",
position = 19
position = 17
)
default Title opacityTitle()
{
@@ -314,7 +306,7 @@ public interface OpenOSRSConfig extends Config
keyName = "enableOpacity",
name = "Enable opacity",
description = "Enables opacity for the whole window.<br>NOTE: This only stays enabled if your pc supports this!",
position = 20,
position = 18,
titleSection = "opacityTitle"
)
default boolean enableOpacity()
@@ -330,7 +322,7 @@ public interface OpenOSRSConfig extends Config
keyName = "opacityPercentage",
name = "Opacity percentage",
description = "Changes the opacity of the window if opacity is enabled",
position = 21,
position = 19,
titleSection = "opacityTitle"
)
default int opacityPercentage()
@@ -342,7 +334,7 @@ public interface OpenOSRSConfig extends Config
keyName = "miscTitle",
name = "Miscellaneous",
description = "",
position = 22
position = 20
)
default Title miscTitle()
{
@@ -353,7 +345,7 @@ public interface OpenOSRSConfig extends Config
keyName = "keyboardPin",
name = "Keyboard bank pin",
description = "Enables you to type your bank pin",
position = 23,
position = 21,
titleSection = "miscTitle"
)
default boolean keyboardPin()
@@ -365,7 +357,7 @@ public interface OpenOSRSConfig extends Config
keyName = "detachHotkey",
name = "Detach Cam",
description = "Detach Camera hotkey, press this and it will activate detatched camera.",
position = 24,
position = 22,
titleSection = "miscTitle"
)
default Keybind detachHotkey()

View File

@@ -29,9 +29,11 @@ import net.runelite.api.Constants;
import net.runelite.client.Notifier;
import net.runelite.client.ui.ContainableFrame;
@ConfigGroup("runelite")
@ConfigGroup(RuneLiteConfig.GROUP_NAME)
public interface RuneLiteConfig extends Config
{
String GROUP_NAME = "runelite";
@ConfigTitleSection(
keyName = "uiTitle",
name = "User interface",

View File

@@ -24,7 +24,18 @@
*/
package net.runelite.client.events;
public abstract class ChatInput
import lombok.Getter;
import net.runelite.api.events.Event;
public abstract class ChatInput implements Event
{
@Getter
private boolean stop = false;
public void setStop()
{
this.stop = true;
}
public abstract void resume();
}

View File

@@ -95,7 +95,7 @@ public class ExternalPluginLoader
List<Plugin> loadedPlugins;
try
{
loadedPlugins = pluginManager.scanAndInstantiate(loader, null);
loadedPlugins = pluginManager.scanAndInstantiate(loader, null, true);
}
catch (IOException ex)
{

View File

@@ -59,5 +59,5 @@ public @interface PluginDescriptor
boolean loadWhenOutdated() default false;
PluginType type() default PluginType.GENERAL_USE;
PluginType type() default PluginType.UNCATEGORIZED;
}

View File

@@ -213,7 +213,7 @@ public class PluginManager
public void loadCorePlugins() throws IOException
{
plugins.addAll(scanAndInstantiate(getClass().getClassLoader(), PLUGIN_PACKAGE));
plugins.addAll(scanAndInstantiate(getClass().getClassLoader(), PLUGIN_PACKAGE, false));
}
public void startCorePlugins()
@@ -246,7 +246,7 @@ public class PluginManager
}
@SuppressWarnings("unchecked")
List<Plugin> scanAndInstantiate(ClassLoader classLoader, String packageName) throws IOException
List<Plugin> scanAndInstantiate(ClassLoader classLoader, String packageName, boolean external) throws IOException
{
RuneLiteSplashScreen.stage(.59, "Loading plugins");
MutableGraph<Class<? extends Plugin>> graph = GraphBuilder
@@ -279,6 +279,12 @@ public class PluginManager
continue;
}
if (external && pluginDescriptor.type() != PluginType.EXTERNAL)
{
log.error("Class {} is using the external plugin loader but doesn't have PluginType.EXTERNAL", clazz);
continue;
}
if (!pluginDescriptor.loadWhenOutdated() && isOutdated)
{
continue;

View File

@@ -1,12 +1,29 @@
package net.runelite.client.plugins;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
@Getter(AccessLevel.PUBLIC)
@AllArgsConstructor
public enum PluginType
{
PVM,
PVP,
SKILLING,
UTILITY,
GENERAL_USE,
EXTERNAL,
IMPORTANT
}
PVM("PvM"),
PVP("PvP"),
SKILLING("Skilling"),
UTILITY("Utilities"),
MISCELLANEOUS("Miscellaneous"),
EXTERNAL("External"),
IMPORTANT("System"),
MINIGAME("Minigame"),
GAMEMODE("Gamemode"),
UNCATEGORIZED("Uncategorized");
private String name;
@Override
public String toString()
{
return getName();
}
}

View File

@@ -38,7 +38,8 @@ import net.runelite.client.plugins.PluginDescriptor;
name = "Account",
description = "Sync RuneLite config settings with your Google account",
tags = {"external", "google", "integration"},
loadWhenOutdated = true
loadWhenOutdated = true,
hidden = true
)
@Slf4j
@Singleton

View File

@@ -48,6 +48,7 @@ import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.plugins.achievementdiary.diaries.ArdougneDiaryRequirement;
import net.runelite.client.plugins.achievementdiary.diaries.DesertDiaryRequirement;
import net.runelite.client.plugins.achievementdiary.diaries.FaladorDiaryRequirement;
@@ -65,7 +66,8 @@ import net.runelite.client.plugins.achievementdiary.diaries.WildernessDiaryRequi
@PluginDescriptor(
name = "Diary Requirements",
description = "Display level requirements in Achievement Diary interface",
tags = {"achievements", "tasks"}
tags = {"achievements", "tasks"},
type = PluginType.UTILITY
)
@Singleton
public class DiaryRequirementsPlugin extends Plugin

View File

@@ -51,7 +51,7 @@ public interface AgilityConfig extends Config
description = "This will remove the distance cap on rendering overlays for agility.",
warning = "<html><center>Enabling this setting on a low end machine may severely affect your fps." +
"<br>Click yes to enable this setting, knowing it might affect performance.</center></html>",
position = 1,
position = 0,
titleSection = "mainConfig"
)
default boolean removeDistanceCap()
@@ -59,6 +59,17 @@ public interface AgilityConfig extends Config
return false;
}
@ConfigItem(
keyName = "showCourseClickboxes",
name = "Show course Clickboxes",
description = "Show agility course obstacle clickboxes",
position = 1
)
default boolean showCourseClickboxes()
{
return true;
}
@ConfigItem(
keyName = "showLapCount",
name = "Show Lap Count",

View File

@@ -71,7 +71,8 @@ class AgilityOverlay extends Overlay
plugin.getObstacles().forEach((object, obstacle) ->
{
if (Obstacles.SHORTCUT_OBSTACLE_IDS.containsKey(object.getId()) && !plugin.isHighlightShortcuts() ||
Obstacles.TRAP_OBSTACLE_IDS.contains(object.getId()) && !plugin.isShowTrapOverlay())
Obstacles.TRAP_OBSTACLE_IDS.contains(object.getId()) && !plugin.isShowTrapOverlay() ||
Obstacles.COURSE_OBSTACLE_IDS.contains(object.getId()) && !plugin.isShowCourseClickboxes())
{
return;
}

View File

@@ -77,6 +77,7 @@ import net.runelite.client.game.AgilityShortcut;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.util.ColorUtil;
@@ -84,7 +85,8 @@ import net.runelite.client.util.ColorUtil;
@PluginDescriptor(
name = "Agility",
description = "Show helpful information about agility courses and obstacles",
tags = {"grace", "marks", "overlay", "shortcuts", "skilling", "traps"}
tags = {"grace", "marks", "overlay", "shortcuts", "skilling", "traps"},
type = PluginType.SKILLING
)
@Slf4j
@Singleton
@@ -139,6 +141,8 @@ public class AgilityPlugin extends Plugin
@Getter(AccessLevel.PACKAGE)
private boolean removeDistanceCap;
@Getter(AccessLevel.PACKAGE)
private boolean showCourseClickboxes;
@Getter(AccessLevel.PACKAGE)
private boolean showLapCount;
@Getter(AccessLevel.PACKAGE)
private int lapTimeout;
@@ -258,6 +262,7 @@ public class AgilityPlugin extends Plugin
private void updateConfig()
{
this.removeDistanceCap = config.removeDistanceCap();
this.showCourseClickboxes = config.showCourseClickboxes();
this.showLapCount = config.showLapCount();
this.lapTimeout = config.lapTimeout();
this.lapsToLevel = config.lapsToLevel();

View File

@@ -39,12 +39,14 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@PluginDescriptor(
name = "Ammo",
description = "Shows the current ammo the player has equipped",
tags = {"bolts", "darts", "chinchompa", "equipment"}
tags = {"bolts", "darts", "chinchompa", "equipment"},
type = PluginType.UTILITY
)
@Singleton
public class AmmoPlugin extends Plugin

View File

@@ -33,12 +33,14 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
@PluginDescriptor(
name = "Animation Smoothing",
description = "Show smoother player, NPC, and object animations",
tags = {"npcs", "objects", "players"},
enabledByDefault = false
enabledByDefault = false,
type = PluginType.MISCELLANEOUS
)
@Singleton
public class AnimationSmoothingPlugin extends Plugin

View File

@@ -54,6 +54,7 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import static net.runelite.client.plugins.attackstyles.AttackStyle.CASTING;
import static net.runelite.client.plugins.attackstyles.AttackStyle.DEFENSIVE_CASTING;
import static net.runelite.client.plugins.attackstyles.AttackStyle.OTHER;
@@ -62,7 +63,8 @@ import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Attack Styles",
description = "Show your current attack style as an overlay",
tags = {"combat", "defence", "magic", "overlay", "ranged", "strength", "warn", "pure"}
tags = {"combat", "defence", "magic", "overlay", "ranged", "strength", "warn", "pure"},
type = PluginType.UTILITY
)
@Singleton
public class AttackStylesPlugin extends Plugin

View File

@@ -71,13 +71,15 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.plugins.banktags.tabs.BankSearch;
import net.runelite.client.util.QuantityFormatter;
@PluginDescriptor(
name = "Bank",
description = "Modifications to the banking interface",
tags = {"grand", "exchange", "high", "alchemy", "prices", "deposit"}
tags = {"grand", "exchange", "high", "alchemy", "prices", "deposit"},
type = PluginType.UTILITY
)
@Singleton
public class BankPlugin extends Plugin

View File

@@ -79,6 +79,7 @@ import net.runelite.client.input.MouseWheelListener;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDependency;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.plugins.banktags.tabs.BankSearch;
import net.runelite.client.plugins.banktags.tabs.TabInterface;
import static net.runelite.client.plugins.banktags.tabs.TabInterface.FILTERED_CHARS;
@@ -89,7 +90,8 @@ import net.runelite.client.util.QuantityFormatter;
@PluginDescriptor(
name = "Bank Tags",
description = "Enable tagging of bank items and searching of bank tags",
tags = {"searching", "tagging"}
tags = {"searching", "tagging"},
type = PluginType.UTILITY
)
@PluginDependency(ClueScrollPlugin.class)
@Singleton

View File

@@ -880,19 +880,21 @@ public class TabInterface
--maxTabs;
}
if (currentTabIndex + direction >= tabManager.size() || currentTabIndex + direction < 0)
int proposedIndex = currentTabIndex + direction;
int numTabs = tabManager.size() + 1;
if (proposedIndex >= numTabs || proposedIndex < 0)
{
currentTabIndex = 0;
}
if ((tabManager.size() - (currentTabIndex + direction) >= maxTabs) && (currentTabIndex + direction > -1))
else if (numTabs - proposedIndex >= maxTabs)
{
currentTabIndex += direction;
currentTabIndex = proposedIndex;
}
else if (maxTabs < tabManager.size() && tabManager.size() - (currentTabIndex + direction) < maxTabs)
else if (maxTabs < numTabs && numTabs - proposedIndex < maxTabs)
{
// Edge case when only 1 tab displays instead of up to maxTabs when one is deleted at the end of the list
currentTabIndex += direction;
currentTabIndex = proposedIndex;
scrollTab(-1);
}
@@ -973,7 +975,7 @@ public class TabInterface
{
int y = bounds.y + MARGIN + BUTTON_HEIGHT;
if (maxTabs >= tabManager.size())
if (maxTabs > tabManager.size())
{
currentTabIndex = 0;
}
@@ -999,6 +1001,8 @@ public class TabInterface
y += TAB_HEIGHT + MARGIN;
}
updateWidget(newTab, y);
boolean hidden = !(tabManager.size() > 0);
upButton.setHidden(hidden);

View File

@@ -68,7 +68,7 @@ import org.jetbrains.annotations.NotNull;
description = "Displays warning in chat when you join a" +
"clan chat/new member join your clan chat and he is in a WDR/RuneWatch/Manual List",
tags = {"PVM", "WDR", "RuneWatch"},
type = PluginType.UTILITY,
type = PluginType.MISCELLANEOUS,
enabledByDefault = false
)
@Singleton

View File

@@ -106,7 +106,7 @@ import org.apache.commons.lang3.StringUtils;
name = "Barbarian Assault",
description = "Custom barbarian assault plugin, use along with BA Tools",
tags = {"minigame", "overlay", "timer"},
type = PluginType.PVM // don't remove this, added this because our barbarian assault plugin is big time modified
type = PluginType.MINIGAME // don't remove this, added this because our barbarian assault plugin is big time modified
)
@Singleton
public class BarbarianAssaultPlugin extends Plugin implements KeyListener

View File

@@ -59,6 +59,7 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxPriority;
@@ -67,7 +68,8 @@ import net.runelite.client.ui.overlay.infobox.LoopTimer;
@PluginDescriptor(
name = "Barrows Brothers",
description = "Show helpful information for the Barrows minigame",
tags = {"combat", "minigame", "minimap", "bosses", "pve", "pvm"}
tags = {"combat", "minigame", "minimap", "bosses", "pve", "pvm"},
type = PluginType.MINIGAME
)
@Singleton
public class BarrowsPlugin extends Plugin

View File

@@ -51,13 +51,15 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@PluginDescriptor(
name = "Blast Furnace",
description = "Show helpful information for the Blast Furnace minigame",
tags = {"minigame", "overlay", "skilling", "smithing"}
tags = {"minigame", "overlay", "skilling", "smithing"},
type = PluginType.MINIGAME
)
@Singleton
public class BlastFurnacePlugin extends Plugin

View File

@@ -45,12 +45,14 @@ import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Blast Mine",
description = "Show helpful information for the Blast Mine minigame",
tags = {"explode", "explosive", "mining", "minigame", "skilling"}
tags = {"explode", "explosive", "mining", "minigame", "skilling"},
type = PluginType.MINIGAME
)
@Singleton
public class BlastMinePlugin extends Plugin

View File

@@ -49,6 +49,7 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.SkillIconManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.util.ImageUtil;
@@ -56,7 +57,8 @@ import net.runelite.client.util.ImageUtil;
@PluginDescriptor(
name = "Boosts Information",
description = "Show combat and/or skill boost information",
tags = {"combat", "notifications", "skilling", "overlay"}
tags = {"combat", "notifications", "skilling", "overlay"},
type = PluginType.UTILITY
)
@Singleton
public class BoostsPlugin extends Plugin

View File

@@ -34,12 +34,14 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@PluginDescriptor(
name = "Boss Timers",
description = "Show boss spawn timer overlays",
tags = {"combat", "pve", "overlay", "spawn"}
tags = {"combat", "pve", "overlay", "spawn"},
type = PluginType.PVM
)
@Singleton
@Slf4j

View File

@@ -0,0 +1,139 @@
package net.runelite.client.plugins.bronzeman;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection;
@ConfigGroup("bronzemanmode")
public interface BronzeManConfig extends Config
{
@ConfigSection(
name = "Unlocked Notifications",
description = "",
position = 0,
keyName = "unlockNotifications"
)
default boolean unlockNotifications()
{
return false;
}
@ConfigSection(
name = "Game Mode Options",
description = "",
position = 1,
keyName = "gameModeOptions"
)
default boolean gameModeOptions()
{
return false;
}
@ConfigSection(
name = "Chat Commands",
description = "",
position = 2,
keyName = "chatCommands"
)
default boolean chatCommands()
{
return false;
}
@ConfigItem(
keyName = "notifyImgUnlock",
name = "image unlocked notification",
description = "Configure whether to send the notification image when you unlock a new item.",
position = 0,
section = "unlockNotifications"
)
default boolean notifyImgUnlock()
{
return true;
}
@ConfigItem(
keyName = "notifyChatUnlock",
name = "Chat unlocked notification",
description = "Configure whether to send the chat notification when you unlock a new item.",
position = 1,
section = "unlockNotifications"
)
default boolean notifyChatUnlock()
{
return true;
}
@ConfigItem(
keyName = "resetCommand",
name = "Enable resetunlocks command",
description = "Enables the !resetunlocks command used for wiping your unlocked items.",
position = 0,
section = "chatCommands"
)
default boolean resetCommand()
{
return false;
}
@ConfigItem(
keyName = "countCommand",
name = "Enable countunlocks command",
description = "Enables the !countunlocks command used for counting your unlocked items.",
position = 1,
section = "chatCommands"
)
default boolean countCommand()
{
return true;
}
@ConfigItem(
keyName = "backupCommand",
name = "Enable backupunlocks command",
description = "Enables the !backupunlocks command used for backing up your unlocked items.",
position = 2,
section = "chatCommands"
)
default boolean backupCommand()
{
return true;
}
@ConfigItem(
keyName = "restoreCommand",
name = "Enable restoreunlocks command",
description = "Enables the !restoreunlocks command used for restoring your unlocked items file.",
position = 3,
section = "chatCommands"
)
default boolean restoreCommand()
{
return true;
}
@ConfigItem(
keyName = "deleteCommand",
name = "Enable deleteunlocks command",
description = "Enables the !deleteunlocks command used for deleting your unlocked items file.",
position = 4,
section = "chatCommands"
)
default boolean deleteCommand()
{
return false;
}
@ConfigItem(
keyName = "hideTradeOption",
name = "Hide trade with option",
description = "Hides the trade with option from the player menu",
position = 0,
section = "gameModeOptions"
)
default boolean hideTradeOption()
{
return true;
}
}

View File

@@ -73,7 +73,7 @@ public class BronzeManOverlay extends Overlay
{
currentUnlock.setLocationY(drawY + 1);
}
if (currentUnlock.displayed())
if (currentUnlock.displayed(itemUnlockList.size()))
{
itemUnlockList.remove(currentUnlock);
currentUnlock = null;

View File

@@ -1,38 +1,53 @@
package net.runelite.client.plugins.bronzeman;
import com.google.inject.Provides;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URL;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.ArrayList;
import java.util.List;
import javax.imageio.ImageIO;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.Item;
import net.runelite.api.ItemID;
import net.runelite.api.MenuEntry;
import net.runelite.api.Player;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ClientTick;
import net.runelite.api.events.GameStateChanged;
import net.runelite.api.events.GameTick;
import net.runelite.api.events.ItemContainerChanged;
import net.runelite.api.events.MenuOpened;
import net.runelite.api.events.WidgetLoaded;
import net.runelite.api.util.Text;
import static net.runelite.api.util.Text.sanitize;
import net.runelite.api.widgets.Widget;
import net.runelite.api.widgets.WidgetID;
import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.RuneLite;
import net.runelite.client.chat.ChatColorType;
import net.runelite.client.chat.ChatMessageBuilder;
import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ImageUtil;
/**
* @author Seth Davis
@@ -43,38 +58,69 @@ import net.runelite.client.ui.overlay.OverlayManager;
name = "Bronze Man Mode",
description = "Restrict yourself as an Iron Meme with GE use for items you have unlocked.",
tags = {"Bronze", "pve", "restrict", "game", "challenge", "bronzeman", "ironman"},
type = PluginType.UTILITY,
type = PluginType.GAMEMODE,
enabledByDefault = false
)
@Slf4j
public class BronzemanPlugin extends Plugin
{
private static final String BACKUP_CHAT_COMMAND = "!backupunlocks";
private static final String COUNT_CHAT_COMMAND = "!countunlocks";
private static final String DELETE_CHAT_COMMAND = "!deleteunlocks";
private static final String RESET_CHAT_COMMAND = "!resetunlocks";
private static final String RESTORE_CHAT_COMMAND = "!restoreunlocks";
private final BufferedImage UNLOCK_IMAGE = ImageUtil.getResourceStreamFromClass(getClass(), "item_unlocked.png");
@Inject
ItemManager itemManager;
@Inject
private Client client;
@Inject
private OverlayManager overlayManager;
@Inject
private BronzeManConfig config;
@Inject
private ChatMessageManager chatMessageManager;
@Inject
private BronzeManOverlay bronzemanOverlay;
private List<Integer> unlockedItems;
@Getter(AccessLevel.PACKAGE)
private BufferedImage unlockImage = null;
private boolean notifyImgUnlock;
private boolean notifyChatUnlock;
private boolean resetCommand;
private boolean countCommand;
private boolean backupCommand;
private boolean deleteCommand;
private boolean restoreCommand;
private boolean hideTradeOption;
/**
* Loads GrandExchange widgets for further manipulation of the interface
**/
private Widget grandExchangeWindow;
private Widget grandExchangeChatBox;
@Provides
BronzeManConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(BronzeManConfig.class);
}
@Override
protected void startUp()
{
loadUnlockImage();
/**
* Downloads the item-unlock png file to display unlocks
**/
unlockImage = UNLOCK_IMAGE;
unlockedItems = new ArrayList<>();
overlayManager.add(bronzemanOverlay);
updateConfig();
loadPlayerUnlocks();
}
@Override
@@ -84,6 +130,21 @@ public class BronzemanPlugin extends Plugin
overlayManager.remove(bronzemanOverlay);
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!event.getKey().equals("notifyImgUnlock"))
{
overlayManager.remove(bronzemanOverlay);
}
if (!event.getGroup().equals("bronzemanmode"))
{
return;
}
updateConfig();
}
/**
* Loads players unlocks on login
**/
@@ -142,7 +203,7 @@ public class BronzemanPlugin extends Plugin
* Handles greying out items in the GrandExchange
**/
@Subscribe
public void onGameTick(GameTick e)
public void onClientTick(ClientTick e)
{
if (grandExchangeWindow == null || grandExchangeChatBox == null || grandExchangeWindow.isHidden())
{
@@ -182,8 +243,18 @@ public class BronzemanPlugin extends Plugin
private void queueItemUnlock(int itemId)
{
unlockedItems.add(itemId);
bronzemanOverlay.addItemUnlock(itemId);
savePlayerUnlocks();// Save after every item to fail-safe logging out
if (this.notifyChatUnlock)
{
sendMessage("You have successfully unlocked item: " + itemManager.getItemDefinition(itemId).getName());
}
if (!this.notifyImgUnlock)
{
return;
}
bronzemanOverlay.addItemUnlock(itemId);
}
/**
@@ -193,6 +264,7 @@ public class BronzemanPlugin extends Plugin
{
queueItemUnlock(ItemID.COINS_995);
queueItemUnlock(ItemID.OLD_SCHOOL_BOND);
queueItemUnlock(ItemID.PLATINUM_TOKEN);
}
/**
@@ -218,7 +290,7 @@ public class BronzemanPlugin extends Plugin
}
/**
* Loads a players unlcoks everytime they login
* Loads a players unlocks everytime they login
**/
private void loadPlayerUnlocks()
{
@@ -253,25 +325,180 @@ public class BronzemanPlugin extends Plugin
}
}
/**
* Downloads the item-unlock png file to display unlocks
**/
private void loadUnlockImage()
@Subscribe
public void onChatMessage(ChatMessage chatMessage)
{
final String playerName;
if (chatMessage.equals(ChatMessageType.PRIVATECHATOUT))
{
playerName = client.getLocalPlayer().getName();
}
else
{
playerName = sanitize(chatMessage.getName());
}
if (this.countCommand && chatMessage.getMessage().toLowerCase().equals(COUNT_CHAT_COMMAND))
{
sendMessage("You have successfully unlocked " + unlockedItems.size() + " items.");
}
if (this.resetCommand && chatMessage.getMessage().toLowerCase().equals(RESET_CHAT_COMMAND))
{
resetUnlocks();
}
if (this.backupCommand && chatMessage.getMessage().toLowerCase().equals(BACKUP_CHAT_COMMAND))
{
backupUnlocks();
}
if (this.deleteCommand && chatMessage.getMessage().toLowerCase().equals(DELETE_CHAT_COMMAND))
{
deleteUnlocks();
}
if (this.restoreCommand && chatMessage.getMessage().toLowerCase().equals(RESTORE_CHAT_COMMAND))
{
restoreUnlocks();
}
}
private void backupUnlocks()
{
File playerFolder = new File(RuneLite.PROFILES_DIR, client.getUsername());
if (!playerFolder.exists())
{
return;
}
File playerFile = new File(playerFolder, "bronzeman-unlocks.txt");
if (!playerFile.exists())
{
return;
}
Path originalPath = playerFile.toPath();
try
{
File imageFile = new File(RuneLite.RUNELITE_DIR, "item-unlocked.png");
if (!imageFile.exists())
{
InputStream in = new URL("https://i.imgur.com/KWVNlsq.png").openStream();
Files.copy(in, Paths.get(imageFile.getPath()));
}
unlockImage = ImageIO.read(imageFile);
Files.copy(originalPath, Paths.get(playerFile.getPath().replace(".txt", ".backup")),
StandardCopyOption.REPLACE_EXISTING);
}
catch (Exception e)
{
e.printStackTrace();
return;
}
sendMessage("Successfully backed up current unlock file!");
}
}
private void restoreUnlocks()
{
File playerFolder = new File(RuneLite.PROFILES_DIR, client.getUsername());
if (!playerFolder.exists())
{
return;
}
File playerFile = new File(playerFolder, "bronzeman-unlocks.backup");
if (!playerFile.exists())
{
return;
}
Path originalPath = playerFile.toPath();
try
{
Files.copy(originalPath, Paths.get(playerFile.getPath().replace(".backup", ".txt")),
StandardCopyOption.REPLACE_EXISTING);
}
catch (Exception e)
{
e.printStackTrace();
return;
}
sendMessage("Successfully restored current unlock file!");
}
private void resetUnlocks()
{
try
{
File playerFolder = new File(RuneLite.PROFILES_DIR, client.getUsername());
File playerFile = new File(playerFolder, "bronzeman-unlocks.txt");
playerFile.delete();
unlockedItems.clear();
savePlayerUnlocks();
unlockDefaultItems();
}
catch (Exception e)
{
e.printStackTrace();
return;
}
sendMessage("Current Unlock file succesfully reset!");
}
private void deleteUnlocks()
{
backupUnlocks();
try
{
File playerFolder = new File(RuneLite.PROFILES_DIR, client.getUsername());
File playerFile = new File(playerFolder, "bronzeman-unlocks.txt");
playerFile.delete();
}
catch (Exception e)
{
e.printStackTrace();
return;
}
sendMessage("Current Unlock file succesfully deleted!");
}
@Subscribe
private void onMenuOpened(MenuOpened event)
{
Player localPlayer = client.getLocalPlayer();
if (localPlayer == null)
{
return;
}
List<MenuEntry> menu_entries = new ArrayList<>();
for (MenuEntry entry : event.getMenuEntries())
{
String option = Text.removeTags(entry.getOption()).toLowerCase();
if (option.contains("trade with") && this.hideTradeOption)
{
continue;
}
menu_entries.add(entry);
}
event.setMenuEntries(menu_entries.toArray(new MenuEntry[0]));
event.setModified();
}
private void sendMessage(String text)
{
final ChatMessageBuilder message = new ChatMessageBuilder()
.append(ChatColorType.HIGHLIGHT)
.append(text);
chatMessageManager.queue(QueuedMessage.builder()
.type(ChatMessageType.CONSOLE)
.runeLiteFormattedMessage(message.build())
.build());
}
private void updateConfig()
{
this.notifyImgUnlock = config.notifyImgUnlock();
this.resetCommand = config.resetCommand();
this.countCommand = config.countCommand();
this.backupCommand = config.backupCommand();
this.notifyChatUnlock = config.notifyChatUnlock();
this.deleteCommand = config.deleteCommand();
this.restoreCommand = config.restoreCommand();
this.hideTradeOption = config.hideTradeOption();
}
}

View File

@@ -40,8 +40,12 @@ public class ItemUnlock
/**
* Returns whether or not an items has been displayed as unlocked yet
**/
public boolean displayed()
public boolean displayed(int queue)
{
if (queue >= 2)
{
return System.currentTimeMillis() > initTime + (750);
}
return System.currentTimeMillis() > initTime + (5000);
}

View File

@@ -147,4 +147,15 @@ public interface CameraConfig extends Config
{
return false;
}
}
@ConfigItem(
keyName = "compassLook",
name = "Compass options",
description = "Adds Look South, East, and West options to the compass",
position = 10
)
default boolean compassLook()
{
return true;
}
}

View File

@@ -30,13 +30,16 @@ import com.google.inject.Inject;
import com.google.inject.Provides;
import java.awt.event.KeyEvent;
import java.awt.event.MouseEvent;
import java.util.Arrays;
import javax.swing.SwingUtilities;
import net.runelite.api.Client;
import net.runelite.api.MenuEntry;
import net.runelite.api.MenuOpcode;
import net.runelite.api.ScriptID;
import net.runelite.api.VarPlayer;
import net.runelite.api.events.ClientTick;
import net.runelite.api.events.FocusChanged;
import net.runelite.api.events.MenuEntryAdded;
import net.runelite.api.events.ScriptCallbackEvent;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ConfigManager;
@@ -48,13 +51,15 @@ import net.runelite.client.input.MouseListener;
import net.runelite.client.input.MouseManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.util.MiscUtils;
@PluginDescriptor(
name = "Camera Zoom",
description = "Expands zoom limit, provides vertical camera, and remaps mouse input keys",
tags = {"zoom", "limit", "vertical", "click", "mouse"},
enabledByDefault = false
enabledByDefault = false,
type = PluginType.MISCELLANEOUS
)
public class CameraPlugin extends Plugin implements KeyListener, MouseListener
{
@@ -65,6 +70,10 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
*/
private static final int INNER_ZOOM_LIMIT = 1004;
private static final int DEFAULT_ZOOM_INCREMENT = 25;
private static final String LOOK_NORTH = "Look North";
private static final String LOOK_SOUTH = "Look South";
private static final String LOOK_EAST = "Look East";
private static final String LOOK_WEST = "Look West";
private boolean controlDown;
// flags used to store the mousedown states
@@ -96,6 +105,60 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
return configManager.getConfig(CameraConfig.class);
}
@Override
protected void startUp()
{
rightClick = false;
middleClick = false;
menuHasEntries = false;
client.setCameraPitchRelaxerEnabled(cameraConfig.relaxCameraPitch());
keyManager.registerKeyListener(this);
mouseManager.registerMouseListener(this);
}
@Override
protected void shutDown()
{
client.setCameraPitchRelaxerEnabled(false);
keyManager.unregisterKeyListener(this);
mouseManager.unregisterMouseListener(this);
controlDown = false;
}
@Subscribe
public void onMenuEntryAdded(MenuEntryAdded menuEntryAdded)
{
if (menuEntryAdded.getOpcode() == MenuOpcode.WIDGET_DEFAULT.getId() && menuEntryAdded.getOption().equals(LOOK_NORTH) && cameraConfig.compassLook())
{
MenuEntry[] menuEntries = client.getMenuEntries();
int len = menuEntries.length;
MenuEntry north = menuEntries[len - 1];
menuEntries = Arrays.copyOf(menuEntries, len + 3);
// The handling for these entries is done in ToplevelCompassOp.rs2asm
menuEntries[--len] = createCameraLookEntry(menuEntryAdded, 4, LOOK_WEST);
menuEntries[++len] = createCameraLookEntry(menuEntryAdded, 3, LOOK_EAST);
menuEntries[++len] = createCameraLookEntry(menuEntryAdded, 2, LOOK_SOUTH);
menuEntries[++len] = north;
client.setMenuEntries(menuEntries);
}
}
private MenuEntry createCameraLookEntry(MenuEntryAdded lookNorth, int identifier, String option)
{
MenuEntry m = new MenuEntry();
m.setOption(option);
m.setTarget(lookNorth.getTarget());
m.setIdentifier(identifier);
m.setOpcode(MenuOpcode.WIDGET_DEFAULT.getId());
m.setParam0(lookNorth.getParam0());
m.setParam1(lookNorth.getParam1());
return m;
}
@Subscribe
private void onScriptCallbackEvent(ScriptCallbackEvent event)
{
@@ -169,27 +232,6 @@ public class CameraPlugin extends Plugin implements KeyListener, MouseListener
}
}
@Override
protected void startUp()
{
rightClick = false;
middleClick = false;
menuHasEntries = false;
client.setCameraPitchRelaxerEnabled(cameraConfig.relaxCameraPitch());
keyManager.registerKeyListener(this);
mouseManager.registerMouseListener(this);
}
@Override
protected void shutDown()
{
client.setCameraPitchRelaxerEnabled(false);
keyManager.unregisterKeyListener(this);
mouseManager.unregisterMouseListener(this);
controlDown = false;
}
@Subscribe
private void onConfigChanged(ConfigChanged ev)
{

View File

@@ -51,6 +51,7 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.task.Schedule;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@@ -59,7 +60,8 @@ import net.runelite.client.util.ItemUtil;
@PluginDescriptor(
name = "Cannon",
description = "Show information about cannon placement and/or amount of cannonballs",
tags = {"combat", "notifications", "ranged", "overlay"}
tags = {"combat", "notifications", "ranged", "overlay"},
type = PluginType.UTILITY
)
public class CannonPlugin extends Plugin
{

View File

@@ -41,12 +41,14 @@ import net.runelite.api.events.NpcSpawned;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Cerberus",
description = "Show what to pray against the summoned souls",
tags = {"bosses", "combat", "ghosts", "prayer", "pve", "overlay", "souls"}
tags = {"bosses", "combat", "ghosts", "prayer", "pve", "overlay", "souls"},
type = PluginType.PVM
)
@Singleton
public class CerberusPlugin extends Plugin

View File

@@ -42,9 +42,11 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
@PluginDescriptor(
name = "Chatbox performance"
name = "Chatbox performance",
type = PluginType.MISCELLANEOUS
)
@Singleton
public class ChatboxPerformancePlugin extends Plugin

View File

@@ -68,6 +68,7 @@ import net.runelite.client.game.ItemManager;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.util.QuantityFormatter;
import net.runelite.http.api.chat.ChatClient;
import net.runelite.http.api.chat.Duels;
@@ -84,7 +85,8 @@ import org.apache.commons.text.WordUtils;
@PluginDescriptor(
name = "Chat Commands",
description = "Enable chat commands",
tags = {"grand", "exchange", "level", "prices"}
tags = {"grand", "exchange", "level", "prices"},
type = PluginType.UTILITY
)
@Singleton
@Slf4j

View File

@@ -29,7 +29,9 @@ import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.ScriptID;
import net.runelite.api.VarClientInt;
import net.runelite.api.VarClientStr;
import net.runelite.api.vars.InputType;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.input.KeyListener;
@@ -56,7 +58,11 @@ class ChatKeyboardListener implements KeyListener
{
if (chatCommandsConfig.clearSingleWord().matches(e))
{
String input = client.getVar(VarClientStr.CHATBOX_TYPED_TEXT);
int inputTye = client.getVar(VarClientInt.INPUT_TYPE);
String input = inputTye == InputType.NONE.getType()
? client.getVar(VarClientStr.CHATBOX_TYPED_TEXT)
: client.getVar(VarClientStr.INPUT_TEXT);
if (input != null)
{
// remove trailing space
@@ -77,20 +83,27 @@ class ChatKeyboardListener implements KeyListener
replacement = "";
}
clientThread.invoke(() ->
{
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, replacement);
client.runScript(ScriptID.CHAT_PROMPT_INIT);
});
clientThread.invoke(() -> applyText(inputTye, replacement));
}
}
else if (chatCommandsConfig.clearChatBox().matches(e))
{
clientThread.invoke(() ->
{
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, "");
client.runScript(ScriptID.CHAT_PROMPT_INIT);
});
int inputTye = client.getVar(VarClientInt.INPUT_TYPE);
clientThread.invoke(() -> applyText(inputTye, ""));
}
}
private void applyText(int inputType, String replacement)
{
if (inputType == InputType.NONE.getType())
{
client.setVar(VarClientStr.CHATBOX_TYPED_TEXT, replacement);
client.runScript(ScriptID.CHAT_PROMPT_INIT);
}
else if (inputType == InputType.PRIVATE_MESSAGE.getType())
{
client.setVar(VarClientStr.INPUT_TEXT, replacement);
client.runScript(ScriptID.CHAT_TEXT_INPUT_REBUILD, "");
}
}

View File

@@ -50,12 +50,14 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import org.apache.commons.lang3.StringUtils;
@PluginDescriptor(
name = "Chat Filter",
description = "Censor user configurable words or patterns from chat",
enabledByDefault = false
enabledByDefault = false,
type = PluginType.MISCELLANEOUS
)
@Singleton
public class ChatFilterPlugin extends Plugin

View File

@@ -52,12 +52,14 @@ import net.runelite.client.input.KeyListener;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import org.apache.commons.lang3.StringUtils;
@PluginDescriptor(
name = "Chat History",
description = "Retain your chat history when logging in/out or world hopping",
tags = {"chat", "history", "retain", "cycle", "pm"}
tags = {"chat", "history", "retain", "cycle", "pm"},
type = PluginType.MISCELLANEOUS
)
@Singleton
public class ChatHistoryPlugin extends Plugin implements KeyListener

View File

@@ -51,12 +51,14 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
@PluginDescriptor(
name = "Chat Notifications",
description = "Highlight and notify you of chat messages",
tags = {"duel", "messages", "notifications", "trade", "username"},
enabledByDefault = false
enabledByDefault = false,
type = PluginType.MISCELLANEOUS
)
@Singleton
public class ChatNotificationsPlugin extends Plugin

View File

@@ -39,7 +39,7 @@ import net.runelite.client.plugins.PluginType;
name = "Chat Translator",
description = "Translates messages from one Language to another.",
tags = {"translate", "language", "english", "spanish", "dutch", "french", "welsh", "german"},
type = PluginType.UTILITY
type = PluginType.MISCELLANEOUS
)
@Singleton
@Slf4j

View File

@@ -78,6 +78,7 @@ import net.runelite.client.game.SpriteManager;
import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_NAME_OPAQUE_BACKGROUND;
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND;
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_TEXT_OPAQUE_BACKGROUND;
@@ -87,7 +88,8 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@PluginDescriptor(
name = "Clan Chat",
description = "Add rank icons to users talking in clan chat",
tags = {"icons", "rank", "recent"}
tags = {"icons", "rank", "recent"},
type = PluginType.UTILITY
)
@Singleton
public class ClanChatPlugin extends Plugin

View File

@@ -78,6 +78,7 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.plugins.cluescrolls.clues.AnagramClue;
import net.runelite.client.plugins.cluescrolls.clues.BeginnerMapClue;
import net.runelite.client.plugins.cluescrolls.clues.CipherClue;
@@ -107,7 +108,8 @@ import net.runelite.client.util.ItemUtil;
@PluginDescriptor(
name = "Clue Scroll",
description = "Show answers to clue scroll riddles, anagrams, ciphers, and cryptic clues",
tags = {"arrow", "hints", "world", "map", "coordinates", "emotes"}
tags = {"arrow", "hints", "world", "map", "coordinates", "emotes"},
type = PluginType.UTILITY
)
@Slf4j
@Singleton

View File

@@ -89,7 +89,7 @@ public class CoordinateClue extends ClueScroll implements TextClueScroll, Locati
.put(new WorldPoint(2209, 3161, 0), "North-east of Tyras Camp (BJS).")
.put(new WorldPoint(2181, 3206, 0), "South of Elf Camp.")
.put(new WorldPoint(3081, 3209, 0), "Small Island (CLP).")
.put(new WorldPoint(3374, 3250, 0), "Duel Arena combat area.")
.put(new WorldPoint(3399, 3246, 0), "Behind the Duel Arena.")
.put(new WorldPoint(2699, 3251, 0), "Little island (AIR).")
.put(new WorldPoint(3546, 3251, 0), "North-east of Burgh de Rott.")
.put(new WorldPoint(3544, 3256, 0), "North-east of Burgh de Rott.")

View File

@@ -173,7 +173,7 @@ public class EmoteClue extends ClueScroll implements TextClueScroll, LocationClu
new EmoteClue("Yawn in Draynor Marketplace. Equip studded leather chaps, an iron kiteshield and a steel longsword.", "Draynor", DRAYNOR_VILLAGE_MARKET, new WorldPoint(3083, 3253, 0), YAWN, item(STUDDED_CHAPS), item(IRON_KITESHIELD), item(STEEL_LONGSWORD)),
new EmoteClue("Yawn in the Castle Wars lobby. Shrug before you talk to me. Equip a ruby amulet, a mithril scimitar and a Wilderness cape.", "Castle Wars", CASTLE_WARS_BANK, new WorldPoint(2440, 3092, 0), YAWN, SHRUG, item(RUBY_AMULET), item(MITHRIL_SCIMITAR), range("Any team cape", TEAM1_CAPE, TEAM50_CAPE)),
new EmoteClue("Yawn in the rogues' general store. Beware of double agents! Equip an adamant square shield, blue dragon vambraces and a rune pickaxe.", "Rogues general store", NOTERAZZOS_SHOP_IN_THE_WILDERNESS, new WorldPoint(3026, 3701, 0), YAWN, item(ADAMANT_SQ_SHIELD), item(BLUE_DHIDE_VAMB), item(RUNE_PICKAXE)),
new EmoteClue("Yawn at the top of Trollheim. Equip a lava battlestaff, black dragonhide vambraces and a mind shield.", "Trollheim Mountain", ON_TOP_OF_TROLLHEIM_MOUNTAIN, new WorldPoint(2887, 3676, 0), YAWN, item(LAVA_BATTLESTAFF), item(BLACK_DHIDE_VAMB), item(MIND_SHIELD)),
new EmoteClue("Yawn at the top of Trollheim. Equip a lava battlestaff, black dragonhide vambraces and a mind shield.", "Trollheim Mountain", ON_TOP_OF_TROLLHEIM_MOUNTAIN, new WorldPoint(2887, 3676, 0), YAWN, any("Lava battlestaff", item(LAVA_BATTLESTAFF), item(LAVA_BATTLESTAFF_21198)), item(BLACK_DHIDE_VAMB), item(MIND_SHIELD)),
new EmoteClue("Yawn in the centre of Arceuus library. Nod your head before you talk to me. Equip blue dragonhide vambraces, adamant boots and an adamant dagger.", "Arceuus library", ENTRANCE_OF_THE_ARCEUUS_LIBRARY, new WorldPoint(1632, 3807, 0), YAWN, YES, item(BLUE_DHIDE_VAMB), item(ADAMANT_BOOTS), item(ADAMANT_DAGGER)),
new EmoteClue("Swing a bullroarer at the top of the watchtower. Beware of double agents! Equip a dragon plateskirt, climbing boots and a dragon chainbody.", "Yanille watchtower", TOP_FLOOR_OF_THE_YANILLE_WATCHTOWER, new WorldPoint(2932, 4712, 0), BULL_ROARER, item(DRAGON_PLATESKIRT), item(CLIMBING_BOOTS), item(DRAGON_CHAINBODY_3140), item(ItemID.BULL_ROARER)),
new EmoteClue("Blow a raspberry at Gypsy Aris in her tent. Equip a gold ring and a gold necklace.", "Varrock", GYPSY_TENT_ENTRANCE, new WorldPoint(3203, 3424, 0), RASPBERRY, item(GOLD_RING), item(GOLD_NECKLACE)),

View File

@@ -48,12 +48,14 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Combat Level",
description = "Show a more accurate combat level in Combat Options panel and other combat level functions",
tags = {"wilderness", "attack", "range"}
tags = {"wilderness", "attack", "range"},
type = PluginType.UTILITY
)
@Singleton
public class CombatLevelPlugin extends Plugin

View File

@@ -25,28 +25,21 @@
package net.runelite.client.plugins.config;
import java.awt.image.BufferedImage;
import java.lang.reflect.Method;
import java.util.concurrent.ScheduledExecutorService;
import javax.inject.Inject;
import javax.inject.Singleton;
import javax.inject.Provider;
import javax.swing.SwingUtilities;
import net.runelite.api.MenuOpcode;
import net.runelite.client.RuneLite;
import net.runelite.client.callback.ClientThread;
import net.runelite.client.config.ChatColorConfig;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.config.OpenOSRSConfig;
import net.runelite.client.config.RuneLiteConfig;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.events.PluginChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginManager;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.ClientUI;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.ui.components.colorpicker.ColorPickerManager;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
import net.runelite.client.util.ImageUtil;
@@ -56,42 +49,48 @@ import net.runelite.client.util.ImageUtil;
loadWhenOutdated = true,
hidden = true // prevent users from disabling
)
@Singleton
public class ConfigPlugin extends Plugin
{
@Inject
private ClientToolbar clientToolbar;
@Inject
private Provider<PluginListPanel> pluginListPanelProvider;
@Inject
private ConfigManager configManager;
@Inject
private PluginManager pluginManager;
@Inject
private ScheduledExecutorService executorService;
@Inject
private RuneLiteConfig runeLiteConfig;
@Inject
private OpenOSRSConfig OpenOSRSConfig;
private OpenOSRSConfig openOSRSConfig;
@Inject
private ChatColorConfig chatColorConfig;
@Inject
private ColorPickerManager colorPickerManager;
private PluginListPanel pluginListPanel;
private ConfigPanel configPanel;
private NavigationButton navButton;
@Override
protected void startUp()
protected void startUp() throws Exception
{
configPanel = new ConfigPanel(pluginManager, configManager, executorService, runeLiteConfig, OpenOSRSConfig, chatColorConfig, colorPickerManager);
pluginListPanel = pluginListPanelProvider.get();
pluginListPanel.addFakePlugin(
new PluginConfigurationDescriptor(
"OpenOSRS", "OpenOSRS client settings", PluginType.IMPORTANT, new String[]{"client"},
null, openOSRSConfig, configManager.getConfigDescriptor(openOSRSConfig)
),
new PluginConfigurationDescriptor(
"RuneLite", "RuneLite client settings", PluginType.IMPORTANT, new String[]{"client"},
null, runeLiteConfig, configManager.getConfigDescriptor(runeLiteConfig)
),
new PluginConfigurationDescriptor(
"Chat Color", "Recolor chat text", PluginType.MISCELLANEOUS, new String[]{"colour", "messages"},
null, chatColorConfig, configManager.getConfigDescriptor(chatColorConfig)
));
pluginListPanel.rebuildPluginList();
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(getClass(), "config_icon.png");
@@ -99,42 +98,20 @@ public class ConfigPlugin extends Plugin
.tooltip("Configuration")
.icon(icon)
.priority(0)
.panel(configPanel)
.panel(pluginListPanel.getMuxer())
.build();
clientToolbar.addNavigation(navButton);
}
@Override
public void shutDown()
protected void shutDown() throws Exception
{
clientToolbar.removeNavigation(navButton);
RuneLite.getInjector().getInstance(ClientThread.class).invokeLater(() ->
{
try
{
ConfigPanel.pluginList.clear();
pluginManager.setPluginEnabled(this, true);
pluginManager.startPlugin(this);
Method expand = ClientUI.class.getDeclaredMethod("expand", NavigationButton.class);
expand.setAccessible(true);
expand.invoke(RuneLite.getInjector().getInstance(ClientUI.class), navButton);
}
catch (Exception e)
{
System.out.println(e.getMessage());
}
});
}
@Subscribe
private void onPluginChanged(PluginChanged event)
{
SwingUtilities.invokeLater(configPanel::refreshPluginList);
}
@Subscribe
private void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked)
public void onOverlayMenuClicked(OverlayMenuClicked overlayMenuClicked)
{
OverlayMenuEntry overlayMenuEntry = overlayMenuClicked.getEntry();
if (overlayMenuEntry.getMenuOpcode() == MenuOpcode.RUNELITE_OVERLAY_CONFIG)
@@ -154,8 +131,8 @@ public class ConfigPlugin extends Plugin
{
navButton.getOnSelect().run();
}
configPanel.openConfigurationPanel(descriptor.name());
pluginListPanel.openConfigurationPanel(descriptor.name());
});
}
}
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, Adam <Adam@sigterm.info>
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,14 +22,18 @@
* (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.chat;
package net.runelite.client.plugins.config;
import net.runelite.client.events.ChatboxInput;
import net.runelite.client.events.PrivateMessageInput;
import java.awt.Dimension;
import javax.swing.JPanel;
import net.runelite.client.ui.PluginPanel;
public interface ChatboxInputListener
class FixedWidthPanel extends JPanel
{
boolean onChatboxInput(ChatboxInput chatboxInput);
@Override
public Dimension getPreferredSize()
{
return new Dimension(PluginPanel.PANEL_WIDTH, super.getPreferredSize().height);
}
boolean onPrivateMessageInput(PrivateMessageInput privateMessageInput);
}

View File

@@ -0,0 +1,57 @@
/*
* 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.client.plugins.config;
import javax.annotation.Nullable;
import lombok.Value;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigDescriptor;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginType;
@Value
public class PluginConfigurationDescriptor
{
private final String name;
private final String description;
private final PluginType pluginType;
private final String[] tags;
// Can be null if its not an actual plugin (RuneLite / ChatColors)
@Nullable
private final Plugin plugin;
// Can be null if it has no more configuration than the on/off toggle
@Nullable
private final Config config;
@Nullable
private final ConfigDescriptor configDescriptor;
boolean hasConfigurables()
{
return configDescriptor != null && !configDescriptor.getItems().stream().allMatch(item -> item.getItem().hidden());
}
}

View File

@@ -28,232 +28,159 @@ import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.annotation.Nullable;
import javax.inject.Singleton;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import lombok.AccessLevel;
import javax.swing.JToggleButton;
import lombok.Getter;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigDescriptor;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.PluginPanel;
import net.runelite.client.ui.components.IconButton;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.SwingUtil;
import org.apache.commons.text.similarity.JaroWinklerDistance;
@Singleton
public class PluginListItem extends JPanel
{
private static final JaroWinklerDistance DISTANCE = new JaroWinklerDistance();
public JLabel nameLabel;
private static final ImageIcon CONFIG_ICON;
private static final ImageIcon CONFIG_ICON_HOVER;
private static final ImageIcon ON_SWITCHER;
public static final ImageIcon OFF_SWITCHER;
private static final ImageIcon ON_STAR;
private static final ImageIcon OFF_STAR;
private final ConfigPanel configPanel;
private final PluginListPanel pluginListPanel;
@Getter(AccessLevel.PACKAGE)
@Nullable
private final Plugin plugin;
@Nullable
@Getter(AccessLevel.PACKAGE)
private final Config config;
@Nullable
@Getter(AccessLevel.PACKAGE)
public final ConfigDescriptor configDescriptor;
@Getter(AccessLevel.PUBLIC)
private final String name;
@Getter(AccessLevel.PUBLIC)
private final String description;
@Getter(AccessLevel.PUBLIC)
private final PluginType pluginType;
@Getter
private final PluginConfigurationDescriptor pluginConfig;
private final List<String> keywords = new ArrayList<>();
private final IconButton pinButton = new IconButton(OFF_STAR);
private final IconButton configButton = new IconButton(CONFIG_ICON, CONFIG_ICON_HOVER);
private final IconButton toggleButton = new IconButton(OFF_SWITCHER);
@Getter(AccessLevel.PACKAGE)
private boolean isPluginEnabled = false;
@Getter(AccessLevel.PACKAGE)
private boolean isPinned = false;
@Getter(AccessLevel.PACKAGE)
private boolean isHidden = false;
public JLabel nameLabel;
private final JToggleButton pinButton;
private final JToggleButton onOffToggle;
private Color color = null;
static
{
BufferedImage configIcon = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "config_edit_icon.png");
BufferedImage onSwitcher = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "switcher_on.png");
BufferedImage onStar = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "star_on.png");
CONFIG_ICON = new ImageIcon(configIcon);
ON_SWITCHER = new ImageIcon(ImageUtil.recolorImage(onSwitcher, ColorScheme.BRAND_BLUE));
ON_STAR = new ImageIcon(ImageUtil.recolorImage(onStar, ColorScheme.BRAND_BLUE));
CONFIG_ICON_HOVER = new ImageIcon(ImageUtil.grayscaleOffset(configIcon, -100));
BufferedImage offSwitcherImage = ImageUtil.flipImage(
ImageUtil.grayscaleOffset(
ImageUtil.grayscaleImage(onSwitcher),
0.61f
),
true,
false
);
OFF_SWITCHER = new ImageIcon(offSwitcherImage);
BufferedImage offStar = ImageUtil.grayscaleOffset(
CONFIG_ICON_HOVER = new ImageIcon(ImageUtil.luminanceOffset(configIcon, -100));
BufferedImage offStar = ImageUtil.luminanceScale(
ImageUtil.grayscaleImage(onStar),
0.77f
);
OFF_STAR = new ImageIcon(offStar);
}
/**
* Creates a new {@code PluginListItem} for a plugin.
* <p>
* Note that {@code config} and {@code configDescriptor} can be {@code null}
* if there is no configuration associated with the plugin.
*/
PluginListItem(ConfigPanel configPanel, ConfigManager configManager, Plugin plugin, PluginDescriptor descriptor,
@Nullable Config config, @Nullable ConfigDescriptor configDescriptor)
PluginListItem(PluginListPanel pluginListPanel, PluginConfigurationDescriptor pluginConfig)
{
this(configPanel, configManager, plugin, config, configDescriptor,
descriptor.name(), descriptor.description(), descriptor.type(), descriptor.tags());
}
this.pluginListPanel = pluginListPanel;
this.pluginConfig = pluginConfig;
/**
* Creates a new {@code PluginListItem} for a core configuration.
*/
PluginListItem(ConfigPanel configPanel, ConfigManager configManager, Config config, ConfigDescriptor configDescriptor,
String name, String description, PluginType pluginType, String... tags)
{
this(configPanel, configManager, null, config, configDescriptor, name, description, pluginType, tags);
}
private PluginListItem(ConfigPanel configPanel, ConfigManager configManager, @Nullable Plugin plugin, @Nullable Config config,
@Nullable ConfigDescriptor configDescriptor, String name, String description, PluginType pluginType, String... tags)
{
this.configPanel = configPanel;
this.plugin = plugin;
this.config = config;
this.configDescriptor = configDescriptor;
this.name = name;
this.description = description;
this.pluginType = pluginType;
Collections.addAll(keywords, name.toLowerCase().split(" "));
Collections.addAll(keywords, description.toLowerCase().split(" "));
Collections.addAll(keywords, tags);
Collections.addAll(keywords, pluginConfig.getName().toLowerCase().split(" "));
Collections.addAll(keywords, pluginConfig.getDescription().toLowerCase().split(" "));
Collections.addAll(keywords, pluginConfig.getTags());
setLayout(new BorderLayout(3, 0));
setPreferredSize(new Dimension(PluginPanel.PANEL_WIDTH, 20));
nameLabel = new JLabel(name);
nameLabel = new JLabel(pluginConfig.getName());
nameLabel.setForeground(Color.WHITE);
if (!description.isEmpty())
if (!pluginConfig.getDescription().isEmpty())
{
nameLabel.setToolTipText("<html>" + name + ":<br>" + description + "</html>");
nameLabel.setToolTipText("<html>" + pluginConfig.getName() + ":<br>" + pluginConfig.getDescription() + "</html>");
}
add(nameLabel, BorderLayout.CENTER);
pinButton = new JToggleButton(OFF_STAR);
pinButton.setSelectedIcon(ON_STAR);
SwingUtil.removeButtonDecorations(pinButton);
SwingUtil.addModalTooltip(pinButton, "Unpin plugin", "Pin plugin");
pinButton.setPreferredSize(new Dimension(21, 0));
add(pinButton, BorderLayout.LINE_START);
pinButton.addActionListener(e ->
{
setPinned(!isPinned);
configPanel.savePinnedPlugins();
configPanel.openConfigList();
pluginListPanel.savePinnedPlugins();
pluginListPanel.refresh();
});
final JPanel buttonPanel = new JPanel();
buttonPanel.setLayout(new GridLayout(1, 2));
add(buttonPanel, BorderLayout.LINE_END);
configButton.setPreferredSize(new Dimension(25, 0));
configButton.setVisible(false);
buttonPanel.add(configButton);
// add a listener to configButton only if there are config items to show
if (configDescriptor != null && config != null && !configDescriptor.getItems().stream().allMatch(item -> item.getItem().hidden()))
if (pluginConfig.hasConfigurables())
{
JButton configButton = new JButton(CONFIG_ICON);
configButton.setRolloverIcon(CONFIG_ICON_HOVER);
SwingUtil.removeButtonDecorations(configButton);
configButton.setPreferredSize(new Dimension(25, 0));
configButton.setVisible(false);
buttonPanel.add(configButton);
configButton.addActionListener(e ->
{
configButton.setIcon(CONFIG_ICON);
configPanel.openGroupConfigPanel(PluginListItem.this, config, configDescriptor);
openGroupConfigPanel();
});
configButton.setVisible(true);
configButton.setToolTipText("Edit plugin configuration");
}
toggleButton.setPreferredSize(new Dimension(25, 0));
attachToggleButtonListener(toggleButton);
addLabelMouseOver(nameLabel);
add(nameLabel, BorderLayout.CENTER);
buttonPanel.add(toggleButton);
}
void attachToggleButtonListener(IconButton button)
{
// no need for a listener if there is no plugin to enable / disable
if (plugin == null)
onOffToggle = new PluginToggleButton();
buttonPanel.add(onOffToggle);
if (pluginConfig.getPlugin() != null)
{
button.setVisible(false);
return;
onOffToggle.addItemListener(i ->
{
if (onOffToggle.isSelected())
{
pluginListPanel.startPlugin(pluginConfig.getPlugin());
}
else
{
pluginListPanel.stopPlugin(pluginConfig.getPlugin());
}
});
}
button.addActionListener(e ->
else
{
if (isPluginEnabled)
{
configPanel.stopPlugin(plugin, PluginListItem.this);
}
else
{
configPanel.startPlugin(plugin, PluginListItem.this);
}
setPluginEnabled(!isPluginEnabled);
updateToggleButton(button);
});
onOffToggle.setVisible(false);
}
}
void setPluginEnabled(boolean enabled)
boolean isPinned()
{
isPluginEnabled = enabled;
updateToggleButton(toggleButton);
return pinButton.isSelected();
}
void setPinned(boolean pinned)
{
isPinned = pinned;
pinButton.setIcon(pinned ? ON_STAR : OFF_STAR);
pinButton.setToolTipText(pinned ? "Unpin plugin" : "Pin plugin");
pinButton.setSelected(pinned);
}
Color getColor()
public PluginType getPluginType()
{
return pluginConfig.getPluginType();
}
public Color getColor()
{
return this.color == null ? Color.WHITE : this.color;
}
@@ -269,15 +196,9 @@ public class PluginListItem extends JPanel
this.nameLabel.setForeground(color);
}
public void setHidden(boolean hidden)
void setPluginEnabled(boolean enabled)
{
isHidden = hidden;
}
void updateToggleButton(IconButton button)
{
button.setIcon(isPluginEnabled ? ON_SWITCHER : OFF_SWITCHER);
button.setToolTipText(isPluginEnabled ? "Disable plugin" : "Enable plugin");
onOffToggle.setSelected(enabled);
}
/**
@@ -297,4 +218,37 @@ public class PluginListItem extends JPanel
}
return true;
}
private void openGroupConfigPanel()
{
pluginListPanel.openConfigurationPanel(pluginConfig);
}
/**
* Adds a mouseover effect to change the text of the passed label to {@link ColorScheme#BRAND_BLUE} color
*
* @param label The label to attach the mouseover and click effects to
*/
static void addLabelMouseOver(final JLabel label)
{
final Color labelForeground = label.getForeground();
label.addMouseListener(new MouseAdapter()
{
private Color lastForeground;
@Override
public void mouseEntered(MouseEvent mouseEvent)
{
lastForeground = label.getForeground();
label.setForeground(ColorScheme.BRAND_BLUE);
}
@Override
public void mouseExited(MouseEvent mouseEvent)
{
label.setForeground(lastForeground);
}
});
}
}

View File

@@ -0,0 +1,653 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.config;
import com.google.common.collect.ImmutableList;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Insets;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.inject.Inject;
import javax.inject.Provider;
import javax.inject.Singleton;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JToggleButton;
import javax.swing.ScrollPaneConstants;
import javax.swing.SwingUtilities;
import javax.swing.border.EmptyBorder;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.util.Text;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigDescriptor;
import net.runelite.client.config.ConfigGroup;
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.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.PluginChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginInstantiationException;
import net.runelite.client.plugins.PluginManager;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.DynamicGridLayout;
import net.runelite.client.ui.FontManager;
import net.runelite.client.ui.MultiplexingPluginPanel;
import net.runelite.client.ui.PluginPanel;
import net.runelite.client.ui.components.IconTextField;
import net.runelite.client.ui.components.MinimumSizedPanel;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.SwingUtil;
@Slf4j
@Singleton
public class PluginListPanel extends PluginPanel
{
private static final int OFFSET = 6;
private static final ImageIcon SECTION_EXPAND_ICON;
private static final ImageIcon SECTION_EXPAND_ICON_HOVER;
private static final ImageIcon SECTION_RETRACT_ICON;
private static final ImageIcon SECTION_RETRACT_ICON_HOVER;
private static final String RUNELITE_GROUP_NAME = RuneLiteConfig.class.getAnnotation(ConfigGroup.class).value();
private static final String PINNED_PLUGINS_CONFIG_KEY = "pinnedPlugins";
private static final List<String> colorOptions = Arrays.asList("enabledColors", "pvmColor", "pvpColor", "skillingColor", "utilityColor", "minigameColor", "miscellaneousColor", "gamemodeColor");
private static final ImmutableList<PluginType> definedOrder = ImmutableList.of(PluginType.IMPORTANT, PluginType.PVM, PluginType.SKILLING, PluginType.PVP, PluginType.UTILITY, PluginType.MINIGAME, PluginType.MISCELLANEOUS, PluginType.GAMEMODE, PluginType.EXTERNAL, PluginType.UNCATEGORIZED);
private static final Comparator<PluginListItem> categoryComparator = Comparator.comparing(plugin -> definedOrder.indexOf(plugin.getPluginType()));
private final ConfigManager configManager;
private final PluginManager pluginManager;
private final ScheduledExecutorService executorService;
private final Provider<ConfigPanel> configPanelProvider;
private final OpenOSRSConfig openOSRSConfig;
private final List<PluginConfigurationDescriptor> fakePlugins = new ArrayList<>();
@Getter
private final MultiplexingPluginPanel muxer;
private final IconTextField searchBar;
private final JScrollPane scrollPane;
private final FixedWidthPanel mainPanel;
private final Set<JPanel> sectionsCopy = new HashSet<>();
public static List<PluginListItem> pluginList;
static
{
final BufferedImage backIcon = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "config_back_icon.png");
final BufferedImage orangeBackIcon = ImageUtil.fillImage(backIcon, ColorScheme.BRAND_BLUE);
final BufferedImage sectionRetractIcon = ImageUtil.rotateImage(orangeBackIcon, Math.PI * 1.5);
SECTION_RETRACT_ICON = new ImageIcon(sectionRetractIcon);
SECTION_RETRACT_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(sectionRetractIcon, -100));
final BufferedImage sectionExpandIcon = ImageUtil.rotateImage(orangeBackIcon, Math.PI);
SECTION_EXPAND_ICON = new ImageIcon(sectionExpandIcon);
SECTION_EXPAND_ICON_HOVER = new ImageIcon(ImageUtil.alphaOffset(sectionExpandIcon, -100));
}
@Inject
public PluginListPanel(
ConfigManager configManager,
PluginManager pluginManager,
ScheduledExecutorService executorService,
Provider<ConfigPanel> configPanelProvider,
OpenOSRSConfig openOSRSConfig,
EventBus eventBus)
{
super(false);
this.configManager = configManager;
this.pluginManager = pluginManager;
this.executorService = executorService;
this.configPanelProvider = configPanelProvider;
this.openOSRSConfig = openOSRSConfig;
eventBus.subscribe(ConfigChanged.class, this, ev -> {
if (!ev.getGroup().equals("openosrs"))
{
return;
}
if (ev.getKey().equals("enableCategories") || ev.getKey().equals("pluginSortMode"))
{
rebuildPluginList();
}
if (ev.getKey().equals("pluginSortMode"))
{
sortPluginList(null);
}
if (colorOptions.stream().anyMatch(option -> option.equals(ev.getKey())))
{
pluginList.forEach(listItem ->
{
if (listItem.getPluginType() == PluginType.IMPORTANT)
{
return;
}
listItem.setColor(getColorByCategory(listItem.getPluginType()));
});
}
});
muxer = new MultiplexingPluginPanel(this);
searchBar = new IconTextField();
searchBar.setIcon(IconTextField.Icon.SEARCH);
searchBar.setPreferredSize(new Dimension(PluginPanel.PANEL_WIDTH - 20, 30));
searchBar.setBackground(ColorScheme.DARKER_GRAY_COLOR);
searchBar.setHoverBackgroundColor(ColorScheme.DARK_GRAY_HOVER_COLOR);
searchBar.getDocument().addDocumentListener(new DocumentListener()
{
@Override
public void insertUpdate(DocumentEvent e)
{
onSearchBarChanged();
}
@Override
public void removeUpdate(DocumentEvent e)
{
onSearchBarChanged();
}
@Override
public void changedUpdate(DocumentEvent e)
{
onSearchBarChanged();
}
});
setLayout(new BorderLayout());
setBackground(ColorScheme.DARK_GRAY_COLOR);
JPanel topPanel = new JPanel();
topPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
topPanel.setLayout(new BorderLayout(0, BORDER_OFFSET));
topPanel.add(searchBar, BorderLayout.CENTER);
add(topPanel, BorderLayout.NORTH);
mainPanel = new FixedWidthPanel();
mainPanel.setBorder(new EmptyBorder(8, 10, 10, 10));
mainPanel.setLayout(new DynamicGridLayout(0, 1, 0, 5));
mainPanel.setAlignmentX(Component.LEFT_ALIGNMENT);
JPanel northPanel = new FixedWidthPanel();
northPanel.setLayout(new BorderLayout());
northPanel.add(mainPanel, BorderLayout.NORTH);
scrollPane = new JScrollPane(northPanel);
scrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER);
add(scrollPane, BorderLayout.CENTER);
}
void rebuildPluginList()
{
final List<String> pinnedPlugins = getPinnedPluginNames();
// populate pluginList with all non-hidden plugins
pluginList = Stream.concat(
fakePlugins.stream(),
pluginManager.getPlugins().stream()
.filter(plugin -> !plugin.getClass().getAnnotation(PluginDescriptor.class).hidden())
.map(plugin ->
{
PluginDescriptor descriptor = plugin.getClass().getAnnotation(PluginDescriptor.class);
Config config = pluginManager.getPluginConfigProxy(plugin);
ConfigDescriptor configDescriptor = config == null ? null : configManager.getConfigDescriptor(config);
return new PluginConfigurationDescriptor(
descriptor.name(),
descriptor.description(),
descriptor.type(),
descriptor.tags(),
plugin,
config,
configDescriptor);
})
).map(desc ->
{
PluginListItem listItem = new PluginListItem(this, desc);
listItem.setPinned(pinnedPlugins.contains(desc.getName()));
listItem.setColor(getColorByCategory(listItem.getPluginType()));
return listItem;
}).collect(Collectors.toList());
sortPluginList(null);
mainPanel.removeAll();
refresh();
}
void addFakePlugin(PluginConfigurationDescriptor... descriptor)
{
Collections.addAll(fakePlugins, descriptor);
}
void refresh()
{
// update enabled / disabled status of all items
pluginList.forEach(listItem ->
{
final Plugin plugin = listItem.getPluginConfig().getPlugin();
if (plugin != null)
{
listItem.setPluginEnabled(pluginManager.isPluginEnabled(plugin));
}
});
int scrollBarPosition = scrollPane.getVerticalScrollBar().getValue();
onSearchBarChanged();
searchBar.requestFocusInWindow();
validate();
scrollPane.getVerticalScrollBar().setValue(scrollBarPosition);
}
private void onSearchBarChanged()
{
final String text = searchBar.getText();
pluginList.forEach(mainPanel::remove);
sectionsCopy.forEach(mainPanel::remove);
sectionsCopy.clear();
showMatchingPlugins(true, text);
showMatchingPlugins(false, text);
revalidate();
}
private void generatePluginList(List<PluginListItem> pluginListItems)
{
final Map<String, JPanel> sections = new HashMap<>();
for (PluginListItem pluginListItem : pluginListItems)
{
if (pluginListItem.isPinned())
{
if (!sections.containsKey("Pinned"))
{
sections.put("Pinned", addSection("Pinned"));
}
sections.get("Pinned").add(pluginListItem);
continue;
}
String sectionName = pluginListItem.getPluginConfig().getPluginType().getName();
if (!sections.containsKey(sectionName))
{
sections.put(sectionName, addSection(sectionName));
}
sections.get(sectionName).add(pluginListItem);
}
sections.forEach((key, value) ->
{
Container parent = value.getParent();
JToggleButton collapseButton = (JToggleButton) ((JPanel) parent.getComponent(0)).getComponent(0);
if (searchBar.getText().equals(""))
{
resetSection(key, collapseButton, value);
}
else
{
forceExpandSection(collapseButton, value);
}
});
}
private void showMatchingPlugins(boolean pinned, String text)
{
final List<PluginListItem> plugins = new ArrayList<>();
if (text.isEmpty())
{
if (openOSRSConfig.pluginSortMode() == net.runelite.client.config.OpenOSRSConfig.SortStyle.ALPHABETICALLY || !openOSRSConfig.enableCategories())
{
pluginList.stream().filter(item -> pinned == item.isPinned()).forEach(mainPanel::add);
}
else
{
pluginList.stream().filter(item -> pinned == item.isPinned()).forEach(plugins::add);
}
}
else
{
final String[] searchTerms = text.toLowerCase().split(" ");
pluginList.forEach(listItem ->
{
if (pinned == listItem.isPinned() && listItem.matchesSearchTerms(searchTerms))
{
if (openOSRSConfig.pluginSortMode() == net.runelite.client.config.OpenOSRSConfig.SortStyle.ALPHABETICALLY || !openOSRSConfig.enableCategories())
{
mainPanel.add(listItem);
}
else
{
plugins.add(listItem);
}
}
});
}
if (openOSRSConfig.pluginSortMode() == net.runelite.client.config.OpenOSRSConfig.SortStyle.CATEGORY && openOSRSConfig.enableCategories())
{
generatePluginList(plugins);
}
}
void openConfigurationPanel(String configGroup)
{
for (PluginListItem pluginListItem : pluginList)
{
if (pluginListItem.getPluginConfig().getName().equals(configGroup))
{
openConfigurationPanel(pluginListItem.getPluginConfig());
break;
}
}
}
void openConfigurationPanel(PluginConfigurationDescriptor plugin)
{
ConfigPanel panel = configPanelProvider.get();
panel.init(plugin);
muxer.pushState(panel);
}
void startPlugin(Plugin plugin)
{
executorService.submit(() ->
{
pluginManager.setPluginEnabled(plugin, true);
try
{
pluginManager.startPlugin(plugin);
}
catch (PluginInstantiationException ex)
{
log.warn("Error when starting plugin {}", plugin.getClass().getSimpleName(), ex);
}
});
}
void stopPlugin(Plugin plugin)
{
executorService.submit(() ->
{
pluginManager.setPluginEnabled(plugin, false);
try
{
pluginManager.stopPlugin(plugin);
}
catch (PluginInstantiationException ex)
{
log.warn("Error when stopping plugin {}", plugin.getClass().getSimpleName(), ex);
}
});
}
private List<String> getPinnedPluginNames()
{
final String config = configManager.getConfiguration(RUNELITE_GROUP_NAME, PINNED_PLUGINS_CONFIG_KEY);
if (config == null)
{
return Collections.emptyList();
}
return Text.fromCSV(config);
}
void savePinnedPlugins()
{
final String value = pluginList.stream()
.filter(PluginListItem::isPinned)
.map(p -> p.getPluginConfig().getName())
.collect(Collectors.joining(","));
configManager.setConfiguration(RUNELITE_GROUP_NAME, PINNED_PLUGINS_CONFIG_KEY, value);
}
@Subscribe
public void onPluginChanged(PluginChanged event)
{
SwingUtilities.invokeLater(this::refresh);
}
@Override
public Dimension getPreferredSize()
{
return new Dimension(PANEL_WIDTH + SCROLLBAR_WIDTH, super.getPreferredSize().height);
}
@Override
public void onActivate()
{
super.onActivate();
if (searchBar.getParent() != null)
{
searchBar.requestFocusInWindow();
}
}
private JPanel addSection(String name)
{
final MinimumSizedPanel section = new MinimumSizedPanel();
section.setLayout(new BoxLayout(section, BoxLayout.Y_AXIS));
section.setMinimumSize(new Dimension(PANEL_WIDTH, 0));
JPanel item = new JPanel();
item.setLayout(new BorderLayout());
item.setMinimumSize(new Dimension(PANEL_WIDTH, 0));
JLabel headerLabel = new JLabel(name);
headerLabel.setFont(FontManager.getRunescapeFont());
headerLabel.setForeground(ColorScheme.BRAND_BLUE);
headerLabel.setPreferredSize(new Dimension(PANEL_WIDTH, (int) headerLabel.getPreferredSize().getHeight()));
final boolean state = Boolean.parseBoolean(configManager.getConfiguration("pluginlist", name));
final JToggleButton collapse = new JToggleButton(SECTION_EXPAND_ICON, state);
SwingUtil.removeButtonDecorations(collapse);
collapse.setRolloverIcon(SECTION_EXPAND_ICON_HOVER);
collapse.setSelectedIcon(SECTION_RETRACT_ICON);
collapse.setRolloverSelectedIcon(SECTION_RETRACT_ICON_HOVER);
collapse.setToolTipText(state ? "Retract" : "Expand");
collapse.setPreferredSize(new Dimension(20, 20));
collapse.setFont(collapse.getFont().deriveFont(16.0f));
collapse.setBorder(null);
collapse.setMargin(new Insets(0, 0, 0, 0));
headerLabel.setBorder(new EmptyBorder(0, 10, 0, 0));
item.add(collapse, BorderLayout.WEST);
item.add(headerLabel, BorderLayout.CENTER);
final JPanel sectionContents = new JPanel();
sectionContents.setLayout(new DynamicGridLayout(0, 1, 0, 5));
sectionContents.setMinimumSize(new Dimension(PANEL_WIDTH, 0));
sectionContents.setBorder(new EmptyBorder(OFFSET, 5, 0, 0));
section.add(item, BorderLayout.NORTH);
section.add(sectionContents, BorderLayout.SOUTH);
sectionContents.setVisible(state);
// Add listeners to each part of the header so that it's easier to toggle them
final MouseAdapter adapter = new MouseAdapter()
{
@Override
public void mouseClicked(MouseEvent e)
{
toggleSection(name, collapse, sectionContents);
}
};
collapse.addActionListener(e -> toggleSection(name, collapse, sectionContents));
headerLabel.addMouseListener(adapter);
// Allow for sub-sections
mainPanel.add(section);
sectionsCopy.add(section);
return sectionContents;
}
private void toggleSection(String key, JToggleButton button, JPanel contents)
{
if (!button.isEnabled())
{
return;
}
boolean newState = !contents.isVisible();
button.setSelected(newState);
button.setToolTipText(newState ? "Retract" : "Expand");
contents.setVisible(newState);
configManager.setConfiguration("pluginlist", key, newState);
SwingUtilities.invokeLater(() ->
{
contents.revalidate();
contents.repaint();
});
}
private void forceExpandSection(JToggleButton button, JPanel contents)
{
button.setSelected(true);
button.setToolTipText(null);
button.setEnabled(false);
contents.setVisible(true);
SwingUtilities.invokeLater(() ->
{
contents.revalidate();
contents.repaint();
});
}
private void resetSection(String key, JToggleButton button, JPanel contents)
{
boolean newState = Boolean.parseBoolean(configManager.getConfiguration("pluginlist", key));
button.setSelected(newState);
button.setToolTipText(newState ? "Retract" : "Expand");
contents.setVisible(newState);
SwingUtilities.invokeLater(() ->
{
contents.revalidate();
contents.repaint();
});
}
private Color getColorByCategory(PluginType pluginType)
{
if (!openOSRSConfig.enabledColors())
{
return Color.LIGHT_GRAY;
}
switch (pluginType)
{
case EXTERNAL:
return openOSRSConfig.externalColor();
case PVM:
return openOSRSConfig.pvmColor();
case PVP:
return openOSRSConfig.pvpColor();
case SKILLING:
return openOSRSConfig.skillingColor();
case UTILITY:
return openOSRSConfig.utilityColor();
case MISCELLANEOUS:
return openOSRSConfig.miscellaneousColor();
case MINIGAME:
return openOSRSConfig.minigameColor();
case GAMEMODE:
return openOSRSConfig.gamemodeColor();
case IMPORTANT:
return Color.WHITE;
}
return Color.LIGHT_GRAY;
}
public void sortPluginList(Comparator<PluginListItem> comparator)
{
if (comparator != null)
{
pluginList.sort(comparator.thenComparing(ev -> ev.getPluginConfig().getName()));
return;
}
if (openOSRSConfig.pluginSortMode() == net.runelite.client.config.OpenOSRSConfig.SortStyle.CATEGORY)
{
pluginList.sort(categoryComparator.thenComparing(ev -> ev.getPluginConfig().getName()));
}
else
{
pluginList.sort(Comparator.comparing(ev -> ev.getPluginConfig().getName()));
}
}
}

View File

@@ -0,0 +1,63 @@
/*
* 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.client.plugins.config;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import javax.swing.ImageIcon;
import javax.swing.JToggleButton;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.SwingUtil;
class PluginToggleButton extends JToggleButton
{
private static final ImageIcon ON_SWITCHER;
private static final ImageIcon OFF_SWITCHER;
static
{
BufferedImage onSwitcher = ImageUtil.getResourceStreamFromClass(ConfigPanel.class, "switcher_on.png");
ON_SWITCHER = new ImageIcon(ImageUtil.recolorImage(onSwitcher, ColorScheme.BRAND_BLUE));
OFF_SWITCHER = new ImageIcon(ImageUtil.flipImage(
ImageUtil.luminanceScale(
ImageUtil.grayscaleImage(onSwitcher),
0.61f
),
true,
false
));
}
public PluginToggleButton()
{
super(OFF_SWITCHER);
setSelectedIcon(ON_SWITCHER);
SwingUtil.removeButtonDecorations(this);
setPreferredSize(new Dimension(25, 0));
SwingUtil.addModalTooltip(this, "Disable plugin", "Enable plugin");
}
}

View File

@@ -51,6 +51,7 @@ import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDependency;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.plugins.xptracker.XpTrackerPlugin;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
@@ -59,7 +60,8 @@ import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@PluginDescriptor(
name = "Cooking",
description = "Show cooking statistics",
tags = {"overlay", "skilling", "cook"}
tags = {"overlay", "skilling", "cook"},
type = PluginType.SKILLING
)
@Singleton
@PluginDependency(XpTrackerPlugin.class)

View File

@@ -55,12 +55,14 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Corporeal Beast",
description = "Show damage statistics and highlight dark energy cores",
tags = {"bosses", "combat", "pve", "overlay"}
tags = {"bosses", "combat", "pve", "overlay"},
type = PluginType.PVM
)
@Slf4j
public class CorpPlugin extends Plugin

View File

@@ -37,6 +37,7 @@ import net.runelite.api.events.GameTick;
import net.runelite.client.eventbus.EventBus;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.http.api.RuneLiteAPI;
import okhttp3.Call;
import okhttp3.Callback;
@@ -50,7 +51,8 @@ import org.jetbrains.annotations.NotNull;
name = "Crystal Math Labs",
description = "Automatically updates your stats on Crystal Math Labs when you log out",
tags = {"cml", "external", "integration"},
enabledByDefault = false
enabledByDefault = false,
type = PluginType.MISCELLANEOUS
)
@Slf4j
@Singleton

View File

@@ -31,7 +31,7 @@ import net.runelite.client.util.ImageUtil;
name = "Custom Client Resizing",
description = "Resize the window to saved profiles",
tags = {"resize", "window", "position", "layout", "manage"},
type = PluginType.UTILITY,
type = PluginType.MISCELLANEOUS,
enabledByDefault = false
)
public class CustomClientResizingPlugin extends Plugin

View File

@@ -40,13 +40,15 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.ClientUI;
@Slf4j
@PluginDescriptor(
name = "Custom Cursor",
description = "Replaces your mouse cursor image",
enabledByDefault = false
enabledByDefault = false,
type = PluginType.MISCELLANEOUS
)
@Singleton
public class CustomCursorPlugin extends Plugin

View File

@@ -47,10 +47,12 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
@PluginDescriptor(
name = "Daily Task Indicator",
description = "Show chat notifications for daily tasks upon login"
description = "Show chat notifications for daily tasks upon login",
type = PluginType.UTILITY
)
@Singleton
public class DailyTasksPlugin extends Plugin

View File

@@ -61,6 +61,7 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.ui.overlay.infobox.Timer;
import net.runelite.client.ui.overlay.worldmap.WorldMapPointManager;
@@ -69,7 +70,8 @@ import net.runelite.client.util.ImageUtil;
@PluginDescriptor(
name = "Death Indicator",
description = "Show where you last died, and on what world",
tags = {"arrow", "hints", "world", "map", "overlay"}
tags = {"arrow", "hints", "world", "map", "overlay"},
type = PluginType.UTILITY
)
@Singleton
@Slf4j

View File

@@ -37,6 +37,7 @@ import net.runelite.client.events.SessionOpen;
import net.runelite.client.game.WorldService;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.util.WorldUtil;
import net.runelite.http.api.worlds.World;
import net.runelite.http.api.worlds.WorldResult;
@@ -44,7 +45,8 @@ import net.runelite.http.api.worlds.WorldResult;
@PluginDescriptor(
name = "Default World",
description = "Enable a default world to be selected when launching the client",
tags = {"home"}
tags = {"home"},
type = PluginType.UTILITY
)
@Slf4j
@Singleton

View File

@@ -61,12 +61,14 @@ import net.runelite.client.callback.ClientThread;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Demonic Gorillas",
description = "Count demonic gorilla attacks and display their next possible attack styles",
tags = {"combat", "overlay", "pve", "pvm"}
tags = {"combat", "overlay", "pve", "pvm"},
type = PluginType.PVM
)
@Singleton
public class DemonicGorillaPlugin extends Plugin

View File

@@ -54,6 +54,7 @@ import net.runelite.client.eventbus.EventBus;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.JagexColors;
import net.runelite.client.ui.NavigationButton;
@@ -66,7 +67,8 @@ import org.slf4j.LoggerFactory;
@PluginDescriptor(
name = "Developer Tools",
tags = {"panel"},
developerPlugin = true
developerPlugin = true,
type = PluginType.MISCELLANEOUS
)
@Getter(AccessLevel.PACKAGE)
public class DevToolsPlugin extends Plugin

View File

@@ -60,6 +60,7 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.events.PartyChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.task.Schedule;
import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.NavigationButton;
@@ -81,7 +82,8 @@ import org.jetbrains.annotations.NotNull;
@PluginDescriptor(
name = "Discord",
description = "Show your status and activity in the Discord user panel",
tags = {"action", "activity", "external", "integration", "status"}
tags = {"action", "activity", "external", "integration", "status"},
type = PluginType.MISCELLANEOUS
)
@Slf4j
@Singleton

View File

@@ -53,7 +53,7 @@ import net.runelite.client.ui.overlay.OverlayManager;
name = "Drop Party",
description = "Marks where a user ran, for drop partys",
tags = {"Drop", "Party", "marker", "player"},
type = PluginType.UTILITY,
type = PluginType.MISCELLANEOUS,
enabledByDefault = false
)
@Singleton

View File

@@ -45,12 +45,14 @@ import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.util.ImageUtil;
@PluginDescriptor(
name = "Emojis",
description = "Replaces common emoticons such as :) with their corresponding emoji in the chat",
enabledByDefault = false
enabledByDefault = false,
type = PluginType.MISCELLANEOUS
)
@Slf4j
@Singleton

View File

@@ -43,12 +43,14 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
@PluginDescriptor(
name = "Entity Hider",
description = "Hide players, NPCs, and/or projectiles",
tags = {"npcs", "players", "projectiles"},
enabledByDefault = false
enabledByDefault = false,
type = PluginType.UTILITY
)
@Singleton
public class EntityHiderPlugin extends Plugin

View File

@@ -37,6 +37,7 @@ import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.ChatMessageType;
import net.runelite.api.Client;
import net.runelite.api.Constants;
import net.runelite.api.ItemDefinition;
import net.runelite.api.ItemID;
import net.runelite.api.events.ChatMessage;
@@ -58,6 +59,7 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.util.QuantityFormatter;
import net.runelite.http.api.examine.ExamineClient;
import net.runelite.http.api.osbuddy.OSBGrandExchangeClient;
@@ -70,7 +72,8 @@ import net.runelite.http.api.osbuddy.OSBGrandExchangeClient;
@PluginDescriptor(
name = "Examine",
description = "Send examine information to the API",
tags = {"npcs", "items", "inventory", "objects"}
tags = {"npcs", "items", "inventory", "objects"},
type = PluginType.UTILITY
)
@Slf4j
@Singleton
@@ -335,8 +338,8 @@ public class ExaminePlugin extends Plugin
// quantity is at least 1
quantity = Math.max(1, quantity);
int itemCompositionPrice = itemComposition.getPrice();
final int gePrice = itemManager.getItemPrice(id);
final int alchPrice = itemCompositionPrice <= 0 ? 0 : itemManager.getAlchValue(itemComposition);
final long gePrice = itemManager.getItemPrice(id);
final long alchPrice = itemCompositionPrice <= 0 ? 0 : Math.round(itemCompositionPrice * Constants.HIGH_ALCHEMY_MULTIPLIER);
if (gePrice > 0 || alchPrice > 0)
{

View File

@@ -58,13 +58,16 @@ import net.runelite.client.game.NPCManager;
import net.runelite.client.game.XpDropEvent;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ColorUtil;
@PluginDescriptor(
name = "XP Drop",
description = "Enable customization of the way XP drops are displayed",
tags = {"experience", "levels", "tick"})
tags = {"experience", "levels", "tick"},
type = PluginType.UTILITY
)
@Singleton
public class XpDropPlugin extends Plugin
{

View File

@@ -61,12 +61,14 @@ import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.game.chatbox.ChatboxTextInput;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
@Slf4j
@PluginDescriptor(
name = "Fairy Rings",
description = "Show the location of the fairy ring teleport",
tags = {"teleportation"}
tags = {"teleportation"},
type = PluginType.UTILITY
)
@Singleton
public class FairyRingPlugin extends Plugin

View File

@@ -40,6 +40,7 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.task.Schedule;
import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.NavigationButton;
@@ -51,7 +52,8 @@ import net.runelite.http.api.feed.FeedResult;
name = "News Feed",
description = "Show the latest RuneLite blog posts, OSRS news, and JMod Twitter posts",
tags = {"external", "integration", "panel", "twitter"},
loadWhenOutdated = true
loadWhenOutdated = true,
type = PluginType.MISCELLANEOUS
)
@Slf4j
@Singleton

View File

@@ -71,6 +71,7 @@ import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDependency;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.plugins.xptracker.XpTrackerPlugin;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
@@ -79,7 +80,8 @@ import net.runelite.client.util.ItemUtil;
@PluginDescriptor(
name = "Fishing",
description = "Show fishing stats and mark fishing spots",
tags = {"overlay", "skilling"}
tags = {"overlay", "skilling"},
type = PluginType.SKILLING
)
@PluginDependency(XpTrackerPlugin.class)
@Singleton

View File

@@ -33,6 +33,7 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.DrawManager;
import net.runelite.client.ui.overlay.OverlayManager;
@@ -50,7 +51,8 @@ import net.runelite.client.ui.overlay.OverlayManager;
name = "Performance",
description = "Show current FPS or set an FPS limit",
tags = {"frames", "framerate", "limit", "overlay"},
enabledByDefault = false
enabledByDefault = false,
type = PluginType.MISCELLANEOUS
)
@Singleton
public class FpsPlugin extends Plugin

View File

@@ -35,10 +35,12 @@ import net.runelite.api.widgets.WidgetInfo;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
@PluginDescriptor(
name = "Friend List",
description = "Add extra information to the friend and ignore lists"
description = "Add extra information to the friend and ignore lists",
type = PluginType.MISCELLANEOUS
)
@Singleton
public class FriendListPlugin extends Plugin

View File

@@ -50,13 +50,15 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.chatbox.ChatboxPanelManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ColorUtil;
@Slf4j
@PluginDescriptor(
name = "Friend Notes",
description = "Store notes about your friends"
description = "Store notes about your friends",
type = PluginType.MISCELLANEOUS
)
@Singleton
public class FriendNotesPlugin extends Plugin

View File

@@ -76,6 +76,7 @@ import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginInstantiationException;
import net.runelite.client.plugins.PluginManager;
import net.runelite.client.plugins.PluginType;
import static net.runelite.client.plugins.gpu.GLUtil.*;
import net.runelite.client.plugins.gpu.config.AnisotropicFilteringMode;
import net.runelite.client.plugins.gpu.config.AntiAliasingMode;
@@ -87,7 +88,8 @@ import net.runelite.client.util.OSType;
name = "GPU",
description = "Utilizes the GPU",
enabledByDefault = false,
tags = {"fog", "draw distance"}
tags = {"fog", "draw distance"},
type = PluginType.MISCELLANEOUS
)
@Slf4j
@Singleton

View File

@@ -80,6 +80,7 @@ import net.runelite.client.input.KeyManager;
import net.runelite.client.input.MouseManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.util.ImageUtil;
@@ -93,7 +94,8 @@ import net.runelite.http.api.osbuddy.OSBGrandExchangeResult;
@PluginDescriptor(
name = "Grand Exchange",
description = "Provide additional and/or easier access to Grand Exchange information",
tags = {"external", "integration", "notifications", "panel", "prices", "trade"}
tags = {"external", "integration", "notifications", "panel", "prices", "trade"},
type = PluginType.UTILITY
)
@Slf4j
@Singleton

View File

@@ -89,6 +89,7 @@ import net.runelite.client.input.KeyManager;
import net.runelite.client.input.MouseManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.plugins.grounditems.config.ItemHighlightMode;
import static net.runelite.client.plugins.grounditems.config.ItemHighlightMode.OVERLAY;
import net.runelite.client.plugins.grounditems.config.MenuHighlightMode;
@@ -105,7 +106,8 @@ import net.runelite.client.util.QuantityFormatter;
@PluginDescriptor(
name = "Ground Items",
description = "Highlight ground items and/or show price information",
tags = {"grand", "exchange", "high", "alchemy", "prices", "highlight", "overlay"}
tags = {"grand", "exchange", "high", "alchemy", "prices", "highlight", "overlay"},
type = PluginType.UTILITY
)
@Singleton
public class GroundItemsPlugin extends Plugin

View File

@@ -63,6 +63,7 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ColorUtil;
@@ -70,7 +71,8 @@ import net.runelite.client.util.ColorUtil;
@PluginDescriptor(
name = "Ground Markers",
description = "Enable marking of tiles using the Shift key",
tags = {"overlay", "tiles"}
tags = {"overlay", "tiles"},
type = PluginType.UTILITY
)
@Singleton
public class GroundMarkerPlugin extends Plugin

View File

@@ -63,12 +63,14 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Herbiboar",
description = "Highlight starting rocks, trails, and the objects to search at the end of each trail",
tags = {"herblore", "hunter", "skilling", "overlay"}
tags = {"herblore", "hunter", "skilling", "overlay"},
type = PluginType.SKILLING
)
@Singleton
public class HerbiboarPlugin extends Plugin

View File

@@ -1,6 +1,7 @@
/*
* Copyright (c) 2017, Adam <Adam@sigterm.info>
* Copyright (c) 2018, Psikoi <https://github.com/psikoi>
* Copyright (c) 2019, Bram91 <https://github.com/bram91>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -25,6 +26,7 @@
*/
package net.runelite.client.plugins.hiscore;
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableList;
import java.awt.Dimension;
@@ -37,9 +39,10 @@ import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ScheduledExecutorService;
import javax.annotation.Nullable;
import javax.inject.Inject;
@@ -66,7 +69,9 @@ import net.runelite.http.api.hiscore.HiscoreEndpoint;
import net.runelite.http.api.hiscore.HiscoreResult;
import net.runelite.http.api.hiscore.HiscoreSkill;
import static net.runelite.http.api.hiscore.HiscoreSkill.*;
import net.runelite.http.api.hiscore.HiscoreSkillType;
import net.runelite.http.api.hiscore.Skill;
import org.apache.commons.lang3.StringUtils;
@Slf4j
@Singleton
@@ -89,6 +94,27 @@ public class HiscorePanel extends PluginPanel
CONSTRUCTION, HUNTER
);
/**
* Bosses, ordered in the way they should be displayed in the panel.
*/
private static final List<HiscoreSkill> BOSSES = ImmutableList.of(
ABYSSAL_SIRE, ALCHEMICAL_HYDRA, BARROWS_CHESTS,
BRYOPHYTA, CALLISTO, CERBERUS,
CHAMBERS_OF_XERIC, CHAMBERS_OF_XERIC_CHALLENGE_MODE, CHAOS_ELEMENTAL,
CHAOS_FANATIC, COMMANDER_ZILYANA, CORPOREAL_BEAST,
DAGANNOTH_PRIME, DAGANNOTH_REX, DAGANNOTH_SUPREME,
CRAZY_ARCHAEOLOGIST, DERANGED_ARCHAEOLOGIST, GENERAL_GRAARDOR,
GIANT_MOLE, GROTESQUE_GUARDIANS, HESPORI,
KALPHITE_QUEEN, KING_BLACK_DRAGON, KRAKEN,
KREEARRA, KRIL_TSUTSAROTH, MIMIC,
OBOR, SARACHNIS, SCORPIA,
SKOTIZO, THE_GAUNTLET, THE_CORRUPTED_GAUNTLET,
THEATRE_OF_BLOOD, THERMONUCLEAR_SMOKE_DEVIL, TZKAL_ZUK,
TZTOK_JAD, VENENATIS, VETION,
VORKATH, WINTERTODT, ZALCANO,
ZULRAH
);
@Inject
ScheduledExecutorService executor;
@@ -100,7 +126,8 @@ public class HiscorePanel extends PluginPanel
private final IconTextField searchBar;
private final List<JLabel> skillLabels = new ArrayList<>();
// Not an enummap because we need null keys for combat
private final Map<HiscoreSkill, JLabel> skillLabels = new HashMap<>();
/* Container of all the selectable endpoints (ironman, deadman, etc) */
private final MaterialTabGroup tabGroup;
@@ -215,16 +242,15 @@ public class HiscorePanel extends PluginPanel
c.gridy++;
// Panel that holds skill icons
GridLayout stats = new GridLayout(8, 3);
JPanel statsPanel = new JPanel();
statsPanel.setLayout(stats);
statsPanel.setLayout(new GridLayout(8, 3));
statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
statsPanel.setBorder(new EmptyBorder(5, 0, 5, 0));
// For each skill on the ingame skill panel, create a Label and add it to the UI
for (HiscoreSkill skill : SKILLS)
{
JPanel panel = makeSkillPanel(skill);
JPanel panel = makeHiscorePanel(skill);
statsPanel.add(panel);
}
@@ -232,11 +258,11 @@ public class HiscorePanel extends PluginPanel
c.gridy++;
JPanel totalPanel = new JPanel();
totalPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
totalPanel.setLayout(new GridLayout(1, 2));
totalPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
totalPanel.add(makeSkillPanel(null)); //combat has no hiscore skill, refered to as null
totalPanel.add(makeSkillPanel(OVERALL));
totalPanel.add(makeHiscorePanel(null)); //combat has no hiscore skill, referred to as null
totalPanel.add(makeHiscorePanel(OVERALL));
add(totalPanel, c);
c.gridy++;
@@ -247,14 +273,28 @@ public class HiscorePanel extends PluginPanel
minigamePanel.setLayout(new GridLayout(2, 3));
minigamePanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
minigamePanel.add(makeSkillPanel(CLUE_SCROLL_ALL));
minigamePanel.add(makeSkillPanel(LEAGUE_POINTS));
minigamePanel.add(makeSkillPanel(LAST_MAN_STANDING));
minigamePanel.add(makeSkillPanel(BOUNTY_HUNTER_ROGUE));
minigamePanel.add(makeSkillPanel(BOUNTY_HUNTER_HUNTER));
minigamePanel.add(makeHiscorePanel(CLUE_SCROLL_ALL));
minigamePanel.add(makeHiscorePanel(LEAGUE_POINTS));
minigamePanel.add(makeHiscorePanel(LAST_MAN_STANDING));
minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_ROGUE));
minigamePanel.add(makeHiscorePanel(BOUNTY_HUNTER_HUNTER));
add(minigamePanel, c);
c.gridy++;
JPanel bossPanel = new JPanel();
bossPanel.setLayout(new GridLayout(0, 3));
bossPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
// For each boss on the hi-scores, create a Label and add it to the UI
for (HiscoreSkill skill : BOSSES)
{
JPanel panel = makeHiscorePanel(skill);
bossPanel.add(panel);
}
add(bossPanel, c);
c.gridy++;
}
@Override
@@ -265,24 +305,29 @@ public class HiscorePanel extends PluginPanel
}
/* Builds a JPanel displaying an icon and level/number associated with it */
private JPanel makeSkillPanel(HiscoreSkill skill)
private JPanel makeHiscorePanel(HiscoreSkill skill)
{
HiscoreSkillType skillType = skill == null ? HiscoreSkillType.SKILL : skill.getType();
JLabel label = new JLabel();
label.setFont(FontManager.getRunescapeSmallFont());
label.setText("--");
label.setText(pad("--", skillType));
String skillName = (skill == null ? "combat" : skill.getName().toLowerCase());
String directory = "/skill_icons";
if (skillName.equals("combat") || skillName.equals("overall"))
String directory;
if (skill == null || skill == OVERALL)
{
// Cannot use SpriteManager as HiscorePlugin loads before a Client is available
directory += "/";
directory = "/skill_icons/";
}
else if (skill.getType() == HiscoreSkillType.BOSS)
{
directory = "bosses/";
}
else
{
directory += "_small/";
directory = "/skill_icons_small/";
}
String skillName = (skill == null ? "combat" : skill.name().toLowerCase());
String skillIcon = directory + skillName + ".png";
log.debug("Loading skill icon from {}", skillIcon);
@@ -294,8 +339,8 @@ public class HiscorePanel extends PluginPanel
JPanel skillPanel = new JPanel();
skillPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
skillPanel.setBorder(new EmptyBorder(2, 0, 2, 0));
skillLabels.add(label);
skillPanel.add(skillLabels.get(skillLabels.size() - 1));
skillLabels.put(skill, label);
skillPanel.add(label);
return skillPanel;
}
@@ -330,9 +375,13 @@ public class HiscorePanel extends PluginPanel
searchBar.setIcon(IconTextField.Icon.LOADING_DARKER);
loading = true;
for (JLabel label : skillLabels)
for (Map.Entry<HiscoreSkill, JLabel> entry : skillLabels.entrySet())
{
label.setText("--");
HiscoreSkill skill = entry.getKey();
JLabel label = entry.getValue();
HiscoreSkillType skillType = skill == null ? HiscoreSkillType.SKILL : skill.getType();
label.setText(pad("--", skillType));
label.setToolTipText(null);
}
@@ -370,10 +419,10 @@ public class HiscorePanel extends PluginPanel
searchBar.setEditable(true);
loading = false;
int index = 0;
for (JLabel label : skillLabels)
for (Map.Entry<HiscoreSkill, JLabel> entry : skillLabels.entrySet())
{
HiscoreSkill skill = find(index);
HiscoreSkill skill = entry.getKey();
JLabel label = entry.getValue();
Skill s;
if (skill == null)
@@ -395,7 +444,7 @@ public class HiscorePanel extends PluginPanel
else if ((s = result.getSkill(skill)) != null)
{
final long exp = s.getExperience();
final boolean isSkill = SKILLS.contains(skill);
final boolean isSkill = skill.getType() == HiscoreSkillType.SKILL;
int level = -1;
if (plugin.isVirtualLevels() && isSkill && exp > -1L)
{
@@ -410,12 +459,11 @@ public class HiscorePanel extends PluginPanel
if (level != -1)
{
label.setText(Integer.toString(level));
label.setText(pad(formatLevel(level), skill.getType()));
}
}
label.setToolTipText(detailsHtml(result, skill));
index++;
}
}
@@ -429,37 +477,6 @@ public class HiscorePanel extends PluginPanel
this.searchBar.removeKeyListener(l);
}
/*
Returns a hiscore skill based on it's display order.
*/
private HiscoreSkill find(int index)
{
if (index < SKILLS.size())
{
return SKILLS.get(index);
}
switch (index - SKILLS.size())
{
case 0:
return null;
case 1:
return OVERALL;
case 2:
return CLUE_SCROLL_ALL;
case 3:
return LEAGUE_POINTS;
case 4:
return LAST_MAN_STANDING;
case 5:
return BOUNTY_HUNTER_ROGUE;
case 6:
return BOUNTY_HUNTER_HUNTER;
}
return null;
}
/*
Builds a html string to display on tooltip (when hovering a skill).
*/
@@ -522,26 +539,46 @@ public class HiscorePanel extends PluginPanel
}
case BOUNTY_HUNTER_ROGUE:
{
String rank = (result.getBountyHunterRogue().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getBountyHunterRogue().getRank());
Skill bountyHunterRogue = result.getBountyHunterRogue();
String rank = (bountyHunterRogue.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(bountyHunterRogue.getRank());
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
if (bountyHunterRogue.getLevel() > -1)
{
content += "<p><span style = 'color:white'>Score:</span> " + QuantityFormatter.formatNumber(bountyHunterRogue.getLevel()) + "</p>";
}
break;
}
case BOUNTY_HUNTER_HUNTER:
{
String rank = (result.getBountyHunterHunter().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getBountyHunterHunter().getRank());
Skill bountyHunterHunter = result.getBountyHunterHunter();
String rank = (bountyHunterHunter.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(bountyHunterHunter.getRank());
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
if (bountyHunterHunter.getLevel() > -1)
{
content += "<p><span style = 'color:white'>Score:</span> " + QuantityFormatter.formatNumber(bountyHunterHunter.getLevel()) + "</p>";
}
break;
}
case LAST_MAN_STANDING:
{
String rank = (result.getLastManStanding().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getLastManStanding().getRank());
Skill lastManStanding = result.getLastManStanding();
String rank = (lastManStanding.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(lastManStanding.getRank());
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
if (lastManStanding.getLevel() > -1)
{
content += "<p><span style = 'color:white'>Score:</span> " + QuantityFormatter.formatNumber(lastManStanding.getLevel()) + "</p>";
}
break;
}
case LEAGUE_POINTS:
{
String rank = (result.getLeaguePoints().getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(result.getLeaguePoints().getRank());
Skill leaguePoints = result.getLeaguePoints();
String rank = (leaguePoints.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(leaguePoints.getRank());
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
if (leaguePoints.getLevel() > -1)
{
content += "<p><span style = 'color:white'>Points:</span> " + QuantityFormatter.formatNumber(leaguePoints.getLevel()) + "</p>";
}
break;
}
case OVERALL:
@@ -556,36 +593,50 @@ public class HiscorePanel extends PluginPanel
}
default:
{
Skill requestedSkill = result.getSkill(skill);
final long experience = requestedSkill.getExperience();
String rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank());
String exp = (experience == -1L) ? "Unranked" : QuantityFormatter.formatNumber(experience);
String remainingXp;
if (experience == -1L)
if (skill.getType() == HiscoreSkillType.BOSS)
{
remainingXp = "Unranked";
Skill requestedSkill = result.getSkill(skill);
String rank = "Unranked";
String lvl = "0";
if (requestedSkill != null)
{
rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank());
lvl = (requestedSkill.getLevel() == -1 ? "0" : QuantityFormatter.formatNumber(requestedSkill.getLevel()));
}
content += "<p><span style = 'color:white'>Boss:</span> " + skill.getName() + "</p>";
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
content += "<p><span style = 'color:white'>KC:</span> " + lvl + "</p>";
}
else
{
int currentLevel = Experience.getLevelForXp((int) experience);
remainingXp = (currentLevel + 1 <= Experience.MAX_VIRT_LEVEL) ? QuantityFormatter.formatNumber(Experience.getXpForLevel(currentLevel + 1) - experience) : "0";
Skill requestedSkill = result.getSkill(skill);
final long experience = requestedSkill.getExperience();
String rank = (requestedSkill.getRank() == -1) ? "Unranked" : QuantityFormatter.formatNumber(requestedSkill.getRank());
String exp = (experience == -1L) ? "Unranked" : QuantityFormatter.formatNumber(experience);
String remainingXp;
if (experience == -1L)
{
remainingXp = "Unranked";
}
else
{
int currentLevel = Experience.getLevelForXp((int) experience);
remainingXp = (currentLevel + 1 <= Experience.MAX_VIRT_LEVEL) ? QuantityFormatter.formatNumber(Experience.getXpForLevel(currentLevel + 1) - experience) : "0";
}
content += "<p><span style = 'color:white'>Skill:</span> " + skill.getName() + "</p>";
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
content += "<p><span style = 'color:white'>Experience:</span> " + exp + "</p>";
content += "<p><span style = 'color:white'>Remaining XP:</span> " + remainingXp + "</p>";
}
content += "<p><span style = 'color:white'>Skill:</span> " + skill.getName() + "</p>";
content += "<p><span style = 'color:white'>Rank:</span> " + rank + "</p>";
content += "<p><span style = 'color:white'>Experience:</span> " + exp + "</p>";
content += "<p><span style = 'color:white'>Remaining XP:</span> " + remainingXp + "</p>";
break;
}
}
}
/**
* Adds a html progress bar to the hover information
*/
if (SKILLS.contains(skill))
// Add a html progress bar to the hover information
if (skill != null && skill.getType() == HiscoreSkillType.SKILL)
{
long experience = 0;
if (skill != null)
@@ -644,4 +695,24 @@ public class HiscorePanel extends PluginPanel
}
return HiscoreEndpoint.NORMAL;
}
@VisibleForTesting
static String formatLevel(int level)
{
if (level < 10000)
{
return Integer.toString(level);
}
else
{
return (level / 1000) + "k";
}
}
private static String pad(String str, HiscoreSkillType type)
{
// Left pad label text to keep labels aligned
int pad = type == HiscoreSkillType.BOSS ? 4 : 2;
return StringUtils.leftPad(str, pad);
}
}

View File

@@ -54,6 +54,7 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.menus.MenuManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.util.ImageUtil;
@@ -63,14 +64,15 @@ import org.apache.commons.lang3.ArrayUtils;
name = "HiScore",
description = "Enable the HiScore panel and an optional Lookup option on players",
tags = {"panel", "players"},
loadWhenOutdated = true
loadWhenOutdated = true,
type = PluginType.MISCELLANEOUS
)
@Singleton
public class HiscorePlugin extends Plugin
{
private static final String LOOKUP = "Lookup";
private static final String KICK_OPTION = "Kick";
private static final ImmutableList<String> AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", KICK_OPTION);
private static final ImmutableList<String> AFTER_OPTIONS = ImmutableList.of("Message", "Add ignore", "Remove friend", "Delete", KICK_OPTION);
private static final Pattern BOUNTY_PATTERN = Pattern.compile("<col=ff0000>You've been assigned a target: (.*)</col>");
// config
@@ -194,10 +196,11 @@ public class HiscorePlugin extends Plugin
String option = event.getOption();
if (groupId == WidgetInfo.FRIENDS_LIST.getGroupId() || groupId == WidgetInfo.CLAN_CHAT.getGroupId() ||
groupId == WidgetInfo.CHATBOX.getGroupId() && !KICK_OPTION.equals(option) || //prevent from adding for Kick option (interferes with the raiding party one)
groupId == WidgetInfo.RAIDING_PARTY.getGroupId() || groupId == WidgetInfo.PRIVATE_CHAT_MESSAGE.getGroupId())
groupId == WidgetInfo.CHATBOX.getGroupId() && !KICK_OPTION.equals(option) || //prevent from adding for Kick option (interferes with the raiding party one)
groupId == WidgetInfo.RAIDING_PARTY.getGroupId() || groupId == WidgetInfo.PRIVATE_CHAT_MESSAGE.getGroupId() ||
groupId == WidgetInfo.IGNORE_LIST.getGroupId())
{
if (!AFTER_OPTIONS.contains(option))
if (!AFTER_OPTIONS.contains(option) || (option.equals("Delete") && groupId != WidgetInfo.IGNORE_LIST.getGroupId()))
{
return;
}

View File

@@ -51,13 +51,15 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@Slf4j
@PluginDescriptor(
name = "Hunter",
description = "Show the state of your traps",
tags = {"overlay", "skilling", "timers"}
tags = {"overlay", "skilling", "timers"},
type = PluginType.SKILLING
)
@Singleton
public class HunterPlugin extends Plugin

View File

@@ -77,13 +77,15 @@ import net.runelite.client.game.Sound;
import net.runelite.client.game.SoundManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.util.PvPUtil;
import org.apache.commons.lang3.ArrayUtils;
@PluginDescriptor(
name = "Idle Notifier",
description = "Send a notification when going idle, or when HP/Prayer reaches a threshold",
tags = {"health", "hitpoints", "notifications", "prayer", "pvp", "pker"}
tags = {"health", "hitpoints", "notifications", "prayer", "pvp", "pker"},
type = PluginType.MISCELLANEOUS
)
@Singleton
public class IdleNotifierPlugin extends Plugin

View File

@@ -47,12 +47,14 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Implings",
description = "Highlight nearby implings on the minimap and on-screen",
tags = {"hunter", "minimap", "overlay", "imp"}
tags = {"hunter", "minimap", "overlay", "imp"},
type = PluginType.SKILLING
)
@Singleton
public class ImplingsPlugin extends Plugin

View File

@@ -35,6 +35,7 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.util.ImageUtil;
@@ -43,7 +44,8 @@ import net.runelite.client.util.ImageUtil;
name = "Info Panel",
description = "Enable the Info panel",
tags = {"info", "github", "patreon", "dir", "discord"},
loadWhenOutdated = true
loadWhenOutdated = true,
type = PluginType.MISCELLANEOUS
)
@Singleton
public class InfoPlugin extends Plugin

View File

@@ -38,11 +38,13 @@ import net.runelite.client.menus.MenuManager;
import net.runelite.client.menus.WidgetMenuOption;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Instance Map",
description = "Add an instanced map, accessible by right-clicking the map button"
description = "Add an instanced map, accessible by right-clicking the map button",
type = PluginType.UTILITY
)
@Singleton
public class InstanceMapPlugin extends Plugin

View File

@@ -49,6 +49,7 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.util.ImageUtil;
@Slf4j
@@ -56,7 +57,8 @@ import net.runelite.client.util.ImageUtil;
name = "Interface Styles",
description = "Change the interface style to the 2005/2010 interface",
tags = {"2005", "2010", "skin", "theme", "ui"},
enabledByDefault = false
enabledByDefault = false,
type = PluginType.MISCELLANEOUS
)
@Singleton
public class InterfaceStylesPlugin extends Plugin

View File

@@ -36,13 +36,15 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Inventory Grid",
description = "Shows a grid over the inventory and a preview of where items will be dragged",
tags = {"items", "overlay"},
enabledByDefault = false
enabledByDefault = false,
type = PluginType.UTILITY
)
@Singleton
public class InventoryGridPlugin extends Plugin

View File

@@ -45,6 +45,7 @@ import net.runelite.client.menus.MenuManager;
import net.runelite.client.menus.WidgetMenuOption;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.util.ColorUtil;
@@ -52,7 +53,8 @@ import net.runelite.client.util.ColorUtil;
name = "Inventory Tags",
description = "Add the ability to tag items in your inventory",
tags = {"highlight", "items", "overlay", "tagging"},
enabledByDefault = false
enabledByDefault = false,
type = PluginType.UTILITY
)
@Singleton
public class InventoryTagsPlugin extends Plugin

View File

@@ -34,13 +34,15 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Inventory Viewer",
description = "Add an overlay showing the contents of your inventory",
tags = {"alternate", "items", "overlay", "second"},
enabledByDefault = false
enabledByDefault = false,
type = PluginType.UTILITY
)
@Singleton
public class InventoryViewerPlugin extends Plugin

View File

@@ -62,13 +62,15 @@ import net.runelite.client.events.ConfigChanged;
import net.runelite.client.game.ItemManager;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
@PluginDescriptor(
name = "Item Charges",
description = "Show number of item charges remaining",
tags = {"inventory", "notifications", "overlay"}
tags = {"inventory", "notifications", "overlay"},
type = PluginType.UTILITY
)
@Singleton
public class ItemChargePlugin extends Plugin

View File

@@ -120,7 +120,77 @@ enum ItemIdentification
RED_TOPAZ(Type.GEM, "Topaz", "T", ItemID.UNCUT_RED_TOPAZ, ItemID.RED_TOPAZ),
DRAGONSTONE(Type.GEM, "Dragon", "DR", ItemID.UNCUT_DRAGONSTONE, ItemID.DRAGONSTONE),
ONYX(Type.GEM, "Onyx", "ON", ItemID.UNCUT_ONYX, ItemID.ONYX),
ZENYTE(Type.GEM, "Zenyte", "Z", ItemID.UNCUT_ZENYTE, ItemID.ZENYTE);
ZENYTE(Type.GEM, "Zenyte", "Z", ItemID.UNCUT_ZENYTE, ItemID.ZENYTE),
// Potions
ATTACK(Type.POTION, "Att", "A", ItemID.ATTACK_POTION4, ItemID.ATTACK_POTION3, ItemID.ATTACK_POTION2, ItemID.ATTACK_POTION1),
STRENGTH(Type.POTION, "Str", "S", ItemID.STRENGTH_POTION4, ItemID.STRENGTH_POTION3, ItemID.STRENGTH_POTION2, ItemID.STRENGTH_POTION1),
DEFENCE(Type.POTION, "Def", "D", ItemID.DEFENCE_POTION4, ItemID.DEFENCE_POTION3, ItemID.DEFENCE_POTION2, ItemID.DEFENCE_POTION1),
COMBAT(Type.POTION, "Com", "D", ItemID.COMBAT_POTION4, ItemID.COMBAT_POTION3, ItemID.COMBAT_POTION2, ItemID.COMBAT_POTION1),
MAGIC(Type.POTION, "Magic", "M", ItemID.MAGIC_POTION4, ItemID.MAGIC_POTION3, ItemID.MAGIC_POTION2, ItemID.MAGIC_POTION1),
RANGING(Type.POTION, "Range", "R", ItemID.RANGING_POTION4, ItemID.RANGING_POTION3, ItemID.RANGING_POTION2, ItemID.RANGING_POTION1),
BASTION(Type.POTION, "Bastion", "B", ItemID.BASTION_POTION4, ItemID.BASTION_POTION3, ItemID.BASTION_POTION2, ItemID.BASTION_POTION1),
BATTLEMAGE(Type.POTION, "BatMage", "B.M", ItemID.BATTLEMAGE_POTION4, ItemID.BATTLEMAGE_POTION3, ItemID.BATTLEMAGE_POTION2, ItemID.BATTLEMAGE_POTION1),
SUPER_ATTACK(Type.POTION, "S.Att", "S.A", ItemID.SUPER_ATTACK4, ItemID.SUPER_ATTACK3, ItemID.SUPER_ATTACK2, ItemID.SUPER_ATTACK1),
SUPER_STRENGTH(Type.POTION, "S.Str", "S.S", ItemID.SUPER_STRENGTH4, ItemID.SUPER_STRENGTH3, ItemID.SUPER_STRENGTH2, ItemID.SUPER_STRENGTH1),
SUPER_DEFENCE(Type.POTION, "S.Def", "S.D", ItemID.SUPER_DEFENCE4, ItemID.SUPER_DEFENCE3, ItemID.SUPER_DEFENCE2, ItemID.SUPER_DEFENCE1),
SUPER_COMBAT(Type.POTION, "S.Com", "S.C", ItemID.SUPER_COMBAT_POTION4, ItemID.SUPER_COMBAT_POTION3, ItemID.SUPER_COMBAT_POTION2, ItemID.SUPER_COMBAT_POTION1),
SUPER_RANGING(Type.POTION, "S.Range", "S.Ra", ItemID.SUPER_RANGING_4, ItemID.SUPER_RANGING_3, ItemID.SUPER_RANGING_2, ItemID.SUPER_RANGING_1),
SUPER_MAGIC(Type.POTION, "S.Magic", "S.M", ItemID.SUPER_MAGIC_POTION_4, ItemID.SUPER_MAGIC_POTION_3, ItemID.SUPER_MAGIC_POTION_2, ItemID.SUPER_MAGIC_POTION_1),
DIVINE_SUPER_ATTACK(Type.POTION, "S.Att", "S.A", ItemID.DIVINE_SUPER_ATTACK_POTION4, ItemID.DIVINE_SUPER_ATTACK_POTION3, ItemID.DIVINE_SUPER_ATTACK_POTION2, ItemID.DIVINE_SUPER_ATTACK_POTION1),
DIVINE_SUPER_DEFENCE(Type.POTION, "S.Def", "S.D", ItemID.DIVINE_SUPER_DEFENCE_POTION4, ItemID.DIVINE_SUPER_DEFENCE_POTION3, ItemID.DIVINE_SUPER_DEFENCE_POTION2, ItemID.DIVINE_SUPER_DEFENCE_POTION1),
DIVINE_SUPER_STRENGTH(Type.POTION, "S.Str", "S.S", ItemID.DIVINE_SUPER_STRENGTH_POTION4, ItemID.DIVINE_SUPER_STRENGTH_POTION3, ItemID.DIVINE_SUPER_STRENGTH_POTION2, ItemID.DIVINE_SUPER_STRENGTH_POTION1),
DIVINE_SUPER_COMBAT(Type.POTION, "S.Com", "S.C", ItemID.DIVINE_SUPER_COMBAT_POTION4, ItemID.DIVINE_SUPER_COMBAT_POTION3, ItemID.DIVINE_SUPER_COMBAT_POTION2, ItemID.DIVINE_SUPER_COMBAT_POTION1),
DIVINE_RANGING(Type.POTION, "Range", "R", ItemID.DIVINE_RANGING_POTION4, ItemID.DIVINE_RANGING_POTION3, ItemID.DIVINE_RANGING_POTION2, ItemID.DIVINE_RANGING_POTION1),
DIVINE_MAGIC(Type.POTION, "Magic", "M", ItemID.DIVINE_MAGIC_POTION4, ItemID.DIVINE_MAGIC_POTION3, ItemID.DIVINE_MAGIC_POTION2, ItemID.DIVINE_MAGIC_POTION1),
RESTORE(Type.POTION, "Restore", "Re", ItemID.RESTORE_POTION4, ItemID.RESTORE_POTION3, ItemID.RESTORE_POTION2, ItemID.RESTORE_POTION1),
SUPER_RESTORE(Type.POTION, "S.Rest", "S.Re", ItemID.SUPER_RESTORE4, ItemID.SUPER_RESTORE3, ItemID.SUPER_RESTORE2, ItemID.SUPER_RESTORE1),
PRAYER(Type.POTION, "Prayer", "P", ItemID.PRAYER_POTION4, ItemID.PRAYER_POTION3, ItemID.PRAYER_POTION2, ItemID.PRAYER_POTION1),
ENERGY(Type.POTION, "Energy", "En", ItemID.ENERGY_POTION4, ItemID.ENERGY_POTION3, ItemID.ENERGY_POTION2, ItemID.ENERGY_POTION1),
SUPER_ENERGY(Type.POTION, "S.Energ", "S.En", ItemID.SUPER_ENERGY4, ItemID.SUPER_ENERGY3, ItemID.SUPER_ENERGY2, ItemID.SUPER_ENERGY1),
STAMINA(Type.POTION, "Stamina", "St", ItemID.STAMINA_POTION4, ItemID.STAMINA_POTION3, ItemID.STAMINA_POTION2, ItemID.STAMINA_POTION1),
OVERLOAD(Type.POTION, "Overloa", "OL", ItemID.OVERLOAD_4, ItemID.OVERLOAD_3, ItemID.OVERLOAD_2, ItemID.OVERLOAD_1),
ABSORPTION(Type.POTION, "Absorb", "Ab", ItemID.ABSORPTION_4, ItemID.ABSORPTION_3, ItemID.ABSORPTION_2, ItemID.ABSORPTION_1),
ZAMORAK_BREW(Type.POTION, "ZammyBr", "Za", ItemID.ZAMORAK_BREW4, ItemID.ZAMORAK_BREW3, ItemID.ZAMORAK_BREW2, ItemID.ZAMORAK_BREW1),
SARADOMIN_BREW(Type.POTION, "SaraBr", "Sa", ItemID.SARADOMIN_BREW4, ItemID.SARADOMIN_BREW3, ItemID.SARADOMIN_BREW2, ItemID.SARADOMIN_BREW1),
ANTIPOISON(Type.POTION, "AntiP", "AP", ItemID.ANTIPOISON4, ItemID.ANTIPOISON3, ItemID.ANTIPOISON2, ItemID.ANTIPOISON1),
SUPERANTIPOISON(Type.POTION, "S.AntiP", "S.AP", ItemID.SUPERANTIPOISON4, ItemID.SUPERANTIPOISON3, ItemID.SUPERANTIPOISON2, ItemID.SUPERANTIPOISON1),
ANTIDOTE_P(Type.POTION, "Antid+", "A+", ItemID.ANTIDOTE4, ItemID.ANTIDOTE3, ItemID.ANTIDOTE2, ItemID.ANTIDOTE1),
ANTIDOTE_PP(Type.POTION, "Antid++", "A++", ItemID.ANTIDOTE4_5952, ItemID.ANTIDOTE3_5954, ItemID.ANTIDOTE2_5956, ItemID.ANTIDOTE1_5958),
ANTIVENOM(Type.POTION, "Anti-V", "AV", ItemID.ANTIVENOM4, ItemID.ANTIVENOM3, ItemID.ANTIVENOM2, ItemID.ANTIVENOM1),
ANTIVENOM_P(Type.POTION, "Anti-V+", "AV+", ItemID.ANTIVENOM4_12913, ItemID.ANTIVENOM3_12915, ItemID.ANTIVENOM2_12917, ItemID.ANTIVENOM1_12919),
RELICYMS_BALM(Type.POTION, "Relicym", "R.B", ItemID.RELICYMS_BALM4, ItemID.RELICYMS_BALM3, ItemID.RELICYMS_BALM2, ItemID.RELICYMS_BALM1),
SANFEW_SERUM(Type.POTION, "Sanfew", "Sf", ItemID.SANFEW_SERUM4, ItemID.SANFEW_SERUM3, ItemID.SANFEW_SERUM2, ItemID.SANFEW_SERUM1),
ANTIFIRE(Type.POTION, "Antif", "Af", ItemID.ANTIFIRE_POTION4, ItemID.ANTIFIRE_POTION3, ItemID.ANTIFIRE_POTION2, ItemID.ANTIFIRE_POTION1),
EXTENDED_ANTIFIRE(Type.POTION, "E.Antif", "E.Af", ItemID.EXTENDED_ANTIFIRE4, ItemID.EXTENDED_ANTIFIRE3, ItemID.EXTENDED_ANTIFIRE2, ItemID.EXTENDED_ANTIFIRE1),
SUPER_ANTIFIRE(Type.POTION, "S.Antif", "S.Af", ItemID.SUPER_ANTIFIRE_POTION4, ItemID.SUPER_ANTIFIRE_POTION3, ItemID.SUPER_ANTIFIRE_POTION2, ItemID.SUPER_ANTIFIRE_POTION1),
EXTENDED_SUPER_ANTIFIRE(Type.POTION, "ES.Antif", "ES.Af", ItemID.EXTENDED_SUPER_ANTIFIRE4, ItemID.EXTENDED_SUPER_ANTIFIRE3, ItemID.EXTENDED_SUPER_ANTIFIRE2, ItemID.EXTENDED_SUPER_ANTIFIRE1),
SERUM_207(Type.POTION, "Ser207", "S7", ItemID.SERUM_207_4, ItemID.SERUM_207_3, ItemID.SERUM_207_2, ItemID.SERUM_207_1),
SERUM_208(Type.POTION, "Ser208", "S8", ItemID.SERUM_208_4, ItemID.SERUM_208_3, ItemID.SERUM_208_2, ItemID.SERUM_208_1),
COMPOST(Type.POTION, "Compost", "Cp", ItemID.COMPOST_POTION4, ItemID.COMPOST_POTION3, ItemID.COMPOST_POTION2, ItemID.COMPOST_POTION1),
// Unfinished Potions
GUAM_POTION(Type.POTION, "Guam", "G", ItemID.GUAM_POTION_UNF),
MARRENTILL_POTION(Type.POTION, "Marren", "M", ItemID.MARRENTILL_POTION_UNF),
TARROMIN_POTION(Type.POTION, "Tarro", "TAR", ItemID.TARROMIN_POTION_UNF),
HARRALANDER_POTION(Type.POTION, "Harra", "H", ItemID.HARRALANDER_POTION_UNF),
RANARR_POTION(Type.POTION, "Ranarr", "R", ItemID.RANARR_POTION_UNF),
TOADFLAX_POTION(Type.POTION, "Toad", "TOA", ItemID.TOADFLAX_POTION_UNF),
IRIT_POTION(Type.POTION, "Irit", "I", ItemID.IRIT_POTION_UNF),
AVANTOE_POTION(Type.POTION, "Avan", "A", ItemID.AVANTOE_POTION_UNF),
KWUARM_POTION(Type.POTION, "Kwuarm", "K", ItemID.KWUARM_POTION_UNF),
SNAPDRAGON_POTION(Type.POTION, "Snap", "S", ItemID.SNAPDRAGON_POTION_UNF),
CADANTINE_POTION(Type.POTION, "Cadan", "C", ItemID.CADANTINE_POTION_UNF),
LANTADYME_POTION(Type.POTION, "Lanta", "L", ItemID.LANTADYME_POTION_UNF),
DWARF_WEED_POTION(Type.POTION, "Dwarf", "D", ItemID.DWARF_WEED_POTION_UNF),
TORSTOL_POTION(Type.POTION, "Torstol", "TOR", ItemID.TORSTOL_POTION_UNF);
final Type type;
final String medName;
@@ -163,6 +233,7 @@ enum ItemIdentification
HERB,
SAPLING,
ORE,
GEM
GEM,
POTION
}
}

View File

@@ -103,4 +103,14 @@ public interface ItemIdentificationConfig extends Config
{
return false;
}
@ConfigItem(
keyName = "showPotions",
name = "Potions",
description = "Show identification on Potions"
)
default boolean showPotions()
{
return false;
}
}

View File

@@ -98,6 +98,12 @@ class ItemIdentificationOverlay extends WidgetItemOverlay
return;
}
break;
case POTION:
if (!plugin.isShowPotions())
{
return;
}
break;
}
graphics.setFont(FontManager.getRunescapeSmallFont());

View File

@@ -35,12 +35,14 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Item Identification",
description = "Show identifying text over items with difficult to distinguish sprites",
enabledByDefault = false
enabledByDefault = false,
type = PluginType.UTILITY
)
@Singleton
public class ItemIdentificationPlugin extends Plugin
@@ -68,6 +70,8 @@ public class ItemIdentificationPlugin extends Plugin
private boolean showOres;
@Getter(AccessLevel.PACKAGE)
private boolean showGems;
@Getter(AccessLevel.PACKAGE)
private boolean showPotions;
@Provides
ItemIdentificationConfig getConfig(ConfigManager configManager)
@@ -108,5 +112,6 @@ public class ItemIdentificationPlugin extends Plugin
this.showSaplings = config.showSaplings();
this.showOres = config.showOres();
this.showGems = config.showGems();
this.showPotions = config.showPotions();
}
}

View File

@@ -236,7 +236,7 @@ class ItemPricesOverlay extends Overlay
if (gePrice > 0)
{
itemStringBuilder.append("EX: ")
.append(QuantityFormatter.quantityToStackSize(gePrice * qty))
.append(QuantityFormatter.quantityToStackSize((long) gePrice * qty))
.append(" gp");
if (plugin.isShowEA() && qty > 1)
{
@@ -253,7 +253,7 @@ class ItemPricesOverlay extends Overlay
}
itemStringBuilder.append("HA: ")
.append(QuantityFormatter.quantityToStackSize(haValue * qty))
.append(QuantityFormatter.quantityToStackSize((long) haValue * qty))
.append(" gp");
if (plugin.isShowEA() && qty > 1)
{
@@ -269,7 +269,7 @@ class ItemPricesOverlay extends Overlay
itemStringBuilder.append("</br>");
itemStringBuilder.append("HA Profit: ")
.append(ColorUtil.wrapWithColorTag(String.valueOf(haProfit * qty), haColor))
.append(ColorUtil.wrapWithColorTag(String.valueOf((long) haProfit * qty), haColor))
.append(" gp");
if (plugin.isShowEA() && qty > 1)
{

View File

@@ -34,13 +34,15 @@ import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Item Prices",
description = "Show prices on hover for items in your inventory and bank",
tags = {"bank", "inventory", "overlay", "high", "alchemy", "grand", "exchange", "tooltips"},
enabledByDefault = false
enabledByDefault = false,
type = PluginType.UTILITY
)
@Singleton
public class ItemPricesPlugin extends Plugin

Some files were not shown because too many files have changed in this diff Show More