Fix style errors
This commit is contained in:
@@ -33,7 +33,9 @@ import javax.inject.Inject;
|
|||||||
import net.runelite.api.*;
|
import net.runelite.api.*;
|
||||||
|
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
|
||||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||||
|
|
||||||
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
import net.runelite.client.ui.overlay.OverlayMenuEntry;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||||
@@ -72,7 +74,8 @@ public class RaidsPartyOverlay extends Overlay
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client.getClanChatCount() == 0) {
|
if (client.getClanChatCount() == 0)
|
||||||
|
{
|
||||||
// Player left clan chat
|
// Player left clan chat
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -86,18 +89,25 @@ public class RaidsPartyOverlay extends Overlay
|
|||||||
String partyCountString;
|
String partyCountString;
|
||||||
|
|
||||||
Color countColor = Color.WHITE;
|
Color countColor = Color.WHITE;
|
||||||
if (inLobby) {
|
if (inLobby)
|
||||||
|
{
|
||||||
partyCountString = String.format("%d/%d", playerCount, partySize);
|
partyCountString = String.format("%d/%d", playerCount, partySize);
|
||||||
// While we are in the lobby compare to players visible on the screen
|
// While we are in the lobby compare to players visible on the screen
|
||||||
if (partySize <= playerCount) {
|
if (partySize <= playerCount)
|
||||||
|
{
|
||||||
countColor = Color.GREEN;
|
countColor = Color.GREEN;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
countColor = Color.RED;
|
countColor = Color.RED;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
// If raid has started then we compare the current party size to what it was when we started
|
// If raid has started then we compare the current party size to what it was when we started
|
||||||
partyCountString = String.format("%d/%d", partySize, plugin.getStartPlayerCount());
|
partyCountString = String.format("%d/%d", partySize, plugin.getStartPlayerCount());
|
||||||
if (plugin.getMissingPartyMembers().size() > 0) {
|
if (plugin.getMissingPartyMembers().size() > 0)
|
||||||
|
{
|
||||||
countColor = Color.RED; // Somebody is missing
|
countColor = Color.RED; // Somebody is missing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -111,15 +121,21 @@ public class RaidsPartyOverlay extends Overlay
|
|||||||
.rightColor(countColor)
|
.rightColor(countColor)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
if (inLobby) {
|
if (inLobby)
|
||||||
|
{
|
||||||
int world = client.getWorld();
|
int world = client.getWorld();
|
||||||
int wrongWorldClanMembers = 0;
|
int wrongWorldClanMembers = 0;
|
||||||
int clanMemberCount = 0;
|
int clanMemberCount = 0;
|
||||||
for (ClanMember clanMember : client.getClanMembers()) {
|
for (ClanMember clanMember : client.getClanMembers())
|
||||||
if (clanMember != null) {
|
{
|
||||||
if (clanMember.getWorld() != world) {
|
if (clanMember != null)
|
||||||
|
{
|
||||||
|
if (clanMember.getWorld() != world)
|
||||||
|
{
|
||||||
wrongWorldClanMembers++;
|
wrongWorldClanMembers++;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
clanMemberCount++;
|
clanMemberCount++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -129,7 +145,8 @@ public class RaidsPartyOverlay extends Overlay
|
|||||||
Color notInPartyColor = Color.GREEN;
|
Color notInPartyColor = Color.GREEN;
|
||||||
int notInParty = clanMemberCount - partySize;
|
int notInParty = clanMemberCount - partySize;
|
||||||
|
|
||||||
if (notInParty > 0) {
|
if (notInParty > 0)
|
||||||
|
{
|
||||||
notInPartyColor = Color.WHITE;
|
notInPartyColor = Color.WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,9 +158,12 @@ public class RaidsPartyOverlay extends Overlay
|
|||||||
|
|
||||||
// Show amount of clan members that are not in the right world.
|
// Show amount of clan members that are not in the right world.
|
||||||
Color wrongWorldColor;
|
Color wrongWorldColor;
|
||||||
if (wrongWorldClanMembers == 0) {
|
if (wrongWorldClanMembers == 0)
|
||||||
|
{
|
||||||
wrongWorldColor = Color.GREEN;
|
wrongWorldColor = Color.GREEN;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
wrongWorldColor = Color.WHITE;
|
wrongWorldColor = Color.WHITE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,14 +173,18 @@ public class RaidsPartyOverlay extends Overlay
|
|||||||
.rightColor(wrongWorldColor)
|
.rightColor(wrongWorldColor)
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Set<String> missingPartyMembers = plugin.getMissingPartyMembers();
|
Set<String> missingPartyMembers = plugin.getMissingPartyMembers();
|
||||||
if (missingPartyMembers.size() > 0) {
|
if (missingPartyMembers.size() > 0)
|
||||||
|
{
|
||||||
panel.getChildren().add(LineComponent.builder()
|
panel.getChildren().add(LineComponent.builder()
|
||||||
.left("Missing players:")
|
.left("Missing players:")
|
||||||
.build());
|
.build());
|
||||||
|
|
||||||
for (String member : missingPartyMembers) {
|
for (String member : missingPartyMembers)
|
||||||
|
{
|
||||||
panel.getChildren().add(LineComponent.builder()
|
panel.getChildren().add(LineComponent.builder()
|
||||||
.left(member)
|
.left(member)
|
||||||
.leftColor(Color.RED)
|
.leftColor(Color.RED)
|
||||||
|
|||||||
@@ -27,12 +27,14 @@ package net.runelite.client.plugins.raids;
|
|||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
import com.google.inject.Binder;
|
import com.google.inject.Binder;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.regex.Matcher;
|
import java.util.regex.Matcher;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.*;
|
import net.runelite.api.*;
|
||||||
@@ -157,7 +159,8 @@ public class RaidsPlugin extends Plugin
|
|||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
overlayManager.add(overlay);
|
overlayManager.add(overlay);
|
||||||
if (config.partyDisplay()) {
|
if (config.partyDisplay())
|
||||||
|
{
|
||||||
overlayManager.add(partyOverlay);
|
overlayManager.add(partyOverlay);
|
||||||
}
|
}
|
||||||
updateLists();
|
updateLists();
|
||||||
@@ -168,7 +171,8 @@ public class RaidsPlugin extends Plugin
|
|||||||
protected void shutDown() throws Exception
|
protected void shutDown() throws Exception
|
||||||
{
|
{
|
||||||
overlayManager.remove(overlay);
|
overlayManager.remove(overlay);
|
||||||
if (config.partyDisplay()) {
|
if (config.partyDisplay())
|
||||||
|
{
|
||||||
overlayManager.remove(partyOverlay);
|
overlayManager.remove(partyOverlay);
|
||||||
}
|
}
|
||||||
infoBoxManager.removeInfoBox(timer);
|
infoBoxManager.removeInfoBox(timer);
|
||||||
@@ -191,10 +195,14 @@ public class RaidsPlugin extends Plugin
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event.getKey().equals("partyDisplay")) {
|
if (event.getKey().equals("partyDisplay"))
|
||||||
if (config.partyDisplay()) {
|
{
|
||||||
|
if (config.partyDisplay())
|
||||||
|
{
|
||||||
overlayManager.add(partyOverlay);
|
overlayManager.add(partyOverlay);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
overlayManager.remove(partyOverlay);
|
overlayManager.remove(partyOverlay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -207,7 +215,8 @@ public class RaidsPlugin extends Plugin
|
|||||||
public void onVarbitChanged(VarbitChanged event)
|
public void onVarbitChanged(VarbitChanged event)
|
||||||
{
|
{
|
||||||
checkRaidPresence(false);
|
checkRaidPresence(false);
|
||||||
if (config.partyDisplay()) {
|
if (config.partyDisplay())
|
||||||
|
{
|
||||||
updatePartyMembers(false);
|
updatePartyMembers(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -221,11 +230,13 @@ public class RaidsPlugin extends Plugin
|
|||||||
|
|
||||||
if (message.startsWith(RAID_START_MESSAGE))
|
if (message.startsWith(RAID_START_MESSAGE))
|
||||||
{
|
{
|
||||||
if (config.raidsTimer()) {
|
if (config.raidsTimer())
|
||||||
|
{
|
||||||
timer = new RaidsTimer(spriteManager.getSprite(TAB_QUESTS_BROWN_RAIDING_PARTY, 0), this, Instant.now());
|
timer = new RaidsTimer(spriteManager.getSprite(TAB_QUESTS_BROWN_RAIDING_PARTY, 0), this, Instant.now());
|
||||||
infoBoxManager.addInfoBox(timer);
|
infoBoxManager.addInfoBox(timer);
|
||||||
}
|
}
|
||||||
if (config.partyDisplay()) {
|
if (config.partyDisplay())
|
||||||
|
{
|
||||||
// Base this on visible players since party size shows people outside the lobby
|
// Base this on visible players since party size shows people outside the lobby
|
||||||
// and they did not get to come on the raid
|
// and they did not get to come on the raid
|
||||||
List<Player> players = client.getPlayers();
|
List<Player> players = client.getPlayers();
|
||||||
@@ -293,7 +304,8 @@ public class RaidsPlugin extends Plugin
|
|||||||
if (entry.getMenuAction() == MenuAction.RUNELITE_OVERLAY &&
|
if (entry.getMenuAction() == MenuAction.RUNELITE_OVERLAY &&
|
||||||
entry.getTarget().equals("Raids party overlay"))
|
entry.getTarget().equals("Raids party overlay"))
|
||||||
{
|
{
|
||||||
switch (entry.getOption()) {
|
switch (entry.getOption())
|
||||||
|
{
|
||||||
case RaidsPartyOverlay.PARTY_OVERLAY_RESET:
|
case RaidsPartyOverlay.PARTY_OVERLAY_RESET:
|
||||||
startingPartyMembers.clear();
|
startingPartyMembers.clear();
|
||||||
updatePartyMembers(true);
|
updatePartyMembers(true);
|
||||||
@@ -308,33 +320,43 @@ public class RaidsPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updatePartyMembers(boolean force) {
|
private void updatePartyMembers(boolean force)
|
||||||
|
{
|
||||||
int partySize = client.getVar(Varbits.RAID_PARTY_SIZE);
|
int partySize = client.getVar(Varbits.RAID_PARTY_SIZE);
|
||||||
if (partySize <= 0) {
|
if (partySize <= 0)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startingPartyMembers.size() == partySize && !force) {
|
if (startingPartyMembers.size() == partySize && !force)
|
||||||
|
{
|
||||||
// Skip update if the part is as big as when we started
|
// Skip update if the part is as big as when we started
|
||||||
missingPartyMembers.clear(); // Clear missing members in case someone came back
|
missingPartyMembers.clear(); // Clear missing members in case someone came back
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only update while in raid
|
// Only update while in raid
|
||||||
if (client.getVar(VarPlayer.IN_RAID_PARTY) == -1 || force) {
|
if (client.getVar(VarPlayer.IN_RAID_PARTY) == -1 || force)
|
||||||
|
{
|
||||||
Widget[] widgets;
|
Widget[] widgets;
|
||||||
try {
|
try
|
||||||
|
{
|
||||||
widgets = client.getWidget(WidgetInfo.RAIDING_PARTY).getStaticChildren()[2].getStaticChildren()[3].getDynamicChildren();
|
widgets = client.getWidget(WidgetInfo.RAIDING_PARTY).getStaticChildren()[2].getStaticChildren()[3].getDynamicChildren();
|
||||||
} catch (NullPointerException e) {
|
}
|
||||||
|
catch (NullPointerException e)
|
||||||
|
{
|
||||||
return; // Raid widget not loaded
|
return; // Raid widget not loaded
|
||||||
}
|
}
|
||||||
|
|
||||||
partyMembers.clear();
|
partyMembers.clear();
|
||||||
for (int i = 0; i < widgets.length; i++) {
|
for (int i = 0; i < widgets.length; i++)
|
||||||
if (widgets[i] != null) {
|
{
|
||||||
|
if (widgets[i] != null)
|
||||||
|
{
|
||||||
// Party members names can be found as a color tagged string in every fourth(ish) of these children
|
// Party members names can be found as a color tagged string in every fourth(ish) of these children
|
||||||
String name = widgets[i].getName();
|
String name = widgets[i].getName();
|
||||||
if (name.length() > 1) {
|
if (name.length() > 1)
|
||||||
|
{
|
||||||
// Clean away tag
|
// Clean away tag
|
||||||
partyMembers.add(name.substring(name.indexOf('>') + 1, name.indexOf('<', 1)));
|
partyMembers.add(name.substring(name.indexOf('>') + 1, name.indexOf('<', 1)));
|
||||||
}
|
}
|
||||||
@@ -342,14 +364,18 @@ public class RaidsPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we don't have any starting members, update starting members
|
// If we don't have any starting members, update starting members
|
||||||
if (startingPartyMembers.size() == 0 || force) {
|
if (startingPartyMembers.size() == 0 || force)
|
||||||
|
{
|
||||||
missingPartyMembers.clear();
|
missingPartyMembers.clear();
|
||||||
startingPartyMembers.clear();
|
startingPartyMembers.clear();
|
||||||
startingPartyMembers.addAll(partyMembers);
|
startingPartyMembers.addAll(partyMembers);
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
// Check if anyone left
|
// Check if anyone left
|
||||||
if (startingPartyMembers.size() > partyMembers.size()) {
|
if (startingPartyMembers.size() > partyMembers.size())
|
||||||
|
{
|
||||||
missingPartyMembers.clear();
|
missingPartyMembers.clear();
|
||||||
missingPartyMembers.addAll(startingPartyMembers);
|
missingPartyMembers.addAll(startingPartyMembers);
|
||||||
missingPartyMembers.removeAll(partyMembers);
|
missingPartyMembers.removeAll(partyMembers);
|
||||||
|
|||||||
Reference in New Issue
Block a user