Revert "Update"
This commit is contained in:
@@ -30,7 +30,7 @@ public enum WorldType
|
||||
PVP,
|
||||
BOUNTY,
|
||||
SKILL_TOTAL,
|
||||
HIGH_RISK,
|
||||
PVP_HIGH_RISK,
|
||||
LAST_MAN_STANDING,
|
||||
TOURNAMENT,
|
||||
DEADMAN,
|
||||
|
||||
@@ -32,7 +32,7 @@ enum ServiceWorldType
|
||||
PVP(WorldType.PVP, 1 << 2),
|
||||
BOUNTY(WorldType.BOUNTY, 1 << 5),
|
||||
SKILL_TOTAL(WorldType.SKILL_TOTAL, 1 << 7),
|
||||
HIGH_RISK(WorldType.HIGH_RISK, 1 << 10),
|
||||
PVP_HIGH_RISK(WorldType.PVP_HIGH_RISK, 1 << 10),
|
||||
LAST_MAN_STANDING(WorldType.LAST_MAN_STANDING, 1 << 14),
|
||||
TOURNAMENT(WorldType.TOURNAMENT, 1 << 25),
|
||||
DEADMAN_TOURNAMENT(WorldType.DEADMAN_TOURNAMENT, 1 << 26),
|
||||
|
||||
@@ -49,9 +49,9 @@ public enum WorldType
|
||||
*/
|
||||
SKILL_TOTAL(1 << 7),
|
||||
/**
|
||||
* High risk world type.
|
||||
* Pvp high risk world type.
|
||||
*/
|
||||
HIGH_RISK(1 << 10),
|
||||
PVP_HIGH_RISK(1 << 10),
|
||||
/**
|
||||
* Last man standing world type.
|
||||
*/
|
||||
@@ -84,6 +84,7 @@ public enum WorldType
|
||||
DEADMAN,
|
||||
DEADMAN_TOURNAMENT,
|
||||
PVP,
|
||||
PVP_HIGH_RISK,
|
||||
SEASONAL_DEADMAN
|
||||
);
|
||||
|
||||
|
||||
@@ -121,7 +121,6 @@ public class WidgetID
|
||||
public static final int MINIGAME_TAB_ID = 76;
|
||||
public static final int SPELLBOOK_GROUP_ID = 218;
|
||||
public static final int PVP_GROUP_ID = 90;
|
||||
public static final int FISHING_TRAWLER_GROUP_ID = 366;
|
||||
public static final int ZEAH_MESS_HALL_GROUP_ID = 235;
|
||||
public static final int KOUREND_FAVOUR_GROUP_ID = 246;
|
||||
public static final int LOOTING_BAG_GROUP_ID = 81;
|
||||
|
||||
@@ -420,8 +420,6 @@ public enum WidgetInfo
|
||||
EXPERIENCE_TRACKER_WIDGET(WidgetID.EXPERIENCE_TRACKER_GROUP_ID, WidgetID.ExperienceTracker.WIDGET),
|
||||
EXPERIENCE_TRACKER_BOTTOM_BAR(WidgetID.EXPERIENCE_TRACKER_GROUP_ID, WidgetID.ExperienceTracker.BOTTOM_BAR),
|
||||
|
||||
FISHING_TRAWLER_TIMER(WidgetID.FISHING_TRAWLER_GROUP_ID, 37),
|
||||
|
||||
TITHE_FARM(WidgetID.TITHE_FARM_GROUP_ID, 1),
|
||||
|
||||
BARROWS_INFO(WidgetID.BARROWS_GROUP_ID, 0),
|
||||
|
||||
@@ -81,14 +81,14 @@ class LapCounterOverlay extends Overlay
|
||||
|
||||
panelComponent.getChildren().clear();
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Total Laps:")
|
||||
.left("Total Laps")
|
||||
.right(Integer.toString(session.getTotalLaps()))
|
||||
.build());
|
||||
|
||||
if (session.getLapsTillLevel() > 0)
|
||||
{
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left("Laps until level:")
|
||||
.left("Laps till level")
|
||||
.right(Integer.toString(session.getLapsTillLevel()))
|
||||
.build());
|
||||
}
|
||||
|
||||
@@ -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,512 +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())
|
||||
{
|
||||
final Player local = client.getLocalPlayer();
|
||||
if (member.getWorld() == this.client.getWorld()) {
|
||||
final String memberName = Text.toJagexName(member.getUsername());
|
||||
|
||||
for (final Player player : client.getPlayers())
|
||||
{
|
||||
if (player != null && player != local && 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)
|
||||
{
|
||||
final Player local = client.getLocalPlayer();
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (player != local && player.isClanMember())
|
||||
{
|
||||
clanMembers.add(player);
|
||||
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>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc
|
||||
new CrypticClue("Search the drawers, upstairs in the bank to the East of Varrock.", DRAWERS_7194, new WorldPoint(3250, 3420, 1), "Search the drawers upstairs in Varrock east bank."),
|
||||
new CrypticClue("Speak to Hazelmere.", "Hazelmere", new WorldPoint(2677, 3088, 1), "Located upstairs in the house to the north of fairy ring CLS. Answer: 6859"),
|
||||
new CrypticClue("The effects of this fire are magnified.", new WorldPoint(1179, 3626, 0), "Dig by the fire beside Ket'sal K'uk in the westernmost part of the Kebos Swamp. "),
|
||||
new CrypticClue("Always walking around the castle grounds and somehow knows everyone's age.", "Hans", new WorldPoint(3221, 3218, 0), "Talk to Hans walking around Lumbridge Castle."),
|
||||
new CrypticClue("Always walking around the castle grounds and somehow everyone's age.", "Hans", new WorldPoint(3221, 3218, 0), "Talk to Hans walking around Lumbridge Castle."),
|
||||
new CrypticClue("In the place Duke Horacio calls home, talk to a man with a hat dropped by goblins.", "Cook", new WorldPoint(3208, 3213, 0), "Talk to the Cook in Lumbridge Castle."),
|
||||
new CrypticClue("In a village of barbarians, I am the one who guards the village from up high.", "Hunding", new WorldPoint(3097, 3432, 2), "Talk to Hunding atop the tower on the east side of Barbarian Village."),
|
||||
new CrypticClue("Talk to Charlie the Tramp in Varrock.", "Charlie the Tramp", new WorldPoint(3209, 3390, 0), "Talk to Charlie the Tramp by the southern entrance to Varrock. He will give you a task."),
|
||||
|
||||
@@ -143,9 +143,8 @@ public enum HotColdLocation
|
||||
WILDERNESS_5(new WorldPoint(3169, 3558, 0), WILDERNESS, "North of the Grand Exchange, level 5 Wilderness."),
|
||||
WILDERNESS_12(new WorldPoint(3038, 3612, 0), WILDERNESS, "South-east of the Dark Warriors' Fortress, level 12 Wilderness."),
|
||||
WILDERNESS_20(new WorldPoint(3225, 3676, 0), WILDERNESS, "East of the Corporeal Beast's lair, level 20 Wilderness."),
|
||||
WILDERNESS_27(new WorldPoint(3174, 3735, 0), WILDERNESS, "Inside the Ruins north of the Graveyard of Shadows, level 27 Wilderness."),
|
||||
WILDERNESS_27(new WorldPoint(3174, 3735, 0), WILDERNESS, "North-west of the Corporeal Beast cave, in the ruins at level 27 Wilderness."),
|
||||
WILDERNESS_28(new WorldPoint(3374, 3734, 0), WILDERNESS, "East of Venenatis' nest, level 28 Wilderness."),
|
||||
WILDERNESS_32(new WorldPoint(3311, 3773, 0), WILDERNESS, "North of Venenatis' nest, level 32 Wilderness."),
|
||||
WILDERNESS_35(new WorldPoint(3153, 3795, 0), WILDERNESS, "East of the Wilderness canoe exit, level 35 Wilderness."),
|
||||
WILDERNESS_37(new WorldPoint(2975, 3811, 0), WILDERNESS, "South-east of the Chaos Temple, level 37 Wilderness."),
|
||||
WILDERNESS_38(new WorldPoint(3294, 3817, 0), WILDERNESS, "South of Callisto, level 38 Wilderness."),
|
||||
|
||||
@@ -406,7 +406,10 @@ public class DiscordPlugin extends Plugin
|
||||
final EnumSet<WorldType> worldType = client.getWorldType();
|
||||
|
||||
// Do not show location in PVP activities
|
||||
if (WorldType.isPvpWorld(worldType))
|
||||
if (worldType.contains(WorldType.SEASONAL_DEADMAN) ||
|
||||
worldType.contains(WorldType.DEADMAN) ||
|
||||
worldType.contains(WorldType.PVP) ||
|
||||
worldType.contains(WorldType.PVP_HIGH_RISK))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -118,15 +118,4 @@ public interface FishingConfig extends Config
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "trawlerTimer",
|
||||
name = "Trawler timer in MM:SS",
|
||||
description = "Trawler Timer will display a more accurate timer in MM:SS format."
|
||||
)
|
||||
default boolean trawlerTimer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,10 +57,6 @@ import net.runelite.api.events.ItemContainerChanged;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.Notifier;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
@@ -82,10 +78,8 @@ public class FishingPlugin extends Plugin
|
||||
{
|
||||
private static final int TRAWLER_SHIP_REGION_NORMAL = 7499;
|
||||
private static final int TRAWLER_SHIP_REGION_SINKING = 8011;
|
||||
private static final int TRAWLER_TIME_LIMIT_IN_SECONDS = 614;
|
||||
private static final int TRAWLER_ACTIVITY_THRESHOLD = Math.round(0.15f * 255);
|
||||
|
||||
private Instant trawlerStartTime;
|
||||
private static final int TRAWLER_ACTIVITY_THRESHOLD = Math.round(0.15f * 255);
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final FishingSession session = new FishingSession();
|
||||
@@ -148,7 +142,6 @@ public class FishingPlugin extends Plugin
|
||||
minnowSpots.clear();
|
||||
trawlerNotificationSent = false;
|
||||
currentSpot = null;
|
||||
trawlerStartTime = null;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -303,11 +296,6 @@ public class FishingPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (config.trawlerTimer())
|
||||
{
|
||||
updateTrawlerTimer();
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -363,66 +351,6 @@ public class FishingPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() == WidgetID.FISHING_TRAWLER_GROUP_ID)
|
||||
{
|
||||
trawlerStartTime = Instant.now();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Changes the Fishing Trawler timer widget from minutes to minutes and seconds
|
||||
*/
|
||||
private void updateTrawlerTimer()
|
||||
{
|
||||
if (trawlerStartTime == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int regionID = client.getLocalPlayer().getWorldLocation().getRegionID();
|
||||
if (regionID != TRAWLER_SHIP_REGION_NORMAL && regionID != TRAWLER_SHIP_REGION_SINKING)
|
||||
{
|
||||
log.debug("Trawler session ended");
|
||||
return;
|
||||
}
|
||||
|
||||
Widget trawlerTimerWidget = client.getWidget(WidgetInfo.FISHING_TRAWLER_TIMER);
|
||||
if (trawlerTimerWidget == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
long timeLeft = TRAWLER_TIME_LIMIT_IN_SECONDS - Duration.between(trawlerStartTime, Instant.now()).getSeconds();
|
||||
int minutes = (int) timeLeft / 60;
|
||||
int seconds = (int) timeLeft % 60;
|
||||
|
||||
final StringBuilder trawlerText = new StringBuilder();
|
||||
trawlerText.append("Time Left: ");
|
||||
|
||||
if (minutes > 0)
|
||||
{
|
||||
trawlerText.append(minutes);
|
||||
}
|
||||
else
|
||||
{
|
||||
trawlerText.append("00");
|
||||
}
|
||||
|
||||
trawlerText.append(':');
|
||||
|
||||
if (seconds < 10)
|
||||
{
|
||||
trawlerText.append("0");
|
||||
}
|
||||
|
||||
trawlerText.append(seconds);
|
||||
|
||||
trawlerTimerWidget.setText(trawlerText.toString());
|
||||
}
|
||||
|
||||
private void inverseSortSpotDistanceFromPlayer()
|
||||
{
|
||||
final LocalPoint cameraPoint = new LocalPoint(client.getCameraX(), client.getCameraY());
|
||||
|
||||
@@ -37,6 +37,7 @@ public interface NpcAggroAreaConfig extends Config
|
||||
String CONFIG_CENTER2 = "center2";
|
||||
String CONFIG_LOCATION = "location";
|
||||
String CONFIG_DURATION = "duration";
|
||||
String CONFIG_NOT_WORKING_OVERLAY = "overlay";
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "npcUnaggroAlwaysActive",
|
||||
@@ -95,12 +96,12 @@ public interface NpcAggroAreaConfig extends Config
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "npcUnaggroShowNotWorkingOverlay",
|
||||
name = "Hide overlay hint",
|
||||
description = "Hide overlay hint if plugin is enabled in unsupported area",
|
||||
name = "Show not working hint",
|
||||
description = "Show hint if plugin is enabled in unsupported area",
|
||||
position = 6
|
||||
)
|
||||
default boolean hideOverlayHint()
|
||||
default boolean showNotWorkingOverlay()
|
||||
{
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,14 +36,12 @@ import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
class NpcAggroAreaNotWorkingOverlay extends Overlay
|
||||
{
|
||||
private final NpcAggroAreaPlugin plugin;
|
||||
private final NpcAggroAreaConfig config;
|
||||
private final PanelComponent panelComponent;
|
||||
|
||||
@Inject
|
||||
private NpcAggroAreaNotWorkingOverlay(NpcAggroAreaPlugin plugin, NpcAggroAreaConfig config)
|
||||
private NpcAggroAreaNotWorkingOverlay(NpcAggroAreaPlugin plugin)
|
||||
{
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
|
||||
panelComponent = new PanelComponent();
|
||||
panelComponent.setPreferredSize(new Dimension(150, 0));
|
||||
@@ -58,7 +56,7 @@ class NpcAggroAreaNotWorkingOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (!plugin.isActive() || plugin.getSafeCenters()[1] != null || config.hideOverlayHint())
|
||||
if (!plugin.isActive() || plugin.getSafeCenters()[1] != null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ public class NpcAggroAreaPlugin extends Plugin
|
||||
private WorldPoint previousUnknownCenter;
|
||||
private boolean loggingIn;
|
||||
private List<String> npcNamePatterns;
|
||||
private boolean notWorkingOverlayShown = false;
|
||||
|
||||
@Provides
|
||||
NpcAggroAreaConfig provideConfig(ConfigManager configManager)
|
||||
@@ -139,7 +140,12 @@ public class NpcAggroAreaPlugin extends Plugin
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
if (config.showNotWorkingOverlay())
|
||||
{
|
||||
overlayManager.add(notWorkingOverlay);
|
||||
notWorkingOverlayShown = true;
|
||||
}
|
||||
|
||||
npcNamePatterns = NAME_SPLITTER.splitToList(config.npcNamePatterns());
|
||||
recheckActive();
|
||||
}
|
||||
@@ -149,7 +155,11 @@ public class NpcAggroAreaPlugin extends Plugin
|
||||
{
|
||||
removeTimer();
|
||||
overlayManager.remove(overlay);
|
||||
if (notWorkingOverlayShown)
|
||||
{
|
||||
overlayManager.remove(notWorkingOverlay);
|
||||
}
|
||||
|
||||
Arrays.fill(safeCenters, null);
|
||||
lastPlayerLocation = null;
|
||||
currentTimer = null;
|
||||
@@ -406,6 +416,7 @@ public class NpcAggroAreaPlugin extends Plugin
|
||||
configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_CENTER2);
|
||||
configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_LOCATION);
|
||||
configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_DURATION);
|
||||
configManager.unsetConfiguration(NpcAggroAreaConfig.CONFIG_GROUP, NpcAggroAreaConfig.CONFIG_NOT_WORKING_OVERLAY);
|
||||
}
|
||||
|
||||
private void saveConfig()
|
||||
|
||||
@@ -36,11 +36,12 @@ import net.runelite.api.SpriteID;
|
||||
import net.runelite.api.VarClientInt;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.ScriptCallbackEvent;
|
||||
import net.runelite.api.events.VarClientIntChanged;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.widgets.JavaScriptCallback;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.api.widgets.WidgetPositionMode;
|
||||
import net.runelite.api.widgets.WidgetType;
|
||||
@@ -103,45 +104,46 @@ public class QuestListPlugin extends Plugin
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onScriptCallbackEvent(ScriptCallbackEvent event)
|
||||
public void onWidgetLoaded(WidgetLoaded widgetLoaded)
|
||||
{
|
||||
if (!event.getEventName().equals("questProgressUpdated"))
|
||||
if (widgetLoaded.getGroupId() == WidgetID.QUESTLIST_GROUP_ID)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Widget header = client.getWidget(WidgetInfo.QUESTLIST_BOX);
|
||||
if (header != null)
|
||||
{
|
||||
questSearchButton = header.createChild(-1, WidgetType.GRAPHIC);
|
||||
questSearchButton.setSpriteId(SpriteID.GE_SEARCH);
|
||||
questSearchButton.setOriginalWidth(18);
|
||||
questSearchButton.setOriginalHeight(17);
|
||||
questSearchButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT);
|
||||
questSearchButton.setOriginalX(5);
|
||||
questSearchButton.setOriginalY(0);
|
||||
questSearchButton.setHasListener(true);
|
||||
questSearchButton.setAction(1, MENU_OPEN);
|
||||
questSearchButton.setOnOpListener((JavaScriptCallback) e -> openSearch());
|
||||
questSearchButton.setName(MENU_SEARCH);
|
||||
questSearchButton.revalidate();
|
||||
|
||||
Widget header = client.getWidget(WidgetInfo.QUESTLIST_BOX);
|
||||
if (header != null)
|
||||
{
|
||||
questSearchButton = header.createChild(-1, WidgetType.GRAPHIC);
|
||||
questSearchButton.setSpriteId(SpriteID.GE_SEARCH);
|
||||
questSearchButton.setOriginalWidth(18);
|
||||
questSearchButton.setOriginalHeight(17);
|
||||
questSearchButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT);
|
||||
questSearchButton.setOriginalX(5);
|
||||
questSearchButton.setOriginalY(0);
|
||||
questSearchButton.setHasListener(true);
|
||||
questSearchButton.setAction(1, MENU_OPEN);
|
||||
questSearchButton.setOnOpListener((JavaScriptCallback) e -> openSearch());
|
||||
questSearchButton.setName(MENU_SEARCH);
|
||||
questSearchButton.revalidate();
|
||||
questHideButton = header.createChild(-1, WidgetType.GRAPHIC);
|
||||
redrawHideButton();
|
||||
|
||||
questHideButton = header.createChild(-1, WidgetType.GRAPHIC);
|
||||
redrawHideButton();
|
||||
questHideButton.setOriginalWidth(13);
|
||||
questHideButton.setOriginalHeight(13);
|
||||
questHideButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT);
|
||||
questHideButton.setOriginalX(24);
|
||||
questHideButton.setOriginalY(2);
|
||||
questHideButton.setHasListener(true);
|
||||
questHideButton.setOnOpListener((JavaScriptCallback) e -> toggleHidden());
|
||||
questHideButton.setAction(1, MENU_TOGGLE);
|
||||
questHideButton.revalidate();
|
||||
|
||||
questHideButton.setOriginalWidth(13);
|
||||
questHideButton.setOriginalHeight(13);
|
||||
questHideButton.setXPositionMode(WidgetPositionMode.ABSOLUTE_RIGHT);
|
||||
questHideButton.setOriginalX(24);
|
||||
questHideButton.setOriginalY(2);
|
||||
questHideButton.setHasListener(true);
|
||||
questHideButton.setOnOpListener((JavaScriptCallback) e -> toggleHidden());
|
||||
questHideButton.setAction(1, MENU_TOGGLE);
|
||||
questHideButton.revalidate();
|
||||
questSet = new EnumMap<>(QuestContainer.class);
|
||||
|
||||
questSet = new EnumMap<>(QuestContainer.class);
|
||||
|
||||
updateFilter();
|
||||
if (!header.isHidden())
|
||||
{
|
||||
updateFilter();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -257,26 +259,21 @@ public class QuestListPlugin extends Plugin
|
||||
|
||||
int y = miniList.getRelativeY() + miniList.getHeight() + 10;
|
||||
|
||||
int newHeight;
|
||||
int newHeight = 0;
|
||||
if (container.getScrollHeight() > 0)
|
||||
{
|
||||
newHeight = (container.getScrollY() * y) / container.getScrollHeight();
|
||||
}
|
||||
else
|
||||
{
|
||||
newHeight = 0;
|
||||
}
|
||||
|
||||
container.setScrollHeight(y);
|
||||
container.revalidateScroll();
|
||||
|
||||
clientThread.invokeLater(() ->
|
||||
client.runScript(
|
||||
ScriptID.UPDATE_SCROLLBAR,
|
||||
WidgetInfo.QUESTLIST_SCROLLBAR.getId(),
|
||||
WidgetInfo.QUESTLIST_CONTAINER.getId(),
|
||||
newHeight
|
||||
));
|
||||
client.runScript(
|
||||
ScriptID.UPDATE_SCROLLBAR,
|
||||
WidgetInfo.QUESTLIST_SCROLLBAR.getId(),
|
||||
WidgetInfo.QUESTLIST_CONTAINER.getId(),
|
||||
newHeight
|
||||
);
|
||||
}
|
||||
|
||||
private void updateList(QuestContainer questContainer, String filter)
|
||||
@@ -312,7 +309,7 @@ public class QuestListPlugin extends Plugin
|
||||
// Find all of the widgets that we care about, sorting by their Y value
|
||||
quests = Arrays.stream(list.getDynamicChildren())
|
||||
.sorted(Comparator.comparing(Widget::getRelativeY))
|
||||
.filter(w -> !QUEST_HEADERS.contains(w.getText()))
|
||||
.filter(w -> !w.isSelfHidden() && !QUEST_HEADERS.contains(w.getText()))
|
||||
.map(w -> new QuestWidget(w, Text.removeTags(w.getText()).toLowerCase()))
|
||||
.collect(Collectors.toList());
|
||||
questSet.put(questContainer, quests);
|
||||
|
||||
@@ -554,7 +554,7 @@ public class WorldHopperPlugin extends Plugin
|
||||
if (config.quickhopOutOfDanger())
|
||||
{
|
||||
currentWorldTypes.remove(WorldType.PVP);
|
||||
currentWorldTypes.remove(WorldType.HIGH_RISK);
|
||||
currentWorldTypes.remove(WorldType.PVP_HIGH_RISK);
|
||||
}
|
||||
// Don't regard these worlds as a type that must be hopped between
|
||||
currentWorldTypes.remove(WorldType.BOUNTY);
|
||||
|
||||
@@ -245,7 +245,7 @@ class WorldTableRow extends JPanel
|
||||
return;
|
||||
}
|
||||
else if (world.getTypes().contains(WorldType.PVP)
|
||||
|| world.getTypes().contains(WorldType.HIGH_RISK)
|
||||
|| world.getTypes().contains(WorldType.PVP_HIGH_RISK)
|
||||
|| world.getTypes().contains(WorldType.DEADMAN)
|
||||
|| world.getTypes().contains(WorldType.SEASONAL_DEADMAN))
|
||||
{
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
A6B3A7BFE7B688A08F69B91A7FD5C7184D71147D3DAF74B1262369D85DBB3A03
|
||||
@@ -1,198 +0,0 @@
|
||||
.id 1354
|
||||
.int_stack_count 3
|
||||
.string_stack_count 0
|
||||
.int_var_count 7
|
||||
.string_var_count 0
|
||||
iconst 0
|
||||
istore 3
|
||||
iconst 0
|
||||
istore 4
|
||||
iconst 0
|
||||
istore 5
|
||||
invoke 1340
|
||||
istore 6
|
||||
LABEL8:
|
||||
iload 5
|
||||
iload 6
|
||||
if_icmplt LABEL12
|
||||
jump LABEL56
|
||||
LABEL12:
|
||||
iload 0
|
||||
iload 5
|
||||
cc_find
|
||||
iconst 1
|
||||
if_icmpeq LABEL18
|
||||
jump LABEL51
|
||||
LABEL18:
|
||||
iload 5
|
||||
invoke 1357
|
||||
istore 3
|
||||
iload 3
|
||||
iconst 2
|
||||
if_icmpeq LABEL25
|
||||
jump LABEL28
|
||||
LABEL25:
|
||||
iconst 901389
|
||||
istore 4
|
||||
jump LABEL37
|
||||
LABEL28:
|
||||
iload 3
|
||||
iconst 0
|
||||
if_icmpeq LABEL32
|
||||
jump LABEL35
|
||||
LABEL32:
|
||||
iconst 16776960
|
||||
istore 4
|
||||
jump LABEL37
|
||||
LABEL35:
|
||||
iconst 16711680
|
||||
istore 4
|
||||
LABEL37:
|
||||
iload 4
|
||||
cc_setcolour
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iconst 16777215
|
||||
sconst "Iii"
|
||||
cc_setonmouseover
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iload 4
|
||||
sconst "Iii"
|
||||
cc_setonmouseleave
|
||||
LABEL51:
|
||||
iload 5
|
||||
iconst 1
|
||||
add
|
||||
istore 5
|
||||
jump LABEL8
|
||||
LABEL56:
|
||||
iconst 0
|
||||
invoke 2245
|
||||
istore 6
|
||||
istore 5
|
||||
LABEL60:
|
||||
iload 5
|
||||
iload 6
|
||||
if_icmplt LABEL64
|
||||
jump LABEL108
|
||||
LABEL64:
|
||||
iload 1
|
||||
iload 5
|
||||
cc_find
|
||||
iconst 1
|
||||
if_icmpeq LABEL70
|
||||
jump LABEL103
|
||||
LABEL70:
|
||||
iload 5
|
||||
invoke 1358
|
||||
istore 3
|
||||
iload 3
|
||||
iconst 2
|
||||
if_icmpeq LABEL77
|
||||
jump LABEL80
|
||||
LABEL77:
|
||||
iconst 901389
|
||||
istore 4
|
||||
jump LABEL89
|
||||
LABEL80:
|
||||
iload 3
|
||||
iconst 0
|
||||
if_icmpeq LABEL84
|
||||
jump LABEL87
|
||||
LABEL84:
|
||||
iconst 16776960
|
||||
istore 4
|
||||
jump LABEL89
|
||||
LABEL87:
|
||||
iconst 16711680
|
||||
istore 4
|
||||
LABEL89:
|
||||
iload 4
|
||||
cc_setcolour
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iconst 16777215
|
||||
sconst "Iii"
|
||||
cc_setonmouseover
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iload 4
|
||||
sconst "Iii"
|
||||
cc_setonmouseleave
|
||||
LABEL103:
|
||||
iload 5
|
||||
iconst 1
|
||||
add
|
||||
istore 5
|
||||
jump LABEL60
|
||||
LABEL108:
|
||||
iconst 0
|
||||
invoke 2265
|
||||
istore 6
|
||||
istore 5
|
||||
LABEL112:
|
||||
iload 5
|
||||
iload 6
|
||||
if_icmplt LABEL116
|
||||
jump LABEL160
|
||||
LABEL116:
|
||||
iload 2
|
||||
iload 5
|
||||
cc_find
|
||||
iconst 1
|
||||
if_icmpeq LABEL122
|
||||
jump LABEL155
|
||||
LABEL122:
|
||||
iload 5
|
||||
invoke 1359
|
||||
istore 3
|
||||
iload 3
|
||||
iconst 2
|
||||
if_icmpeq LABEL129
|
||||
jump LABEL132
|
||||
LABEL129:
|
||||
iconst 901389
|
||||
istore 4
|
||||
jump LABEL141
|
||||
LABEL132:
|
||||
iload 3
|
||||
iconst 0
|
||||
if_icmpeq LABEL136
|
||||
jump LABEL139
|
||||
LABEL136:
|
||||
iconst 16776960
|
||||
istore 4
|
||||
jump LABEL141
|
||||
LABEL139:
|
||||
iconst 16711680
|
||||
istore 4
|
||||
LABEL141:
|
||||
iload 4
|
||||
cc_setcolour
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iconst 16777215
|
||||
sconst "Iii"
|
||||
cc_setonmouseover
|
||||
iconst 85
|
||||
iconst -2147483645
|
||||
iconst -2147483643
|
||||
iload 4
|
||||
sconst "Iii"
|
||||
cc_setonmouseleave
|
||||
LABEL155:
|
||||
iload 5
|
||||
iconst 1
|
||||
add
|
||||
istore 5
|
||||
jump LABEL112
|
||||
LABEL160:
|
||||
sconst "questProgressUpdated"
|
||||
runelite_callback
|
||||
return
|
||||
Reference in New Issue
Block a user