@@ -28,7 +28,12 @@ import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("antiDrag")
|
||||
/*@ConfigGroup(
|
||||
keyName = "antiDrag",
|
||||
name = "Anti Drag",
|
||||
description = "Configuration for the anti drag plugin"
|
||||
)*/
|
||||
@ConfigGroup("antidrag")
|
||||
public interface AntiDragConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
|
||||
@@ -24,23 +24,22 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.antidrag;
|
||||
|
||||
import com.google.common.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.event.KeyEvent;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.events.FocusChanged;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Shift Anti Drag",
|
||||
description = "Prevent dragging an item for a specified delay",
|
||||
tags = {"antidrag", "delay", "inventory", "items"}
|
||||
)
|
||||
name = "Anti Drag",
|
||||
type = "utility",
|
||||
enabledByDefault = false)
|
||||
public class AntiDragPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
private static final int DEFAULT_DELAY = 5;
|
||||
@@ -63,6 +62,7 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
client.setInventoryDragDelay(config.dragDelay());
|
||||
keyManager.registerKeyListener(this);
|
||||
}
|
||||
|
||||
@@ -79,30 +79,40 @@ public class AntiDragPlugin extends Plugin implements KeyListener
|
||||
|
||||
}
|
||||
|
||||
public boolean toggleDrag = true;
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
if (e.getKeyCode() == KeyEvent.VK_SHIFT)
|
||||
/*if (e.getKeyCode() == KeyEvent.VK_SHIFT)
|
||||
{
|
||||
client.setInventoryDragDelay(config.dragDelay());
|
||||
}
|
||||
client.setInventoryDragDelay(config.dragDelay());*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
if (e.getKeyCode() == KeyEvent.VK_SHIFT)
|
||||
{
|
||||
if (e.getKeyCode() == KeyEvent.VK_CONTROL && toggleDrag) {
|
||||
|
||||
toggleDrag = false;
|
||||
client.setInventoryDragDelay(DEFAULT_DELAY);
|
||||
|
||||
} else if (e.getKeyCode() == KeyEvent.VK_CONTROL && !toggleDrag) {
|
||||
|
||||
toggleDrag = true;
|
||||
client.setInventoryDragDelay(config.dragDelay());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
/*@Subscribe
|
||||
public void onFocusChanged(FocusChanged focusChanged)
|
||||
{
|
||||
if (!focusChanged.isFocused())
|
||||
{
|
||||
client.setInventoryDragDelay(DEFAULT_DELAY);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@@ -78,7 +78,8 @@ import net.runelite.client.util.Text;
|
||||
@PluginDescriptor(
|
||||
name = "BA Tools",
|
||||
description = "Custom tools for Barbarian Assault",
|
||||
tags = {"minigame", "overlay", "timer"}
|
||||
tags = {"minigame", "overlay", "timer"},
|
||||
type = "utility"
|
||||
)
|
||||
public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
|
||||
@@ -1,89 +1,30 @@
|
||||
/*
|
||||
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
|
||||
* Copyright (c) 2019, Adam <Adam@sigterm.info>
|
||||
* Copyright (c) 2018, trimbe <github.com/trimbe>
|
||||
* 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.clanchat;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Deque;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.ChatLineBuffer;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.ClanMember;
|
||||
import net.runelite.api.ClanMemberRank;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.ScriptID;
|
||||
import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.VarClientStr;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.ClanChanged;
|
||||
import net.runelite.api.events.ClanMemberJoined;
|
||||
import net.runelite.api.events.ClanMemberLeft;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.PlayerDespawned;
|
||||
import net.runelite.api.events.PlayerSpawned;
|
||||
import net.runelite.api.events.VarClientStrChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.api.widgets.WidgetType;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.ClanManager;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
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;
|
||||
import static net.runelite.client.ui.JagexColors.CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.util.Text;
|
||||
import net.runelite.client.plugins.*;
|
||||
import net.runelite.client.game.*;
|
||||
import net.runelite.client.callback.*;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Clan Chat",
|
||||
description = "Add rank icons to users talking in clan chat",
|
||||
tags = {"icons", "rank", "recent"}
|
||||
)
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.concurrent.*;
|
||||
import net.runelite.client.config.*;
|
||||
import com.google.inject.*;
|
||||
import net.runelite.client.util.*;
|
||||
import net.runelite.client.eventbus.*;
|
||||
import com.google.common.base.*;
|
||||
import net.runelite.api.widgets.*;
|
||||
import net.runelite.client.ui.*;
|
||||
import net.runelite.client.chat.*;
|
||||
import java.awt.*;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.events.*;
|
||||
import com.google.common.collect.*;
|
||||
import java.util.*;
|
||||
import java.util.function.*;
|
||||
import net.runelite.client.ui.overlay.infobox.*;
|
||||
import java.awt.image.*;
|
||||
|
||||
@PluginDescriptor(name = "Clan Chat", description = "Add rank icons to users talking in clan chat", tags = { "icons", "rank", "recent" })
|
||||
public class ClanChatPlugin extends Plugin
|
||||
{
|
||||
private static final int MAX_CHATS = 10;
|
||||
@@ -91,508 +32,376 @@ public class ClanChatPlugin extends Plugin
|
||||
private static final String RECENT_TITLE = "Recent Clan Chats";
|
||||
private static final int JOIN_LEAVE_DURATION = 20;
|
||||
private static final int MESSAGE_DELAY = 10;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ClanManager clanManager;
|
||||
|
||||
@Inject
|
||||
private ClanChatConfig config;
|
||||
|
||||
@Inject
|
||||
private InfoBoxManager infoBoxManager;
|
||||
|
||||
@Inject
|
||||
private SpriteManager spriteManager;
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
private List<String> chats = new ArrayList<>();
|
||||
private List<Player> clanMembers = new ArrayList<>();
|
||||
private List<String> chats;
|
||||
private static CopyOnWriteArrayList<Player> clanMembers;
|
||||
private ClanChatIndicator clanMemberCounter;
|
||||
/**
|
||||
* queue of temporary messages added to the client
|
||||
*/
|
||||
private final Deque<ClanJoinMessage> clanJoinMessages = new ArrayDeque<>();
|
||||
private Map<String, ClanMemberActivity> activityBuffer = new HashMap<>();
|
||||
private final Deque<ClanJoinMessage> clanJoinMessages;
|
||||
private Map<String, ClanMemberActivity> activityBuffer;
|
||||
private int clanJoinedTick;
|
||||
|
||||
public ClanChatPlugin() {
|
||||
this.chats = new ArrayList<String>();
|
||||
this.clanJoinMessages = new ArrayDeque<ClanJoinMessage>();
|
||||
this.activityBuffer = new HashMap<String, ClanMemberActivity>();
|
||||
}
|
||||
|
||||
public static CopyOnWriteArrayList<Player> getClanMembers() {
|
||||
return (CopyOnWriteArrayList<Player>)ClanChatPlugin.clanMembers.clone();
|
||||
}
|
||||
|
||||
@Provides
|
||||
ClanChatConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
ClanChatConfig getConfig(final ConfigManager configManager) {
|
||||
return configManager.getConfig(ClanChatConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startUp()
|
||||
{
|
||||
chats = new ArrayList<>(Text.fromCSV(config.chatsData()));
|
||||
public void startUp() {
|
||||
this.chats = new ArrayList<String>(Text.fromCSV(this.config.chatsData()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shutDown()
|
||||
{
|
||||
clanMembers.clear();
|
||||
removeClanCounter();
|
||||
resetClanChats();
|
||||
public void shutDown() {
|
||||
ClanChatPlugin.clanMembers.clear();
|
||||
this.removeClanCounter();
|
||||
this.resetClanChats();
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged configChanged)
|
||||
{
|
||||
if (configChanged.getGroup().equals("clanchat"))
|
||||
{
|
||||
if (!config.recentChats())
|
||||
{
|
||||
resetClanChats();
|
||||
public void onConfigChanged(final ConfigChanged configChanged) {
|
||||
if (configChanged.getGroup().equals("clanchat")) {
|
||||
if (!this.config.recentChats()) {
|
||||
this.resetClanChats();
|
||||
}
|
||||
|
||||
if (config.showClanCounter())
|
||||
{
|
||||
clientThread.invoke(this::addClanCounter);
|
||||
if (this.config.showClanCounter()) {
|
||||
this.clientThread.invoke(this::addClanCounter);
|
||||
}
|
||||
else
|
||||
{
|
||||
removeClanCounter();
|
||||
else {
|
||||
this.removeClanCounter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onClanMemberJoined(ClanMemberJoined event)
|
||||
{
|
||||
public void onClanMemberJoined(final ClanMemberJoined event) {
|
||||
final ClanMember member = event.getMember();
|
||||
|
||||
if (member.getWorld() == client.getWorld())
|
||||
{
|
||||
if (member.getWorld() == this.client.getWorld()) {
|
||||
final String memberName = Text.toJagexName(member.getUsername());
|
||||
|
||||
for (final Player player : client.getPlayers())
|
||||
{
|
||||
if (player != null && memberName.equals(Text.toJagexName(player.getName())))
|
||||
{
|
||||
clanMembers.add(player);
|
||||
addClanCounter();
|
||||
for (final Player player : this.client.getPlayers()) {
|
||||
if (player != null && memberName.equals(Text.toJagexName(player.getName()))) {
|
||||
ClanChatPlugin.clanMembers.add(player);
|
||||
this.addClanCounter();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// clan members getting initialized isn't relevant
|
||||
if (clanJoinedTick == client.getTickCount())
|
||||
{
|
||||
if (this.clanJoinedTick == this.client.getTickCount()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!config.showJoinLeave() ||
|
||||
member.getRank().getValue() < config.joinLeaveRank().getValue())
|
||||
{
|
||||
if (!this.config.showJoinLeave() || member.getRank().getValue() < this.config.joinLeaveRank().getValue()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// attempt to filter out world hopping joins
|
||||
if (!activityBuffer.containsKey(member.getUsername()))
|
||||
{
|
||||
ClanMemberActivity joinActivity = new ClanMemberActivity(ClanActivityType.JOINED,
|
||||
member, client.getTickCount());
|
||||
activityBuffer.put(member.getUsername(), joinActivity);
|
||||
if (!this.activityBuffer.containsKey(member.getUsername())) {
|
||||
final ClanMemberActivity joinActivity = new ClanMemberActivity(ClanActivityType.JOINED, member, this.client.getTickCount());
|
||||
this.activityBuffer.put(member.getUsername(), joinActivity);
|
||||
}
|
||||
else
|
||||
{
|
||||
activityBuffer.remove(member.getUsername());
|
||||
else {
|
||||
this.activityBuffer.remove(member.getUsername());
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onClanMemberLeft(ClanMemberLeft event)
|
||||
{
|
||||
public void onClanMemberLeft(final ClanMemberLeft event) {
|
||||
final ClanMember member = event.getMember();
|
||||
|
||||
if (member.getWorld() == client.getWorld())
|
||||
{
|
||||
if (member.getWorld() == this.client.getWorld()) {
|
||||
final String memberName = Text.toJagexName(member.getUsername());
|
||||
final Iterator<Player> each = clanMembers.iterator();
|
||||
|
||||
while (each.hasNext())
|
||||
{
|
||||
if (memberName.equals(Text.toJagexName(each.next().getName())))
|
||||
{
|
||||
final Iterator<Player> each = ClanChatPlugin.clanMembers.iterator();
|
||||
while (each.hasNext()) {
|
||||
if (memberName.equals(Text.toJagexName(each.next().getName()))) {
|
||||
each.remove();
|
||||
|
||||
if (clanMembers.isEmpty())
|
||||
{
|
||||
removeClanCounter();
|
||||
if (ClanChatPlugin.clanMembers.isEmpty()) {
|
||||
this.removeClanCounter();
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!config.showJoinLeave() ||
|
||||
member.getRank().getValue() < config.joinLeaveRank().getValue())
|
||||
{
|
||||
if (!this.config.showJoinLeave() || member.getRank().getValue() < this.config.joinLeaveRank().getValue()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!activityBuffer.containsKey(member.getUsername()))
|
||||
{
|
||||
ClanMemberActivity leaveActivity = new ClanMemberActivity(ClanActivityType.LEFT,
|
||||
member, client.getTickCount());
|
||||
activityBuffer.put(member.getUsername(), leaveActivity);
|
||||
if (!this.activityBuffer.containsKey(member.getUsername())) {
|
||||
final ClanMemberActivity leaveActivity = new ClanMemberActivity(ClanActivityType.LEFT, member, this.client.getTickCount());
|
||||
this.activityBuffer.put(member.getUsername(), leaveActivity);
|
||||
}
|
||||
else
|
||||
{
|
||||
activityBuffer.remove(member.getUsername());
|
||||
else {
|
||||
this.activityBuffer.remove(member.getUsername());
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick gameTick)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
{
|
||||
public void onGameTick(final GameTick gameTick) {
|
||||
if (this.client.getGameState() != GameState.LOGGED_IN) {
|
||||
return;
|
||||
}
|
||||
|
||||
Widget clanChatTitleWidget = client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
|
||||
if (clanChatTitleWidget != null)
|
||||
{
|
||||
Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
|
||||
Widget owner = client.getWidget(WidgetInfo.CLAN_CHAT_OWNER);
|
||||
if (client.getClanChatCount() > 0)
|
||||
{
|
||||
clanChatTitleWidget.setText(CLAN_CHAT_TITLE + " (" + client.getClanChatCount() + "/100)");
|
||||
final Widget clanChatTitleWidget = this.client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
|
||||
if (clanChatTitleWidget != null) {
|
||||
final Widget clanChatList = this.client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
|
||||
final Widget owner = this.client.getWidget(WidgetInfo.CLAN_CHAT_OWNER);
|
||||
if (this.client.getClanChatCount() > 0) {
|
||||
clanChatTitleWidget.setText("Clan Chat (" + this.client.getClanChatCount() + "/100)");
|
||||
}
|
||||
else if (config.recentChats() && clanChatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText()))
|
||||
{
|
||||
clanChatTitleWidget.setText(RECENT_TITLE);
|
||||
|
||||
loadClanChats();
|
||||
else if (this.config.recentChats() && clanChatList.getChildren() == null && !Strings.isNullOrEmpty(owner.getText())) {
|
||||
clanChatTitleWidget.setText("Recent Clan Chats");
|
||||
this.loadClanChats();
|
||||
}
|
||||
}
|
||||
|
||||
if (!config.showJoinLeave())
|
||||
{
|
||||
if (!this.config.showJoinLeave()) {
|
||||
return;
|
||||
}
|
||||
|
||||
timeoutClanMessages();
|
||||
|
||||
addClanActivityMessages();
|
||||
this.timeoutClanMessages();
|
||||
this.addClanActivityMessages();
|
||||
}
|
||||
|
||||
private void timeoutClanMessages()
|
||||
{
|
||||
if (clanJoinMessages.isEmpty())
|
||||
{
|
||||
private void timeoutClanMessages() {
|
||||
if (this.clanJoinMessages.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
boolean removed = false;
|
||||
|
||||
for (Iterator<ClanJoinMessage> it = clanJoinMessages.iterator(); it.hasNext(); )
|
||||
{
|
||||
ClanJoinMessage clanJoinMessage = it.next();
|
||||
MessageNode messageNode = clanJoinMessage.getMessageNode();
|
||||
final Iterator<ClanJoinMessage> it = this.clanJoinMessages.iterator();
|
||||
while (it.hasNext()) {
|
||||
final ClanJoinMessage clanJoinMessage = it.next();
|
||||
final MessageNode messageNode = clanJoinMessage.getMessageNode();
|
||||
final int createdTick = clanJoinMessage.getTick();
|
||||
|
||||
if (client.getTickCount() > createdTick + JOIN_LEAVE_DURATION)
|
||||
{
|
||||
it.remove();
|
||||
|
||||
// If this message has been reused since, it will get a different id
|
||||
if (clanJoinMessage.getGetMessageId() == messageNode.getId())
|
||||
{
|
||||
ChatLineBuffer ccInfoBuffer = client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType());
|
||||
if (ccInfoBuffer != null)
|
||||
{
|
||||
ccInfoBuffer.removeMessageNode(messageNode);
|
||||
removed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Everything else in the deque is newer
|
||||
if (this.client.getTickCount() <= createdTick + 20) {
|
||||
break;
|
||||
}
|
||||
it.remove();
|
||||
if (clanJoinMessage.getGetMessageId() != messageNode.getId()) {
|
||||
continue;
|
||||
}
|
||||
final ChatLineBuffer ccInfoBuffer = this.client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType());
|
||||
if (ccInfoBuffer == null) {
|
||||
continue;
|
||||
}
|
||||
ccInfoBuffer.removeMessageNode(messageNode);
|
||||
removed = true;
|
||||
}
|
||||
|
||||
if (removed)
|
||||
{
|
||||
clientThread.invoke(() -> client.runScript(ScriptID.BUILD_CHATBOX));
|
||||
if (removed) {
|
||||
this.clientThread.invoke(() -> this.client.runScript(216, new Object[0]));
|
||||
}
|
||||
}
|
||||
|
||||
private void addClanActivityMessages()
|
||||
{
|
||||
Iterator<ClanMemberActivity> activityIt = activityBuffer.values().iterator();
|
||||
|
||||
while (activityIt.hasNext())
|
||||
{
|
||||
ClanMemberActivity activity = activityIt.next();
|
||||
|
||||
if (activity.getTick() < client.getTickCount() - MESSAGE_DELAY)
|
||||
{
|
||||
private void addClanActivityMessages() {
|
||||
final Iterator<ClanMemberActivity> activityIt = this.activityBuffer.values().iterator();
|
||||
while (activityIt.hasNext()) {
|
||||
final ClanMemberActivity activity = activityIt.next();
|
||||
if (activity.getTick() < this.client.getTickCount() - 10) {
|
||||
activityIt.remove();
|
||||
addActivityMessage(activity.getMember(), activity.getActivityType());
|
||||
this.addActivityMessage(activity.getMember(), activity.getActivityType());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void addActivityMessage(ClanMember member, ClanActivityType activityType)
|
||||
{
|
||||
final String activityMessage = activityType == ClanActivityType.JOINED ? " has joined." : " has left.";
|
||||
private void addActivityMessage(final ClanMember member, final ClanActivityType activityType) {
|
||||
final String activityMessage = (activityType == ClanActivityType.JOINED) ? " has joined." : " has left.";
|
||||
final ClanMemberRank rank = member.getRank();
|
||||
Color textColor = CHAT_CLAN_TEXT_OPAQUE_BACKGROUND;
|
||||
Color channelColor = CHAT_CLAN_NAME_OPAQUE_BACKGROUND;
|
||||
Color textColor = JagexColors.CHAT_CLAN_TEXT_OPAQUE_BACKGROUND;
|
||||
Color channelColor = JagexColors.CHAT_CLAN_NAME_OPAQUE_BACKGROUND;
|
||||
int rankIcon = -1;
|
||||
|
||||
if (client.isResized() && client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1)
|
||||
{
|
||||
textColor = CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND;
|
||||
channelColor = CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND;
|
||||
if (this.client.isResized() && this.client.getVar(Varbits.TRANSPARENT_CHATBOX) == 1) {
|
||||
textColor = JagexColors.CHAT_CLAN_TEXT_TRANSPARENT_BACKGROUND;
|
||||
channelColor = JagexColors.CHAT_CLAN_NAME_TRANSPARENT_BACKGROUND;
|
||||
}
|
||||
|
||||
if (config.clanChatIcons() && rank != null && rank != ClanMemberRank.UNRANKED)
|
||||
{
|
||||
rankIcon = clanManager.getIconNumber(rank);
|
||||
if (this.config.clanChatIcons() && rank != null && rank != ClanMemberRank.UNRANKED) {
|
||||
rankIcon = this.clanManager.getIconNumber(rank);
|
||||
}
|
||||
|
||||
ChatMessageBuilder message = new ChatMessageBuilder()
|
||||
.append("[")
|
||||
.append(channelColor, client.getClanChatName());
|
||||
if (rankIcon > -1)
|
||||
{
|
||||
message
|
||||
.append(" ")
|
||||
.img(rankIcon);
|
||||
final ChatMessageBuilder message = new ChatMessageBuilder().append("[").append(channelColor, this.client.getClanChatName());
|
||||
if (rankIcon > -1) {
|
||||
message.append(" ").img(rankIcon);
|
||||
}
|
||||
message
|
||||
.append("] ")
|
||||
.append(textColor, member.getUsername() + activityMessage);
|
||||
|
||||
message.append("] ").append(textColor, member.getUsername() + activityMessage);
|
||||
final String messageString = message.build();
|
||||
client.addChatMessage(ChatMessageType.FRIENDSCHATNOTIFICATION, "", messageString, "");
|
||||
|
||||
final ChatLineBuffer chatLineBuffer = client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType());
|
||||
this.client.addChatMessage(ChatMessageType.FRIENDSCHATNOTIFICATION, "", messageString, "");
|
||||
final ChatLineBuffer chatLineBuffer = this.client.getChatLineMap().get(ChatMessageType.FRIENDSCHATNOTIFICATION.getType());
|
||||
final MessageNode[] lines = chatLineBuffer.getLines();
|
||||
final MessageNode line = lines[0];
|
||||
|
||||
ClanJoinMessage clanJoinMessage = new ClanJoinMessage(line, line.getId(), client.getTickCount());
|
||||
clanJoinMessages.addLast(clanJoinMessage);
|
||||
final ClanJoinMessage clanJoinMessage = new ClanJoinMessage(line, line.getId(), this.client.getTickCount());
|
||||
this.clanJoinMessages.addLast(clanJoinMessage);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onVarClientStrChanged(VarClientStrChanged strChanged)
|
||||
{
|
||||
if (strChanged.getIndex() == VarClientStr.RECENT_CLAN_CHAT.getIndex() && config.recentChats())
|
||||
{
|
||||
updateRecentChat(client.getVar(VarClientStr.RECENT_CLAN_CHAT));
|
||||
public void onVarClientStrChanged(final VarClientStrChanged strChanged) {
|
||||
if (strChanged.getIndex() == VarClientStr.RECENT_CLAN_CHAT.getIndex() && this.config.recentChats()) {
|
||||
this.updateRecentChat(this.client.getVar(VarClientStr.RECENT_CLAN_CHAT));
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onChatMessage(ChatMessage chatMessage)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOADING && client.getGameState() != GameState.LOGGED_IN)
|
||||
{
|
||||
public void onChatMessage(final ChatMessage chatMessage) {
|
||||
if (this.client.getGameState() != GameState.LOADING && this.client.getGameState() != GameState.LOGGED_IN) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (client.getClanChatCount() <= 0)
|
||||
{
|
||||
if (this.client.getClanChatCount() <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch (chatMessage.getType())
|
||||
{
|
||||
switch (chatMessage.getType()) {
|
||||
case PRIVATECHAT:
|
||||
case MODPRIVATECHAT:
|
||||
if (!config.privateMessageIcons())
|
||||
{
|
||||
case MODPRIVATECHAT: {
|
||||
if (!this.config.privateMessageIcons()) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PUBLICCHAT:
|
||||
case MODCHAT:
|
||||
if (!config.publicChatIcons())
|
||||
{
|
||||
case MODCHAT: {
|
||||
if (!this.config.publicChatIcons()) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case FRIENDSCHAT:
|
||||
if (!config.clanChatIcons())
|
||||
{
|
||||
}
|
||||
case FRIENDSCHAT: {
|
||||
if (!this.config.clanChatIcons()) {
|
||||
return;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
}
|
||||
default: {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
insertClanRankIcon(chatMessage);
|
||||
this.insertClanRankIcon(chatMessage);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged state)
|
||||
{
|
||||
GameState gameState = state.getGameState();
|
||||
|
||||
if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.CONNECTION_LOST || gameState == GameState.HOPPING)
|
||||
{
|
||||
clanMembers.clear();
|
||||
removeClanCounter();
|
||||
|
||||
clanJoinMessages.clear();
|
||||
public void onGameStateChanged(final GameStateChanged state) {
|
||||
final GameState gameState = state.getGameState();
|
||||
if (gameState == GameState.LOGIN_SCREEN || gameState == GameState.CONNECTION_LOST || gameState == GameState.HOPPING) {
|
||||
ClanChatPlugin.clanMembers.clear();
|
||||
this.removeClanCounter();
|
||||
this.clanJoinMessages.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPlayerSpawned(PlayerSpawned event)
|
||||
{
|
||||
if (event.getPlayer().isClanMember())
|
||||
{
|
||||
clanMembers.add(event.getPlayer());
|
||||
addClanCounter();
|
||||
public void onPlayerSpawned(final PlayerSpawned event) {
|
||||
if (event.getPlayer().isClanMember()) {
|
||||
ClanChatPlugin.clanMembers.add(event.getPlayer());
|
||||
this.addClanCounter();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPlayerDespawned(PlayerDespawned event)
|
||||
{
|
||||
if (clanMembers.remove(event.getPlayer()) && clanMembers.isEmpty())
|
||||
{
|
||||
removeClanCounter();
|
||||
public void onPlayerDespawned(final PlayerDespawned event) {
|
||||
if (ClanChatPlugin.clanMembers.remove(event.getPlayer()) && ClanChatPlugin.clanMembers.isEmpty()) {
|
||||
this.removeClanCounter();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onClanChanged(ClanChanged event)
|
||||
{
|
||||
if (event.isJoined())
|
||||
{
|
||||
clanJoinedTick = client.getTickCount();
|
||||
public void onClanChanged(final ClanChanged event) {
|
||||
if (event.isJoined()) {
|
||||
this.clanJoinedTick = this.client.getTickCount();
|
||||
}
|
||||
else
|
||||
{
|
||||
clanMembers.clear();
|
||||
removeClanCounter();
|
||||
else {
|
||||
ClanChatPlugin.clanMembers.clear();
|
||||
this.removeClanCounter();
|
||||
}
|
||||
|
||||
activityBuffer.clear();
|
||||
this.activityBuffer.clear();
|
||||
}
|
||||
|
||||
int getClanAmount()
|
||||
{
|
||||
return clanMembers.size();
|
||||
int getClanAmount() {
|
||||
return ClanChatPlugin.clanMembers.size();
|
||||
}
|
||||
|
||||
private void insertClanRankIcon(final ChatMessage message)
|
||||
{
|
||||
final ClanMemberRank rank = clanManager.getRank(message.getName());
|
||||
|
||||
if (rank != null && rank != ClanMemberRank.UNRANKED)
|
||||
{
|
||||
int iconNumber = clanManager.getIconNumber(rank);
|
||||
private void insertClanRankIcon(final ChatMessage message) {
|
||||
final ClanMemberRank rank = this.clanManager.getRank(message.getName());
|
||||
if (rank != null && rank != ClanMemberRank.UNRANKED) {
|
||||
final int iconNumber = this.clanManager.getIconNumber(rank);
|
||||
final String img = "<img=" + iconNumber + ">";
|
||||
if (message.getType() == ChatMessageType.FRIENDSCHAT)
|
||||
{
|
||||
message.getMessageNode()
|
||||
.setSender(message.getMessageNode().getSender() + " " + img);
|
||||
if (message.getType() == ChatMessageType.FRIENDSCHAT) {
|
||||
message.getMessageNode().setSender(message.getMessageNode().getSender() + " " + img);
|
||||
}
|
||||
else
|
||||
{
|
||||
message.getMessageNode()
|
||||
.setName(img + message.getMessageNode().getName());
|
||||
else {
|
||||
message.getMessageNode().setName(img + message.getMessageNode().getName());
|
||||
}
|
||||
client.refreshChat();
|
||||
this.client.refreshChat();
|
||||
}
|
||||
}
|
||||
|
||||
private void resetClanChats()
|
||||
{
|
||||
Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
|
||||
Widget clanChatTitleWidget = client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
|
||||
|
||||
if (clanChatList == null)
|
||||
{
|
||||
private void resetClanChats() {
|
||||
final Widget clanChatList = this.client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
|
||||
final Widget clanChatTitleWidget = this.client.getWidget(WidgetInfo.CLAN_CHAT_TITLE);
|
||||
if (clanChatList == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (client.getClanChatCount() == 0)
|
||||
{
|
||||
if (this.client.getClanChatCount() == 0) {
|
||||
clanChatList.setChildren(null);
|
||||
}
|
||||
|
||||
clanChatTitleWidget.setText(CLAN_CHAT_TITLE);
|
||||
clanChatTitleWidget.setText("Clan Chat");
|
||||
}
|
||||
|
||||
private void loadClanChats()
|
||||
{
|
||||
Widget clanChatList = client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
|
||||
if (clanChatList == null)
|
||||
{
|
||||
private void loadClanChats() {
|
||||
final Widget clanChatList = this.client.getWidget(WidgetInfo.CLAN_CHAT_LIST);
|
||||
if (clanChatList == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
int y = 2;
|
||||
clanChatList.setChildren(null);
|
||||
for (String chat : Lists.reverse(chats))
|
||||
{
|
||||
Widget widget = clanChatList.createChild(-1, WidgetType.TEXT);
|
||||
for (final String chat : Lists.reverse(this.chats)) {
|
||||
final Widget widget = clanChatList.createChild(-1, 4);
|
||||
widget.setFontId(494);
|
||||
widget.setTextColor(0xffffff);
|
||||
widget.setTextColor(16777215);
|
||||
widget.setText(chat);
|
||||
widget.setOriginalHeight(14);
|
||||
widget.setOriginalWidth(142);
|
||||
widget.setOriginalY(y);
|
||||
widget.setOriginalX(20);
|
||||
widget.revalidate();
|
||||
|
||||
y += 14;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateRecentChat(String s)
|
||||
{
|
||||
if (Strings.isNullOrEmpty(s))
|
||||
{
|
||||
private void updateRecentChat(String s) {
|
||||
if (Strings.isNullOrEmpty(s)) {
|
||||
return;
|
||||
}
|
||||
|
||||
s = Text.toJagexName(s);
|
||||
|
||||
chats.removeIf(s::equalsIgnoreCase);
|
||||
chats.add(s);
|
||||
|
||||
while (chats.size() > MAX_CHATS)
|
||||
{
|
||||
chats.remove(0);
|
||||
final List<String> chats = this.chats;
|
||||
final String s2 = s;
|
||||
Objects.requireNonNull(s2);
|
||||
chats.removeIf(s2::equalsIgnoreCase);
|
||||
this.chats.add(s);
|
||||
while (this.chats.size() > 10) {
|
||||
this.chats.remove(0);
|
||||
}
|
||||
|
||||
config.chatsData(Text.toCSV(chats));
|
||||
this.config.chatsData(Text.toCSV(this.chats));
|
||||
}
|
||||
|
||||
private void removeClanCounter()
|
||||
{
|
||||
infoBoxManager.removeInfoBox(clanMemberCounter);
|
||||
clanMemberCounter = null;
|
||||
private void removeClanCounter() {
|
||||
this.infoBoxManager.removeInfoBox(this.clanMemberCounter);
|
||||
this.clanMemberCounter = null;
|
||||
}
|
||||
|
||||
private void addClanCounter()
|
||||
{
|
||||
if (!config.showClanCounter() || clanMemberCounter != null || clanMembers.isEmpty())
|
||||
{
|
||||
private void addClanCounter() {
|
||||
if (!this.config.showClanCounter() || this.clanMemberCounter != null || ClanChatPlugin.clanMembers.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
final BufferedImage image = this.spriteManager.getSprite(904, 0);
|
||||
this.clanMemberCounter = new ClanChatIndicator(image, this);
|
||||
this.infoBoxManager.addInfoBox(this.clanMemberCounter);
|
||||
}
|
||||
|
||||
final BufferedImage image = spriteManager.getSprite(SpriteID.TAB_CLAN_CHAT, 0);
|
||||
clanMemberCounter = new ClanChatIndicator(image, this);
|
||||
infoBoxManager.addInfoBox(clanMemberCounter);
|
||||
static {
|
||||
ClanChatPlugin.clanMembers = new CopyOnWriteArrayList<Player>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ import java.util.concurrent.ScheduledExecutorService;
|
||||
name = "Equipment Inspector",
|
||||
description = "Inspects enemy equipment",
|
||||
enabledByDefault = false,
|
||||
type = "PVP"
|
||||
type = "utility"
|
||||
)
|
||||
|
||||
@Slf4j
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package net.runelite.client.plugins.fkeyremapping;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Keybind;
|
||||
|
||||
@ConfigGroup("fkeyremapping")
|
||||
public interface fKeyRemappingConfig extends Config {
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "F1",
|
||||
name = "F1 Key",
|
||||
description = "The key which will replace F1."
|
||||
)
|
||||
default Keybind f1()
|
||||
{
|
||||
return new Keybind(KeyEvent.VK_Q, 0);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "F2",
|
||||
name = "F2 key",
|
||||
description = "The key which will replace F2."
|
||||
)
|
||||
default Keybind f2()
|
||||
{
|
||||
return new Keybind(KeyEvent.VK_W, 0);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "F3",
|
||||
name = "F3 key",
|
||||
description = "The key which will replace F3."
|
||||
)
|
||||
default Keybind f3()
|
||||
{
|
||||
return new Keybind(KeyEvent.VK_E, 0);
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "F4",
|
||||
name = "F4 Key key",
|
||||
description = "The key which will replace F4."
|
||||
)
|
||||
default Keybind f4()
|
||||
{
|
||||
return new Keybind(KeyEvent.VK_R, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
package net.runelite.client.plugins.fkeyremapping;
|
||||
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.input.KeyListener;
|
||||
import net.runelite.client.input.MouseAdapter;
|
||||
|
||||
class fKeyRemappingListener extends MouseAdapter implements KeyListener
|
||||
{
|
||||
@Inject
|
||||
private fKeyRemappingPlugin plugin;
|
||||
|
||||
@Inject
|
||||
private fKeyRemappingConfig config;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
private final Map<Integer, Integer> modified = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public void keyTyped(KeyEvent e)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyPressed(KeyEvent e)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !plugin.chatboxFocused())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (config.f1().matches(e))
|
||||
{
|
||||
modified.put(e.getKeyCode(), KeyEvent.VK_F1);
|
||||
e.setKeyCode(KeyEvent.VK_F1);
|
||||
}
|
||||
else if (config.f2().matches(e))
|
||||
{
|
||||
modified.put(e.getKeyCode(), KeyEvent.VK_F2);
|
||||
e.setKeyCode(KeyEvent.VK_F2);
|
||||
}
|
||||
else if (config.f3().matches(e))
|
||||
{
|
||||
modified.put(e.getKeyCode(), KeyEvent.VK_F3);
|
||||
e.setKeyCode(KeyEvent.VK_F3);
|
||||
}
|
||||
else if (config.f4().matches(e))
|
||||
{
|
||||
modified.put(e.getKeyCode(), KeyEvent.VK_F4);
|
||||
e.setKeyCode(KeyEvent.VK_F4);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(KeyEvent e)
|
||||
{
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !plugin.chatboxFocused())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
modified.remove(e.getKeyCode());
|
||||
|
||||
if (config.f1().matches(e))
|
||||
{
|
||||
e.setKeyCode(KeyEvent.VK_F1);
|
||||
}
|
||||
else if (config.f2().matches(e))
|
||||
{
|
||||
e.setKeyCode(KeyEvent.VK_F2);
|
||||
}
|
||||
else if (config.f3().matches(e))
|
||||
{
|
||||
e.setKeyCode(KeyEvent.VK_F3);
|
||||
}
|
||||
else if (config.f4().matches(e))
|
||||
{
|
||||
e.setKeyCode(KeyEvent.VK_F4);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package net.runelite.client.plugins.fkeyremapping;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "fKeyRemapping",
|
||||
description = "Used for interface hotkeys",
|
||||
tags = {"hotkey", "remapping"},
|
||||
enabledByDefault = true
|
||||
)
|
||||
public class fKeyRemappingPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
|
||||
@Inject
|
||||
private fKeyRemappingListener inputListener;
|
||||
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
keyManager.registerKeyListener(inputListener);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
|
||||
|
||||
keyManager.unregisterKeyListener(inputListener);
|
||||
}
|
||||
|
||||
@Provides
|
||||
fKeyRemappingConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(fKeyRemappingConfig.class);
|
||||
}
|
||||
|
||||
boolean chatboxFocused()
|
||||
{
|
||||
Widget chatboxParent = client.getWidget(WidgetInfo.CHATBOX_PARENT);
|
||||
if (chatboxParent == null || chatboxParent.getOnKeyListener() == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// the search box on the world map can be focused, and chat input goes there, even
|
||||
// though the chatbox still has its key listener.
|
||||
Widget worldMapSearch = client.getWidget(WidgetInfo.WORLD_MAP_SEARCH);
|
||||
if (worldMapSearch != null && client.getVar(VarClientInt.WORLD_MAP_SEARCH_FOCUSED) == 1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -17,7 +17,8 @@ import java.util.Map;
|
||||
@PluginDescriptor(
|
||||
name = "Hydra",
|
||||
description = "Hydra Helper",
|
||||
tags = {"Hydra", "Helper"}
|
||||
tags = {"Hydra", "Helper"},
|
||||
type = "PVM"
|
||||
)
|
||||
public class HydraPlugin extends Plugin
|
||||
{
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.139.
|
||||
*/
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.Point;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.ClipboardOwner;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.plugins.pvptools.PvpToolsPlugin;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
|
||||
public class CurrentPlayersJFrame
|
||||
extends JFrame {
|
||||
public JList currentPlayersJList;
|
||||
|
||||
CurrentPlayersJFrame(Client client, PvpToolsPlugin pvpToolsPlugin, List<String> list) {
|
||||
int x = client.getCanvas().getLocationOnScreen().x + client.getCanvas().getWidth();
|
||||
int y = client.getCanvas().getLocationOnScreen().y;
|
||||
JPanel scrollContainerCurrent = new JPanel(new BorderLayout());
|
||||
JScrollPane jScrollPane = new JScrollPane(scrollContainerCurrent);
|
||||
JButton refreshJButton = new JButton("Refresh");
|
||||
refreshJButton.addActionListener(pvpToolsPlugin.currentPlayersActionListener);
|
||||
JButton copyJButton = new JButton("Copy List");
|
||||
this.currentPlayersJList = new JList<Object>(list.toArray());
|
||||
ActionListener copyButtonActionListener = e -> {
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
list.forEach(s -> {
|
||||
stringBuilder.append((String)s);
|
||||
stringBuilder.append(System.getProperty("line.separator"));
|
||||
});
|
||||
StringSelection stringSelection = new StringSelection(stringBuilder.toString());
|
||||
clipboard.setContents(stringSelection, stringSelection);
|
||||
};
|
||||
copyJButton.addActionListener(copyButtonActionListener);
|
||||
this.setTitle("Current CC Members");
|
||||
this.setDefaultCloseOperation(2);
|
||||
JLabel titleLabel = new JLabel("Current CC Members");
|
||||
titleLabel.setFont(FontManager.getRunescapeFont().deriveFont(1, 18.0f));
|
||||
this.currentPlayersJList.setFont(new Font("Arial", 0, 14));
|
||||
scrollContainerCurrent.add((Component)refreshJButton, "North");
|
||||
scrollContainerCurrent.add((Component)titleLabel, "Center");
|
||||
JPanel footerPanel = new JPanel(new BorderLayout());
|
||||
footerPanel.add((Component)this.currentPlayersJList, "North");
|
||||
footerPanel.add((Component)copyJButton, "Center");
|
||||
scrollContainerCurrent.add((Component)footerPanel, "South");
|
||||
this.add(jScrollPane);
|
||||
this.setLocation(x, y);
|
||||
this.setMaximumSize(Toolkit.getDefaultToolkit().getScreenSize());
|
||||
this.pack();
|
||||
this.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.139.
|
||||
*/
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Canvas;
|
||||
import java.awt.Component;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.LayoutManager;
|
||||
import java.awt.Point;
|
||||
import java.awt.Toolkit;
|
||||
import java.awt.datatransfer.Clipboard;
|
||||
import java.awt.datatransfer.ClipboardOwner;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.datatransfer.Transferable;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.util.List;
|
||||
import java.util.function.Consumer;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JList;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JScrollPane;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.plugins.pvptools.PvpToolsPlugin;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
|
||||
public class MissingPlayersJFrame
|
||||
extends JFrame {
|
||||
public JList missingPlayersJList;
|
||||
|
||||
MissingPlayersJFrame(Client client, PvpToolsPlugin pvpToolsPlugin, List<String> list) {
|
||||
int x = client.getCanvas().getLocationOnScreen().x + client.getCanvas().getWidth();
|
||||
int y = client.getCanvas().getLocationOnScreen().y;
|
||||
JPanel scrollConatiner = new JPanel(new BorderLayout());
|
||||
JScrollPane jScrollPane = new JScrollPane(scrollConatiner);
|
||||
JButton refreshJButton = new JButton("Refresh");
|
||||
refreshJButton.addActionListener(pvpToolsPlugin.playersButtonActionListener);
|
||||
JButton copyJButton = new JButton("Copy List");
|
||||
this.missingPlayersJList = new JList<Object>(list.toArray());
|
||||
ActionListener copyButtonActionListener = e -> {
|
||||
Clipboard clipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
list.forEach(s -> {
|
||||
stringBuilder.append((String)s);
|
||||
stringBuilder.append(System.getProperty("line.separator"));
|
||||
});
|
||||
StringSelection stringSelection = new StringSelection(stringBuilder.toString());
|
||||
clipboard.setContents(stringSelection, stringSelection);
|
||||
};
|
||||
copyJButton.addActionListener(copyButtonActionListener);
|
||||
this.setTitle("Missing CC Members");
|
||||
this.setDefaultCloseOperation(2);
|
||||
JLabel titleLabel = new JLabel("Missing CC Members");
|
||||
titleLabel.setFont(FontManager.getRunescapeFont().deriveFont(1, 18.0f));
|
||||
this.missingPlayersJList.setFont(new Font("Arial", 0, 14));
|
||||
scrollConatiner.add((Component)refreshJButton, "North");
|
||||
scrollConatiner.add((Component)titleLabel, "Center");
|
||||
JPanel footerPanel = new JPanel(new BorderLayout());
|
||||
footerPanel.add((Component)this.missingPlayersJList, "North");
|
||||
footerPanel.add((Component)copyJButton, "Center");
|
||||
scrollConatiner.add((Component)footerPanel, "South");
|
||||
this.add(jScrollPane);
|
||||
this.setLocation(x, y);
|
||||
this.setMaximumSize(Toolkit.getDefaultToolkit().getScreenSize());
|
||||
this.pack();
|
||||
this.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.139.
|
||||
*/
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
import net.runelite.client.config.Keybind;
|
||||
|
||||
@ConfigGroup(value="pvptools")
|
||||
public interface PvpToolsConfig
|
||||
extends Config {
|
||||
@ConfigItem(keyName="countPlayers", name="Count Players", description="When in PvP zones, counts the attackable players in and not in player's CC", position=3)
|
||||
default public boolean countPlayers() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="countOverHeads", name="Count Enemy Overheads", description="Counts the number of each protection prayer attackable targets not in your CC are currently using", position=4)
|
||||
default public boolean countOverHeads() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="fallInHelper", name="Fall In Helper", description="Hides all non-friendly player entities other than the one that is attacking you.", position=5)
|
||||
default public boolean fallInHelper() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="hotkey", name="Fall In Hotkey", description="Turns the fall in helper on or off when you press this hotkey", position=6)
|
||||
default public Keybind hotkey() {
|
||||
return Keybind.NOT_SET;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="attackOptionsClan", name="Hide CC Attack Option", description="Hides the attack option for people in the same CC", position=7)
|
||||
default public boolean attackOptionsClan() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="attackOptionsFriend", name="Hide Friend Attack Options", description="Hides the attack option for people on your friends list", position=8)
|
||||
default public boolean attackOptionsFriend() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="attackOptionsHotkey", name="Attack Option Hotkey", description="Enables a hotkey for attack options to disable or enable hiding quickly", position=10)
|
||||
default public Keybind attackOptionsHotkey() {
|
||||
return Keybind.CTRL;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="levelRangeAttackOptions", name="Hide Other Attack Options", description="Hides the attack option for people that are outside your level range", position=9)
|
||||
default public boolean levelRangeAttackOptions() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="riskCalculator", name="Risk Calculator", description="Enables a panel in the PvP Tools Panel that shows the players current risk", position=13)
|
||||
default public boolean riskCalculatorEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="missingPlayers", name="Missing CC Players", description="Adds a button to the PvP Tools panel that opens a window showing which CC members are not at the current players location", position=14)
|
||||
default public boolean missingPlayersEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(keyName="currentPlayers", name="Current CC Players", description="Adds a button to the PvP Tools panel that opens a window showing which CC members currently at the players location", position=15)
|
||||
default public boolean currentPlayersEnabled() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.139.
|
||||
*/
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.awt.Shape;
|
||||
import java.awt.Stroke;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.plugins.pvptools.PvpToolsConfig;
|
||||
import net.runelite.client.plugins.pvptools.PvpToolsPlugin;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
public class PvpToolsOverlay
|
||||
extends Overlay {
|
||||
private PvpToolsPlugin pvpToolsPlugin;
|
||||
private PvpToolsConfig pvpToolsConfig;
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private PvpToolsOverlay(PvpToolsConfig pvpToolsConfig, PvpToolsPlugin pvpToolsPlugin, Client client) {
|
||||
this.pvpToolsPlugin = pvpToolsPlugin;
|
||||
this.pvpToolsConfig = pvpToolsConfig;
|
||||
this.client = client;
|
||||
this.setLayer(OverlayLayer.ABOVE_WIDGETS);
|
||||
this.setPriority(OverlayPriority.HIGH);
|
||||
this.setPosition(OverlayPosition.DYNAMIC);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (this.pvpToolsConfig.fallInHelper() && this.pvpToolsPlugin.fallinHelperEnabled) {
|
||||
graphics.setFont(FontManager.getRunescapeFont().deriveFont(28));
|
||||
OverlayUtil.renderTextLocation(graphics, new Point(200, 80), "FALL IN HELPER ENABLED", Color.YELLOW);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderPoly(Graphics2D graphics, Color color, Polygon polygon) {
|
||||
if (polygon != null) {
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2.0f));
|
||||
graphics.draw(polygon);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||
graphics.fill(polygon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
/*
|
||||
* Decompiled with CFR 0.139.
|
||||
*/
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import com.google.common.base.MoreObjects;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Color;
|
||||
import java.awt.Component;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.LayoutManager;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.Box;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.border.Border;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import net.runelite.client.RuneLiteProperties;
|
||||
import net.runelite.client.plugins.info.JRichTextPane;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.PluginPanel;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
public class PvpToolsPanel
|
||||
extends PluginPanel {
|
||||
private static final Logger log = LoggerFactory.getLogger(PvpToolsPanel.class);
|
||||
private final JLabel loggedLabel = new JLabel();
|
||||
private final JRichTextPane emailLabel = new JRichTextPane();
|
||||
public JLabel numCC = new JLabel();
|
||||
public JLabel numOther = new JLabel();
|
||||
public JLabel numMageJLabel = new JLabel(" ");
|
||||
public JLabel numRangeJLabel = new JLabel(" ");
|
||||
public JLabel numMeleeJLabel = new JLabel(" ");
|
||||
public JLabel totalRiskLabel = new JLabel(" ");
|
||||
public JLabel riskProtectingItem = new JLabel(" ");
|
||||
public JLabel biggestItemLabel = new JLabel("Protected Item: ");
|
||||
public JButton missingPlayers = new JButton("Show missing CC members");
|
||||
public JButton currentPlayers = new JButton("Show current CC members");
|
||||
public JLabel numBrews = new JLabel();
|
||||
@Inject
|
||||
private JPanel pvpToolsPanel = new JPanel(new GridLayout(11, 1));
|
||||
private JPanel missingPlayersPanel = new JPanel();
|
||||
private JPanel currentPlayersPanel = new JPanel();
|
||||
|
||||
public static String htmlLabel(String key, String value) {
|
||||
return "<html><body style = 'color:#a5a5a5'>" + key + "<span style = 'color:white'>" + value + "</span></body></html>";
|
||||
}
|
||||
|
||||
void init() {
|
||||
this.setLayout(new BorderLayout());
|
||||
this.setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||
this.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
JPanel versionPanel = new JPanel();
|
||||
versionPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
versionPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
versionPanel.setLayout(new GridLayout(0, 1));
|
||||
JPanel riskPanel = new JPanel();
|
||||
riskPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
riskPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
riskPanel.setLayout(new GridLayout(0, 1));
|
||||
Font smallFont = FontManager.getRunescapeSmallFont();
|
||||
this.numCC.setText(PvpToolsPanel.htmlLabel("Friendly Player Count: ", "0"));
|
||||
this.numOther.setText(PvpToolsPanel.htmlLabel("Other Player Count: ", "0"));
|
||||
this.numBrews.setText(PvpToolsPanel.htmlLabel("Player brew count: ", "0"));
|
||||
this.numMageJLabel.setText(PvpToolsPanel.htmlLabel("Enemies Praying Mage: ", "0"));
|
||||
this.numMageJLabel.setFont(FontManager.getRunescapeFont());
|
||||
this.numRangeJLabel.setText(PvpToolsPanel.htmlLabel("Enemies Praying Range: ", "0"));
|
||||
this.numRangeJLabel.setFont(FontManager.getRunescapeFont());
|
||||
this.numMeleeJLabel.setText(PvpToolsPanel.htmlLabel("Enemies Praying Melee: ", "0"));
|
||||
this.numMeleeJLabel.setFont(FontManager.getRunescapeFont());
|
||||
this.totalRiskLabel.setText(PvpToolsPanel.htmlLabel("Total risk: ", "0"));
|
||||
this.totalRiskLabel.setFont(FontManager.getRunescapeFont());
|
||||
this.riskProtectingItem.setText(PvpToolsPanel.htmlLabel("Risk Protecting Item: ", "0"));
|
||||
this.riskProtectingItem.setFont(FontManager.getRunescapeFont());
|
||||
this.biggestItemLabel.setText("Most Valuable Item: ");
|
||||
JLabel revision = new JLabel();
|
||||
revision.setFont(smallFont);
|
||||
revision.setText("Oldschool revision: ");
|
||||
JLabel launcher = new JLabel(PvpToolsPanel.htmlLabel("Launcher version: ", MoreObjects.firstNonNull(RuneLiteProperties.getLauncherVersion(), "Unknown")));
|
||||
launcher.setFont(smallFont);
|
||||
this.loggedLabel.setForeground(ColorScheme.LIGHT_GRAY_COLOR);
|
||||
this.loggedLabel.setFont(smallFont);
|
||||
this.emailLabel.setForeground(Color.WHITE);
|
||||
this.emailLabel.setFont(smallFont);
|
||||
versionPanel.add(this.numCC);
|
||||
versionPanel.add(this.numOther);
|
||||
versionPanel.add(this.numBrews);
|
||||
versionPanel.add(this.numMageJLabel);
|
||||
versionPanel.add(this.numRangeJLabel);
|
||||
versionPanel.add(this.numMeleeJLabel);
|
||||
versionPanel.add(Box.createGlue());
|
||||
versionPanel.add(this.loggedLabel);
|
||||
versionPanel.add(this.emailLabel);
|
||||
riskPanel.add(this.totalRiskLabel);
|
||||
riskPanel.add(this.riskProtectingItem);
|
||||
riskPanel.add(this.biggestItemLabel);
|
||||
this.add((Component)versionPanel, "North");
|
||||
this.add((Component)riskPanel, "Center");
|
||||
this.currentPlayers.setVisible(false);
|
||||
this.missingPlayers.setVisible(false);
|
||||
this.missingPlayersPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
this.missingPlayersPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
this.missingPlayersPanel.setLayout(new GridLayout(0, 1));
|
||||
this.missingPlayersPanel.add((Component)this.missingPlayers, "Last");
|
||||
this.missingPlayersPanel.add((Component)this.currentPlayers, "Last");
|
||||
this.add((Component)this.missingPlayersPanel, "Last");
|
||||
}
|
||||
|
||||
public void disablePlayerCount() {
|
||||
this.numOther.setText("Disabled");
|
||||
this.numCC.setText("Disabled");
|
||||
this.numCC.repaint();
|
||||
this.numOther.repaint();
|
||||
}
|
||||
|
||||
public void disablePrayerCount() {
|
||||
this.numMageJLabel.setText("disabled");
|
||||
this.numRangeJLabel.setText("disabled");
|
||||
this.numMeleeJLabel.setText("disabled");
|
||||
this.numMageJLabel.repaint();
|
||||
this.numRangeJLabel.repaint();
|
||||
this.numMeleeJLabel.repaint();
|
||||
}
|
||||
|
||||
public void disableRiskCalculator() {
|
||||
this.totalRiskLabel.setText("disabled");
|
||||
this.riskProtectingItem.setText("disabled");
|
||||
this.biggestItemLabel.setText("disabled");
|
||||
this.totalRiskLabel.repaint();
|
||||
this.riskProtectingItem.repaint();
|
||||
this.biggestItemLabel.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,475 @@
|
||||
package net.runelite.client.plugins.pvptools;
|
||||
|
||||
import javax.inject.*;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import net.runelite.client.plugins.*;
|
||||
import net.runelite.client.plugins.clanchat.*;
|
||||
import java.util.function.*;
|
||||
import java.awt.event.*;
|
||||
import java.util.stream.*;
|
||||
import java.util.concurrent.*;
|
||||
import net.runelite.client.config.*;
|
||||
import com.google.inject.*;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
import net.runelite.client.input.*;
|
||||
import net.runelite.client.ui.*;
|
||||
import java.awt.image.*;
|
||||
import net.runelite.client.eventbus.*;
|
||||
import org.apache.commons.lang3.*;
|
||||
import net.runelite.api.events.*;
|
||||
import net.runelite.client.util.*;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.client.game.*;
|
||||
import java.util.*;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "PvP Tools",
|
||||
description = "Enable the PvP Tools panel",
|
||||
tags = { "panel", "pvp", "pk", "pklite" },
|
||||
type="PVP"
|
||||
)
|
||||
public class PvpToolsPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
PvpToolsOverlay pvpToolsOverlay;
|
||||
boolean fallinHelperEnabled;
|
||||
private PvpToolsPanel panel;
|
||||
private MissingPlayersJFrame missingPlayersJFrame;
|
||||
private CurrentPlayersJFrame currentPlayersJFrame;
|
||||
private NavigationButton navButton;
|
||||
private boolean attackHotKeyPressed;
|
||||
private boolean hideAll;
|
||||
@Inject
|
||||
private ScheduledExecutorService executorService;
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private ItemManager itemManager;
|
||||
private PvpToolsPlugin uhPvpToolsPlugin;
|
||||
final ActionListener playersButtonActionListener;
|
||||
final ActionListener currentPlayersActionListener;
|
||||
@Inject
|
||||
private ClientToolbar clientToolbar;
|
||||
@Inject
|
||||
private KeyManager keyManager;
|
||||
@Inject
|
||||
private PvpToolsConfig config;
|
||||
@Inject
|
||||
private PluginManager pluginManager;
|
||||
@Inject
|
||||
private ClanManager clanManager;
|
||||
private ClanChatPlugin clanChatPlugin;
|
||||
private final HotkeyListener hotkeyListener;
|
||||
private final HotkeyListener attackOptionsHotKeyListener;
|
||||
private int[] overheadCount;
|
||||
private Comparator<Item> itemPriceComparator;
|
||||
private String mtarget;
|
||||
|
||||
public PvpToolsPlugin() {
|
||||
this.fallinHelperEnabled = false;
|
||||
this.uhPvpToolsPlugin = this;
|
||||
this.playersButtonActionListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (PvpToolsPlugin.this.missingPlayersJFrame != null) {
|
||||
PvpToolsPlugin.this.missingPlayersJFrame.dispose();
|
||||
PvpToolsPlugin.this.missingPlayersJFrame = null;
|
||||
PvpToolsPlugin.this.missingPlayersJFrame = new MissingPlayersJFrame(PvpToolsPlugin.this.client, PvpToolsPlugin.this.uhPvpToolsPlugin, PvpToolsPlugin.this.getMissingMembers());
|
||||
}
|
||||
else {
|
||||
PvpToolsPlugin.this.missingPlayersJFrame = new MissingPlayersJFrame(PvpToolsPlugin.this.client, PvpToolsPlugin.this.uhPvpToolsPlugin, PvpToolsPlugin.this.getMissingMembers());
|
||||
}
|
||||
}
|
||||
};
|
||||
this.currentPlayersActionListener = new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(final ActionEvent e) {
|
||||
if (PvpToolsPlugin.this.currentPlayersJFrame != null) {
|
||||
PvpToolsPlugin.this.currentPlayersJFrame.dispose();
|
||||
PvpToolsPlugin.this.currentPlayersJFrame = null;
|
||||
PvpToolsPlugin.this.currentPlayersJFrame = new CurrentPlayersJFrame(PvpToolsPlugin.this.client, PvpToolsPlugin.this.uhPvpToolsPlugin, PvpToolsPlugin.this.getCurrentMembers());
|
||||
}
|
||||
else {
|
||||
PvpToolsPlugin.this.currentPlayersJFrame = new CurrentPlayersJFrame(PvpToolsPlugin.this.client, PvpToolsPlugin.this.uhPvpToolsPlugin, PvpToolsPlugin.this.getCurrentMembers());
|
||||
}
|
||||
}
|
||||
};
|
||||
this.hotkeyListener = new HotkeyListener(() -> this.config.hotkey()) {
|
||||
@Override
|
||||
public void hotkeyPressed() {
|
||||
PvpToolsPlugin.this.toggleFallinHelper();
|
||||
}
|
||||
};
|
||||
this.attackOptionsHotKeyListener = new HotkeyListener(() -> this.config.attackOptionsHotkey()) {
|
||||
long lastPress = 0L;
|
||||
|
||||
@Override
|
||||
public void keyPressed(final KeyEvent e) {
|
||||
PvpToolsPlugin.this.attackHotKeyPressed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void keyReleased(final KeyEvent e) {
|
||||
PvpToolsPlugin.this.attackHotKeyPressed = (System.currentTimeMillis() - this.lastPress < 800L);
|
||||
this.lastPress = System.currentTimeMillis();
|
||||
}
|
||||
};
|
||||
this.overheadCount = new int[] { 0, 0, 0 };
|
||||
this.itemPriceComparator = new Comparator<Item>() {
|
||||
@Override
|
||||
public int compare(final Item o1, final Item o2) {
|
||||
return PvpToolsPlugin.this.itemManager.getItemPrice(PvpToolsPlugin.this.itemManager.getItemComposition(o1.getId()).getPrice()) - PvpToolsPlugin.this.itemManager.getItemPrice(PvpToolsPlugin.this.itemManager.getItemComposition(o2.getId()).getPrice());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public List getMissingMembers() {
|
||||
CopyOnWriteArrayList<Player> ccMembers = ClanChatPlugin.getClanMembers();
|
||||
ArrayList<String> missingMembers = new ArrayList<String>();
|
||||
for (ClanMember clanMember : this.client.getClanMembers()) {
|
||||
List arrayList;
|
||||
if (Objects.isNull(clanMember) || (arrayList = ccMembers.stream().map(player -> Text.removeTags(Text.standardize(player.getName()))).collect(Collectors.toList())).contains(Text.removeTags(Text.standardize(clanMember.getUsername()))) || missingMembers.contains(clanMember.getUsername())) continue;
|
||||
missingMembers.add("[W" + clanMember.getWorld() + "] - " + clanMember.getUsername());
|
||||
}
|
||||
return missingMembers;
|
||||
}
|
||||
|
||||
public List getCurrentMembers() {
|
||||
CopyOnWriteArrayList<Player> ccMembers = ClanChatPlugin.getClanMembers();
|
||||
ArrayList<String> currentMembers = new ArrayList<String>();
|
||||
for (ClanMember clanMember : this.client.getClanMembers()) {
|
||||
List arrayList;
|
||||
if (Objects.isNull(clanMember) || !(arrayList = ccMembers.stream().map(player -> Text.removeTags(Text.standardize(player.getName()))).collect(Collectors.toList())).contains(Text.removeTags(Text.standardize(clanMember.getUsername()))) || currentMembers.contains(clanMember.getUsername())) continue;
|
||||
currentMembers.add(clanMember.getUsername());
|
||||
}
|
||||
return currentMembers;
|
||||
}
|
||||
|
||||
@Provides
|
||||
PvpToolsConfig config(final ConfigManager configManager) {
|
||||
return configManager.getConfig(PvpToolsConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception {
|
||||
this.overlayManager.add(this.pvpToolsOverlay);
|
||||
this.keyManager.registerKeyListener(this.hotkeyListener);
|
||||
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(this.getClass(), "skull.png");
|
||||
(this.panel = new PvpToolsPanel()).init();
|
||||
this.navButton = NavigationButton.builder().tooltip("PvP Tools").icon(icon).priority(5).panel(this.panel).build();
|
||||
this.panel.missingPlayers.addActionListener(this.playersButtonActionListener);
|
||||
this.panel.currentPlayers.addActionListener(this.currentPlayersActionListener);
|
||||
this.clientToolbar.addNavigation(this.navButton);
|
||||
this.keyManager.registerKeyListener(this.attackOptionsHotKeyListener);
|
||||
if (this.config.missingPlayersEnabled()) {
|
||||
this.panel.missingPlayers.setVisible(true);
|
||||
}
|
||||
if (this.config.currentPlayersEnabled()) {
|
||||
this.panel.currentPlayers.setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception {
|
||||
this.overlayManager.remove(this.pvpToolsOverlay);
|
||||
this.keyManager.unregisterKeyListener(this.hotkeyListener);
|
||||
this.keyManager.unregisterKeyListener(this.attackOptionsHotKeyListener);
|
||||
this.clientToolbar.removeNavigation(this.navButton);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(final ConfigChanged configChanged) {
|
||||
if (configChanged.getGroup().equals("pvptools")) {
|
||||
final String key = configChanged.getKey();
|
||||
switch (key) {
|
||||
case "countPlayers": {
|
||||
if (this.config.countPlayers()) {
|
||||
this.updatePlayers();
|
||||
}
|
||||
if (!this.config.countPlayers()) {
|
||||
this.panel.disablePlayerCount();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "countOverHeads": {
|
||||
if (this.config.countOverHeads()) {
|
||||
this.countOverHeads();
|
||||
}
|
||||
if (!this.config.countOverHeads()) {
|
||||
this.panel.disablePrayerCount();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "riskCalculator": {
|
||||
if (this.config.riskCalculatorEnabled()) {
|
||||
this.getCarriedWealth();
|
||||
}
|
||||
if (!this.config.riskCalculatorEnabled()) {
|
||||
this.panel.disableRiskCalculator();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "missingPlayers": {
|
||||
if (this.config.missingPlayersEnabled()) {
|
||||
this.panel.missingPlayers.setVisible(true);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "currentPlayers": {
|
||||
if (this.config.currentPlayersEnabled()) {
|
||||
this.panel.currentPlayers.setVisible(true);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onItemContainerChanged(final ItemContainerChanged event) {
|
||||
if (event.getItemContainer().equals(this.client.getItemContainer(InventoryID.INVENTORY)) && this.config.riskCalculatorEnabled()) {
|
||||
this.getCarriedWealth();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(final GameStateChanged event) {
|
||||
if (event.getGameState().equals(GameState.LOGGED_IN) && this.config.riskCalculatorEnabled()) {
|
||||
this.getCarriedWealth();
|
||||
}
|
||||
if (event.getGameState().equals(GameState.LOGGED_IN) && this.config.countPlayers()) {
|
||||
this.updatePlayers();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPlayerSpawned(final PlayerSpawned event) {
|
||||
if (this.config.countPlayers() && PvPUtil.isAttackable(this.client, event.getPlayer())) {
|
||||
this.updatePlayers();
|
||||
}
|
||||
if (this.config.countOverHeads()) {
|
||||
this.countOverHeads();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onPlayerDespawned(final PlayerDespawned event) {
|
||||
if (this.config.countPlayers() && PvPUtil.isAttackable(this.client, event.getPlayer())) {
|
||||
this.updatePlayers();
|
||||
}
|
||||
if (this.config.countOverHeads()) {
|
||||
this.countOverHeads();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(final MenuEntryAdded menuEntryAdded) {
|
||||
if (!this.attackHotKeyPressed && (this.config.attackOptionsFriend() || this.config.attackOptionsClan() || this.config.levelRangeAttackOptions())) {
|
||||
if (this.client.getGameState() != GameState.LOGGED_IN) {
|
||||
return;
|
||||
}
|
||||
final Player[] players = this.client.getCachedPlayers();
|
||||
Player player = null;
|
||||
final int identifier = menuEntryAdded.getIdentifier();
|
||||
if (identifier >= 0 && identifier < players.length) {
|
||||
player = players[identifier];
|
||||
}
|
||||
if (player == null) {
|
||||
return;
|
||||
}
|
||||
final String option = Text.removeTags(menuEntryAdded.getOption()).toLowerCase();
|
||||
final String mtarget = Text.removeTags(menuEntryAdded.getTarget()).toLowerCase();
|
||||
if ((this.attackHotKeyPressed && this.config.attackOptionsClan()) || this.config.attackOptionsFriend() || this.config.levelRangeAttackOptions()) {
|
||||
if (this.config.attackOptionsFriend() && player.isFriend()) {
|
||||
this.moveEntry(mtarget);
|
||||
}
|
||||
if (this.config.attackOptionsClan() && player.isClanMember()) {
|
||||
this.moveEntry(mtarget);
|
||||
}
|
||||
if (this.config.levelRangeAttackOptions() && !PvPUtil.isAttackable(this.client, player)) {
|
||||
this.moveEntry(mtarget);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void moveEntry(final String mtarget) {
|
||||
this.mtarget = mtarget;
|
||||
MenuEntry[] menuEntries = this.client.getMenuEntries();
|
||||
final MenuEntry lastEntry = menuEntries[menuEntries.length - 1];
|
||||
String target = lastEntry.getTarget();
|
||||
final int idx = target.indexOf(62);
|
||||
if (idx != -1) {
|
||||
target = target.substring(idx + 1);
|
||||
}
|
||||
if (menuEntries[menuEntries.length - 1] != null) {}
|
||||
if (lastEntry.getOption().contains("attack".toLowerCase())) {
|
||||
menuEntries = ArrayUtils.remove(menuEntries, menuEntries.length - 1);
|
||||
}
|
||||
if (lastEntry.getOption().equals("Attack")) {
|
||||
menuEntries = ArrayUtils.remove(menuEntries, menuEntries.length - 1);
|
||||
}
|
||||
this.client.setMenuEntries(menuEntries);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onFocusChanged(final FocusChanged focusChanged) {
|
||||
if (!focusChanged.isFocused()) {
|
||||
this.setAttackHotKeyPressed(false);
|
||||
}
|
||||
}
|
||||
|
||||
private void toggleFallinHelper() {
|
||||
if (!this.fallinHelperEnabled) {
|
||||
this.client.setIsHidingEntities(true);
|
||||
this.client.setPlayersHidden(true);
|
||||
this.fallinHelperEnabled = true;
|
||||
}
|
||||
else {
|
||||
this.client.setIsHidingEntities(false);
|
||||
this.client.setPlayersHidden(false);
|
||||
this.fallinHelperEnabled = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void updatePrayerNumbers() {
|
||||
this.panel.numMageJLabel.setText(PvpToolsPanel.htmlLabel("Enemies Praying Mage: ", String.valueOf(this.overheadCount[0])));
|
||||
this.panel.numRangeJLabel.setText(PvpToolsPanel.htmlLabel("Enemies Praying Range: ", String.valueOf(this.overheadCount[1])));
|
||||
this.panel.numMeleeJLabel.setText(PvpToolsPanel.htmlLabel("Enemies Praying Melee: ", String.valueOf(this.overheadCount[2])));
|
||||
this.panel.numMageJLabel.repaint();
|
||||
this.panel.numRangeJLabel.repaint();
|
||||
this.panel.numMeleeJLabel.repaint();
|
||||
}
|
||||
|
||||
private void updatePlayers() {
|
||||
if (this.config.countPlayers()) {
|
||||
int cc = 0;
|
||||
int other = 0;
|
||||
for (final Player p : this.client.getPlayers()) {
|
||||
if (Objects.nonNull(p) && PvPUtil.isAttackable(this.client, p)) {
|
||||
if (p.isClanMember()) {
|
||||
++cc;
|
||||
}
|
||||
else {
|
||||
++other;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.panel.numOther.setText(PvpToolsPanel.htmlLabel("Other Player Count: ", String.valueOf(other)));
|
||||
this.panel.numCC.setText(PvpToolsPanel.htmlLabel("Friendly Player Count: ", String.valueOf(cc)));
|
||||
this.panel.numCC.repaint();
|
||||
this.panel.numOther.repaint();
|
||||
}
|
||||
}
|
||||
|
||||
private void countOverHeads() {
|
||||
this.overheadCount = new int[] { 0, 0, 0 };
|
||||
for (final Player p : this.client.getPlayers()) {
|
||||
if (Objects.nonNull(p) && PvPUtil.isAttackable(this.client, p) && !p.isClanMember() && p.getOverheadIcon() != null) {
|
||||
switch (p.getOverheadIcon()) {
|
||||
case MAGIC: {
|
||||
final int[] overheadCount = this.overheadCount;
|
||||
final int n = 0;
|
||||
++overheadCount[n];
|
||||
continue;
|
||||
}
|
||||
case RANGED: {
|
||||
final int[] overheadCount2 = this.overheadCount;
|
||||
final int n2 = 1;
|
||||
++overheadCount2[n2];
|
||||
continue;
|
||||
}
|
||||
case MELEE: {
|
||||
final int[] overheadCount3 = this.overheadCount;
|
||||
final int n3 = 2;
|
||||
++overheadCount3[n3];
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.updatePrayerNumbers();
|
||||
}
|
||||
|
||||
private void getCarriedWealth() {
|
||||
if (!this.config.riskCalculatorEnabled()) {
|
||||
return;
|
||||
}
|
||||
if (this.client.getItemContainer(InventoryID.EQUIPMENT) == null) {
|
||||
return;
|
||||
}
|
||||
if (this.client.getItemContainer(InventoryID.INVENTORY).getItems() == null) {
|
||||
return;
|
||||
}
|
||||
final Item[] items = ArrayUtils.addAll(Objects.requireNonNull(this.client.getItemContainer(InventoryID.EQUIPMENT)).getItems(), Objects.requireNonNull(this.client.getItemContainer(InventoryID.INVENTORY)).getItems());
|
||||
final TreeMap<Integer, Item> priceMap = new TreeMap<Integer, Item>(Comparator.comparingInt(Integer::intValue));
|
||||
int wealth = 0;
|
||||
for (final Item i : items) {
|
||||
int value = this.itemManager.getItemPrice(i.getId()) * i.getQuantity();
|
||||
final ItemComposition itemComposition = this.itemManager.getItemComposition(i.getId());
|
||||
if (!itemComposition.isTradeable() && value == 0) {
|
||||
value = itemComposition.getPrice() * i.getQuantity();
|
||||
priceMap.put(value, i);
|
||||
}
|
||||
else {
|
||||
value = this.itemManager.getItemPrice(i.getId()) * i.getQuantity();
|
||||
if (i.getId() > 0 && value > 0) {
|
||||
priceMap.put(value, i);
|
||||
}
|
||||
}
|
||||
wealth += value;
|
||||
}
|
||||
this.panel.totalRiskLabel.setText(PvpToolsPanel.htmlLabel("Total risk: ", StackFormatter.quantityToRSDecimalStack(wealth)));
|
||||
this.panel.totalRiskLabel.repaint();
|
||||
int itemLimit = 0;
|
||||
if (this.client.getLocalPlayer().getSkullIcon() != null && this.client.getLocalPlayer().getSkullIcon() == SkullIcon.SKULL) {
|
||||
itemLimit = 1;
|
||||
}
|
||||
if (this.client.getLocalPlayer().getSkullIcon() == null) {
|
||||
itemLimit = 4;
|
||||
}
|
||||
AsyncBufferedImage itemImage = null;
|
||||
final NavigableMap<Integer, Item> descendingMap = priceMap.descendingMap();
|
||||
for (int j = 0; j < itemLimit; ++j) {
|
||||
if (j == 0) {
|
||||
if (!descendingMap.isEmpty()) {
|
||||
itemImage = this.itemManager.getImage(descendingMap.pollFirstEntry().getValue().getId());
|
||||
}
|
||||
}
|
||||
else if (!descendingMap.isEmpty()) {
|
||||
this.itemManager.getItemComposition(priceMap.descendingMap().pollFirstEntry().getValue().getId()).getName();
|
||||
}
|
||||
}
|
||||
this.panel.riskProtectingItem.setText(PvpToolsPanel.htmlLabel("Risk Protecting Item: ", StackFormatter.quantityToRSDecimalStack(descendingMap.keySet().stream().mapToInt(Integer::intValue).sum())));
|
||||
this.panel.riskProtectingItem.repaint();
|
||||
this.panel.biggestItemLabel.setText("Most Valuable Item: ");
|
||||
if (itemImage != null) {
|
||||
itemImage.addTo(this.panel.biggestItemLabel);
|
||||
}
|
||||
this.panel.biggestItemLabel.repaint();
|
||||
}
|
||||
|
||||
boolean isAttackHotKeyPressed() {
|
||||
return this.attackHotKeyPressed;
|
||||
}
|
||||
|
||||
void setAttackHotKeyPressed(final boolean attackHotKeyPressed) {
|
||||
this.attackHotKeyPressed = attackHotKeyPressed;
|
||||
}
|
||||
|
||||
boolean isHideAll() {
|
||||
return this.hideAll;
|
||||
}
|
||||
|
||||
void setHideAll(final boolean hideAll) {
|
||||
this.hideAll = hideAll;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 448 B |
@@ -42,7 +42,8 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
@PluginDescriptor(
|
||||
name = "Shayzien Infirmary",
|
||||
description = "Shows the status of wounded soldiers",
|
||||
tags = {"shayzien", "infirmary", "soldiers"}
|
||||
tags = {"shayzien", "infirmary", "soldiers"},
|
||||
type = "utility"
|
||||
)
|
||||
public class ShayzienInfirmaryPlugin extends Plugin
|
||||
{
|
||||
|
||||
@@ -21,7 +21,8 @@ import javax.inject.Inject;
|
||||
@PluginDescriptor(
|
||||
name = "Spellbook Fixer",
|
||||
description = "Resize and filter spellbook for PKing",
|
||||
tags = {"resize", "spellbook", "magic", "spell", "pk", "book", "filter", "bogla"}
|
||||
tags = {"resize", "spellbook", "magic", "spell", "pk", "book", "filter", "bogla"},
|
||||
type = "PVP"
|
||||
)
|
||||
@Slf4j
|
||||
public class SpellbookFixerPlugin extends Plugin
|
||||
|
||||
@@ -44,7 +44,8 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
||||
@PluginDescriptor(
|
||||
name = "Temple Trekking",
|
||||
description = "Helpers for the Temple Trek minigame",
|
||||
tags = {"minigame", "overlay", "temple trek"}
|
||||
tags = {"minigame", "overlay", "temple trek"},
|
||||
type = "utility"
|
||||
)
|
||||
public class TempleTrekPlugin extends Plugin
|
||||
{
|
||||
|
||||
@@ -56,6 +56,7 @@ import net.runelite.client.eventbus.Subscribe;
|
||||
description = "Gives you an estimation damage on a boss and taken after the fight is done" +
|
||||
"the damage will be posted in the chat",
|
||||
tags = {"combat", "npcs", "tob", "damage"},
|
||||
type = "PVM",
|
||||
enabledByDefault = false
|
||||
)
|
||||
|
||||
|
||||
@@ -14,7 +14,13 @@ import net.runelite.api.*;
|
||||
import net.runelite.api.events.*;
|
||||
import java.util.*;
|
||||
|
||||
@PluginDescriptor(name = "<font color=\"aqua\">!Whale Watchers</font>", description = "A Plugin to save help whales in the wild", tags = { "whale watchers", "whale", "protect item", "warning", "pklite" }, enabledByDefault = true, hidden = false, developerPlugin = false, loadWhenOutdated = false)
|
||||
@PluginDescriptor(
|
||||
name = "Whale Watchers",
|
||||
description = "A Plugin to save help whales in the wild",
|
||||
tags = { "whale watchers", "whale", "protect item", "warning", "pklite" },
|
||||
type = "PVP",
|
||||
enabledByDefault = false
|
||||
)
|
||||
public class WhaleWatchersPlugin extends Plugin
|
||||
{
|
||||
@Inject
|
||||
@@ -25,7 +25,8 @@ import net.runelite.client.util.WildernessLocation;
|
||||
|
||||
@PluginDescriptor(name="PvP Wild Locations",
|
||||
description="Indicates the players current location in the wild",
|
||||
tags={"Wildy,", "Wilderness Location", "location", "loc", "pvp", "pklite"})
|
||||
tags={"Wildy,", "Wilderness Location", "location", "loc", "pvp", "pklite"},
|
||||
type = "PVP")
|
||||
|
||||
public class WildernessLocationsPlugin extends Plugin {
|
||||
@Inject
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package net.runelite.client.util;
|
||||
|
||||
import net.runelite.api.ItemComposition;
|
||||
import java.util.TreeMap;
|
||||
import java.util.Comparator;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import java.util.Objects;
|
||||
import net.runelite.api.ItemContainer;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.InventoryID;
|
||||
import net.runelite.client.game.ItemManager;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
|
||||
public class PvPUtil
|
||||
{
|
||||
public PvPUtil() {
|
||||
super();
|
||||
}
|
||||
|
||||
public static int getWildernessLevelFrom(final WorldPoint point) {
|
||||
final int x = point.getX();
|
||||
final int y = point.getY();
|
||||
final int underLevel = (y - 9920) / 8 + 1;
|
||||
final int upperLevel = (y - 3520) / 8 + 1;
|
||||
return (y > 6400) ? underLevel : upperLevel;
|
||||
}
|
||||
|
||||
public static boolean isAttackable(final Client c, final Player p) {
|
||||
return Math.abs(c.getLocalPlayer().getCombatLevel() - p.getCombatLevel()) < getWildernessLevelFrom(c.getLocalPlayer().getWorldLocation());
|
||||
}
|
||||
|
||||
public static int calculateRisk(final Client client, final ItemManager itemManager) {
|
||||
if (client.getItemContainer(InventoryID.EQUIPMENT) == null) {
|
||||
return 0;
|
||||
}
|
||||
if (client.getItemContainer(InventoryID.INVENTORY).getItems() == null) {
|
||||
return 0;
|
||||
}
|
||||
final Item[] items = (Item[])ArrayUtils.<Item>addAll(((ItemContainer)Objects.<ItemContainer>requireNonNull(client.getItemContainer(InventoryID.EQUIPMENT))).getItems(), ((ItemContainer)Objects.<ItemContainer>requireNonNull(client.getItemContainer(InventoryID.INVENTORY))).getItems());
|
||||
final TreeMap<Integer, Item> priceMap = new TreeMap<Integer, Item>(Comparator.<Integer>comparingInt(Integer::intValue));
|
||||
int wealth = 0;
|
||||
for (final Item i : items) {
|
||||
int value = itemManager.getItemPrice(i.getId()) * i.getQuantity();
|
||||
final ItemComposition itemComposition = itemManager.getItemComposition(i.getId());
|
||||
if (!itemComposition.isTradeable() && value == 0) {
|
||||
value = itemComposition.getPrice() * i.getQuantity();
|
||||
priceMap.put(Integer.valueOf(value), i);
|
||||
}
|
||||
else {
|
||||
value = itemManager.getItemPrice(i.getId()) * i.getQuantity();
|
||||
if (i.getId() > 0 && value > 0) {
|
||||
priceMap.put(Integer.valueOf(value), i);
|
||||
}
|
||||
}
|
||||
wealth += value;
|
||||
}
|
||||
return Integer.parseInt(StackFormatter.quantityToRSDecimalStack(priceMap.keySet().stream().mapToInt(Integer::intValue).sum()));
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 448 B |
Reference in New Issue
Block a user