Add Crab Handlers and clean up Scouter.

This commit is contained in:
Ganom
2019-06-18 16:45:29 -04:00
parent 3780e8ccd4
commit dd3c7650d8
13 changed files with 359 additions and 299 deletions

View File

@@ -40,7 +40,7 @@ public class Raid
@Getter
private Layout layout;
public void updateLayout(Layout layout)
void updateLayout(Layout layout)
{
if (layout == null)
{
@@ -83,7 +83,7 @@ public class Raid
return rooms[position];
}
public void setRoom(RaidRoom room, int position)
void setRoom(RaidRoom room, int position)
{
if (position < rooms.length)
{
@@ -91,7 +91,7 @@ public class Raid
}
}
public RaidRoom[] getCombatRooms()
RaidRoom[] getCombatRooms()
{
List<RaidRoom> combatRooms = new ArrayList<>();
@@ -111,12 +111,34 @@ public class Raid
return combatRooms.toArray(new RaidRoom[combatRooms.size()]);
}
public String getRotationString()
String getRotationString()
{
return Joiner.on(",").join(Arrays.stream(getCombatRooms()).map(r -> r.getBoss().getName()).toArray());
}
public String toCode()
private RaidRoom[] getAllRooms()
{
List<RaidRoom> getAllRooms = new ArrayList<>();
for (Room room : layout.getRooms())
{
if (room == null)
{
continue;
}
getAllRooms.add(rooms[room.getPosition()]);
}
return getAllRooms.toArray(new RaidRoom[0]);
}
String getFullRotationString()
{
return Joiner.on(",").join(Arrays.stream(getAllRooms()).toArray());
}
String toCode()
{
StringBuilder builder = new StringBuilder();
@@ -135,7 +157,7 @@ public class Raid
return builder.toString();
}
public String toRoomString()
String toRoomString()
{
final StringBuilder sb = new StringBuilder();

View File

@@ -31,7 +31,46 @@ import net.runelite.api.Tile;
public class RaidRoom
{
public static final int ROOM_MAX_SIZE = 32;
static final int ROOM_MAX_SIZE = 32;
@Getter
private final Tile base;
@Getter
@Setter
private Type type;
@Getter
@Setter
private Boss boss;
@Getter
@Setter
private Puzzle puzzle;
@Getter
@Setter
private RaidRoom previousRoom;
@Getter
@Setter
private RaidRoom nextRoom;
RaidRoom(Tile base, Type type)
{
this.base = base;
this.type = type;
}
@Override
public String toString()
{
switch (type)
{
case COMBAT:
return " " + type.getName() + " - " + boss.getName();
case PUZZLE:
return " " + type.getName() + " - " + puzzle.getName();
default:
return " " + type.getName();
}
}
@AllArgsConstructor
public enum Type
@@ -119,49 +158,4 @@ public class RaidRoom
return null;
}
}
@Getter
private final Tile base;
@Getter
@Setter
private Type type;
@Getter
@Setter
private Boss boss;
@Getter
@Setter
private Puzzle puzzle;
@Getter
@Setter
private RaidRoom previousRoom;
@Getter
@Setter
private RaidRoom nextRoom;
public RaidRoom(Tile base, Type type)
{
this.base = base;
this.type = type;
}
@Override
public String toString()
{
switch (type)
{
case COMBAT:
return "RaidRoom (type: " + type.getName() + ", " + boss.getName() + ")";
case PUZZLE:
return "RaidRoom (type: " + type.getName() + ", " + puzzle.getName() + ")";
default:
return "RaidRoom (type: " + type.getName() + ")";
}
}
}

View File

@@ -29,8 +29,8 @@ import java.awt.Color;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.Stub;
import net.runelite.client.config.Keybind;
import net.runelite.client.config.Stub;
@ConfigGroup("raids")
public interface RaidsConfig extends Config
@@ -185,32 +185,6 @@ public interface RaidsConfig extends Config
@ConfigItem(
position = 12,
parent = "scouterConfig",
keyName = "colorTightrope",
name = "Color tightrope",
description = "Colors tightrope a separate color"
)
default boolean colorTightrope()
{
return true;
}
@ConfigItem(
position = 13,
parent = "scouterConfig",
keyName = "tightropeColor",
name = "Tightrope color",
description = "The color of tightropes",
hidden = true,
unhide = "colorTightrope"
)
default Color tightropeColor()
{
return Color.MAGENTA;
}
@ConfigItem(
position = 14,
parent = "scouterConfig",
keyName = "layoutMessage",
name = "Send raid layout message when entering raid",
description = "Sends game message with raid layout on entering new raid"
@@ -224,16 +198,69 @@ public interface RaidsConfig extends Config
keyName = "roomConfig",
name = "Room Config",
description = "",
position = 15
position = 13
)
default Stub roomConfig()
{
return new Stub();
}
@ConfigItem(
position = 14,
parent = "roomConfig",
keyName = "colorTightrope",
name = "Color tightrope",
description = "Colors tightrope a separate color"
)
default boolean colorTightrope()
{
return true;
}
@ConfigItem(
position = 15,
parent = "roomConfig",
keyName = "tightropeColor",
name = "Tightrope color",
description = "The color of tightropes",
hidden = true,
unhide = "colorTightrope"
)
default Color tightropeColor()
{
return Color.MAGENTA;
}
@ConfigItem(
position = 16,
parent = "roomConfig",
keyName = "crabHandler",
name = "Color crabs",
description = "If your crabs are good, it will color them to your set color." +
"<br> If they are bad crabs, it will be set to RED"
)
default boolean crabHandler()
{
return false;
}
@ConfigItem(
position = 17,
parent = "roomConfig",
keyName = "crabColor",
name = "Crab color",
description = "The color of good crabs",
hidden = true,
unhide = "crabHandler"
)
default Color crabColor()
{
return Color.MAGENTA;
}
@ConfigItem(
position = 18,
parent = "roomConfig",
keyName = "enableRotationWhitelist",
name = "Enable rotation whitelist",
description = "Enable the rotation whitelist"
@@ -244,7 +271,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 17,
position = 19,
parent = "roomConfig",
keyName = "whitelistedRotations",
name = "Whitelisted rotations",
@@ -258,7 +285,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 18,
position = 20,
parent = "roomConfig",
keyName = "enableLayoutWhitelist",
name = "Enable layout whitelist",
@@ -270,7 +297,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 19,
position = 21,
parent = "roomConfig",
keyName = "whitelistedLayouts",
name = "Whitelisted layouts",
@@ -284,7 +311,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 20,
position = 22,
parent = "roomConfig",
keyName = "showScavsFarms",
name = "Show scavengers and farming",
@@ -296,7 +323,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 21,
position = 23,
parent = "roomConfig",
keyName = "scavsBeforeIce",
name = "Show last scavs for Ice Demon",
@@ -308,7 +335,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 22,
position = 24,
parent = "roomConfig",
keyName = "scavsBeforeOlm",
name = "Show last scavs for Olm",
@@ -320,7 +347,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 23,
position = 25,
parent = "roomConfig",
keyName = "scavPrepColor",
name = "Last scavs color",
@@ -332,7 +359,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 24,
position = 26,
parent = "roomConfig",
keyName = "whitelistedRooms",
name = "Whitelisted rooms",
@@ -347,7 +374,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 25,
position = 27,
parent = "roomConfig",
keyName = "blacklistedRooms",
name = "Blacklisted rooms",
@@ -365,7 +392,7 @@ public interface RaidsConfig extends Config
keyName = "hideRooms",
name = "Hide Rooms",
description = "",
position = 26
position = 28
)
default Stub hideRooms()
{
@@ -373,7 +400,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 27,
position = 29,
parent = "hideRooms",
keyName = "hideRopeless",
name = "Hide no Tightrope raids",
@@ -385,7 +412,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 28,
position = 30,
parent = "hideRooms",
keyName = "hideVanguards",
name = "Hide Vanguard raids",
@@ -397,7 +424,7 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 29,
position = 31,
parent = "hideRooms",
keyName = "hideUnknownCombat",
name = "Hide Unknown combat raids",
@@ -409,10 +436,10 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
position = 30,
keyName = "partyDisplay",
name = "Party Info Display",
description = "Display an overlay that shows information about the current party"
position = 32,
keyName = "partyDisplay",
name = "Party Info Display",
description = "Display an overlay that shows information about the current party"
)
default boolean partyDisplay()
{
@@ -420,10 +447,10 @@ public interface RaidsConfig extends Config
}
@ConfigItem(
keyName = "hotkey",
name = "Toggle scout overlay",
description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid",
position = 31
keyName = "hotkey",
name = "Toggle scout overlay",
description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid",
position = 33
)
default Keybind hotkey()
{

View File

@@ -25,6 +25,7 @@
*/
package net.runelite.client.plugins.raids;
import com.google.common.collect.ImmutableList;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
@@ -34,6 +35,8 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import javax.inject.Inject;
import lombok.Getter;
import lombok.Setter;
@@ -65,22 +68,56 @@ public class RaidsOverlay extends Overlay
private static final int BORDER_OFFSET = 2;
private static final int ICON_SIZE = 32;
private static final int SMALL_ICON_SIZE = 21;
//might need to edit these if they are not standard
private static final int TITLE_COMPONENT_HEIGHT = 20;
private static final int LINE_COMPONENT_HEIGHT = 16;
private Client client;
private RaidsPlugin plugin;
private RaidsConfig config;
private static final Pattern FIRST_HALF = Pattern.compile("Start, (.*), End,");
private static final Pattern SECOND_HALF = Pattern.compile(", Start, (.*), End");
private static final ImmutableList<String> goodCrabsFirst = ImmutableList.of(
"FSCCP.PCSCF - #WNWSWN#ESEENW",
"SCFCP.CSCFS - #ENEESW#ENWWSW",
"SCFPC.CSPCF - #WSWWNE#WSEENE",
"SCPFC.CCPSF - #NWWWSE#WNEESE",
"SCPFC.CSPCF - #NEEESW#WWNEEE",
"SCSPF.CCSPF - #ESWWNW#ESENES",
"SPCFC.CSPCF - #WWNEEE#WSWNWS",
"SCPFC.PCSCF - #WNEEES#NWSWNW",
"SFCCPC.PCSCPF - #WSEENES#WWWNEEE",
"SCPFC.CCSSF - #NEESEN#WSWWNE"
);
private static final ImmutableList<String> goodCrabsSecond = ImmutableList.of(
"FSCCP.PCSCF - #WNWSWN#ESEENW",
"FSCCS.PCPSF - #WSEEEN#WSWNWS",
"FSCPC.CSCPF - #WNWWSE#EENWWW",
"SCFCP.CCSPF - #ESEENW#ESWWNW",
"SCFCP.CSCFS - #ENEESW#ENWWSW",
"SCFPC.CSPCF - #WSWWNE#WSEENE",
"SCFPC.PCCSF - #WSEENE#WWWSEE",
"SCFPC.SCPCF - #NESENE#WSWWNE",
"SCPFC.CCPSF - #NWWWSE#WNEESE",
"SCPFC.CSPCF - #NEEESW#WWNEEE",
"SCPFC.CSPSF - #WWSEEE#NWSWWN",
"SCSPF.CCSPF - #ESWWNW#ESENES",
"SFCCP.CSCPF - #WNEESE#NWSWWN",
"SFCCS.PCPSF - #ENWWSW#ENESEN",
"SPCFC.CSPCF - #WWNEEE#WSWNWS",
"SPCFC.SCCPF - #ESENES#WWWNEE",
"SPSFP.CCCSF - #NWSWWN#ESEENW",
"SFCCPC.PCSCPF - #WSEENES#WWWNEEE",
"FSCCP.PCSCF - #ENWWWS#NEESEN",
"SCPFC.CCSSF - #NEESEN#WSWWNE"
);
private final PanelComponent panelComponent = new PanelComponent();
private final ItemManager itemManager;
private final SpriteManager spriteManager;
private final PanelComponent panelImages = new PanelComponent();
private Client client;
private RaidsPlugin plugin;
private RaidsConfig config;
@Setter
private boolean sharable = false;
@Getter @Setter
@Getter
@Setter
private boolean scoutOverlayShown = false;
@Getter
@@ -145,6 +182,8 @@ public class RaidsOverlay extends Overlay
color = Color.RED;
}
Matcher firstMatcher = FIRST_HALF.matcher(plugin.getRaid().getFullRotationString());
Matcher secondMatcher = SECOND_HALF.matcher(plugin.getRaid().getFullRotationString());
int combatCount = 0;
int roomCount = 0;
List<Integer> iceRooms = new ArrayList<>();
@@ -330,9 +369,22 @@ public class RaidsOverlay extends Overlay
{
color = config.tightropeColor();
}
if (config.crabHandler() && puzzleNameLC.equals("crabs"))
{
if (firstMatcher.find() && secondMatcher.find())
{
if (crabHandler(firstMatcher.group(1), secondMatcher.group(1)))
{
color = config.crabColor();
}
else
{
color = Color.RED;
}
}
}
tableComponent.addRow(config.showRecommendedItems() ? "" : room.getType().getName(), ColorUtil.prependColorTag(puzzleName, color));
break;
case FARMING:
if (config.showScavsFarms())
@@ -425,4 +477,19 @@ public class RaidsOverlay extends Overlay
}
return ImageUtil.resizeCanvas(bim, SMALL_ICON_SIZE, SMALL_ICON_SIZE);
}
private boolean crabHandler(String firstHalf, String secondHalf)
{
if (firstHalf.contains("Crabs") && goodCrabsFirst.contains(plugin.getLayoutFullCode()))
{
return true;
}
if (secondHalf.contains("Crabs") && goodCrabsSecond.contains(plugin.getLayoutFullCode()))
{
return true;
}
return false;
}
}

View File

@@ -39,7 +39,7 @@ import net.runelite.client.callback.ClientThread;
import net.runelite.client.ui.ColorScheme;
import net.runelite.client.ui.PluginPanel;
public class RaidsPanel extends PluginPanel
class RaidsPanel extends PluginPanel
{
@Inject
private Client client;
@@ -95,10 +95,6 @@ public class RaidsPanel extends PluginPanel
throw new RuntimeException(f);
}
}
else
{
//TODO: User is still in a dc, or not logged in. Possibly provide a meaningful message somewhere.
}
});
reloadScouter.addActionListener((ActionEvent e) ->
{

View File

@@ -24,22 +24,18 @@
*/
package net.runelite.client.plugins.raids;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Color;
import java.util.Set;
import javax.inject.Inject;
import net.runelite.api.ClanMember;
import net.runelite.api.Client;
import net.runelite.api.MenuAction;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.api.ClanMember;
import net.runelite.client.ui.overlay.Overlay;
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority;
@@ -50,18 +46,15 @@ import net.runelite.client.util.ColorUtil;
public class RaidsPartyOverlay extends Overlay
{
public static final String PARTY_OVERLAY_RESET = "Reset missing";
public static final String PARTY_OVERLAY_REFRESH = "Refresh party";
static final String PARTY_OVERLAY_RESET = "Reset missing";
static final String PARTY_OVERLAY_REFRESH = "Refresh party";
private final PanelComponent panelComponent = new PanelComponent();
private final PanelComponent panel = new PanelComponent();
@Inject
private Client client;
@Inject
private RaidsPlugin plugin;
private final PanelComponent panel = new PanelComponent();
@Inject
private RaidsPartyOverlay(RaidsPlugin plugin)
{
@@ -97,7 +90,6 @@ public class RaidsPartyOverlay extends Overlay
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
String partyCountString;
Color countColor = Color.WHITE;

View File

@@ -34,8 +34,10 @@ import java.time.Instant;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -47,16 +49,16 @@ import net.runelite.api.Client;
import net.runelite.api.GameState;
import net.runelite.api.InstanceTemplates;
import net.runelite.api.ItemID;
import net.runelite.api.MenuAction;
import net.runelite.api.NullObjectID;
import static net.runelite.api.Perspective.SCENE_SIZE;
import net.runelite.api.Point;
import net.runelite.api.Player;
import net.runelite.api.Point;
import net.runelite.api.SpriteID;
import static net.runelite.api.SpriteID.TAB_QUESTS_BROWN_RAIDING_PARTY;
import net.runelite.api.Tile;
import net.runelite.api.VarPlayer;
import net.runelite.api.Varbits;
import net.runelite.api.MenuAction;
import net.runelite.api.events.ChatMessage;
import net.runelite.api.events.ClientTick;
import net.runelite.api.events.ConfigChanged;
@@ -71,8 +73,8 @@ import net.runelite.client.chat.ChatMessageManager;
import net.runelite.client.chat.QueuedMessage;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.game.ItemManager;
import net.runelite.client.events.OverlayMenuClicked;
import net.runelite.client.game.ItemManager;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.input.KeyManager;
import net.runelite.client.plugins.Plugin;
@@ -85,17 +87,15 @@ import net.runelite.client.ui.ClientToolbar;
import net.runelite.client.ui.DrawManager;
import net.runelite.client.ui.NavigationButton;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.WidgetOverlay;
import net.runelite.client.ui.overlay.OverlayMenuEntry;
import net.runelite.client.ui.overlay.WidgetOverlay;
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
import net.runelite.client.ui.overlay.tooltip.Tooltip;
import net.runelite.client.ui.overlay.tooltip.TooltipManager;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.HotkeyListener;
import net.runelite.client.util.ImageUtil;
import net.runelite.client.util.Text;
import org.apache.commons.lang3.StringUtils;
import java.util.HashSet;
import java.util.Set;
@PluginDescriptor(
name = "Chambers Of Xeric",
@@ -108,111 +108,101 @@ import java.util.Set;
@Slf4j
public class RaidsPlugin extends Plugin
{
static final DecimalFormat POINTS_FORMAT = new DecimalFormat("#,###");
private static final int LOBBY_PLANE = 3;
private static final String RAID_START_MESSAGE = "The raid has begun!";
private static final String LEVEL_COMPLETE_MESSAGE = "level complete!";
private static final String RAID_COMPLETE_MESSAGE = "Congratulations - your raid is complete!";
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###.##");
static final DecimalFormat POINTS_FORMAT = new DecimalFormat("#,###");
private static final String SPLIT_REGEX = "\\s*,\\s*";
private static final Pattern ROTATION_REGEX = Pattern.compile("\\[(.*?)]");
private static final int LINE_COMPONENT_HEIGHT = 16;
@Inject
private ItemManager itemManager;
private static final Pattern LEVEL_COMPLETE_REGEX = Pattern.compile("(.+) level complete! Duration: ([0-9:]+)");
private static final Pattern RAID_COMPLETE_REGEX = Pattern.compile("Congratulations - your raid is complete! Duration: ([0-9:]+)");
@Inject
private ChatMessageManager chatMessageManager;
@Inject
private InfoBoxManager infoBoxManager;
@Inject
private Client client;
@Inject
private DrawManager drawManager;
@Inject
private ScheduledExecutorService executor;
@Inject
private RaidsConfig config;
@Inject
private OverlayManager overlayManager;
@Inject
private RaidsOverlay overlay;
@Inject
private RaidsPointsOverlay pointsOverlay;
@Inject
private RaidsPartyOverlay partyOverlay;
@Inject
private LayoutSolver layoutSolver;
@Inject
private KeyManager keyManager;
@Inject
private SpriteManager spriteManager;
@Inject
private ClientThread clientThread;
@Inject
private TooltipManager tooltipManager;
@Getter
private final ArrayList<String> roomWhitelist = new ArrayList<>();
@Getter
private final ArrayList<String> roomBlacklist = new ArrayList<>();
@Getter
private final ArrayList<String> rotationWhitelist = new ArrayList<>();
@Getter
private final ArrayList<String> layoutWhitelist = new ArrayList<>();
@Getter
private final Map<String, List<Integer>> recommendedItemsList = new HashMap<>();
private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.hotkey())
{
@Override
public void hotkeyPressed()
{
if (config.scoutOverlayInRaid() && raidStarted)
{
if (overlay.isScoutOverlayShown())
{
overlay.setScoutOverlayShown(false);
}
else
{
overlay.setScoutOverlayShown(true);
}
}
}
};
public boolean canShow;
@Inject
private ChatMessageManager chatMessageManager;
@Inject
private InfoBoxManager infoBoxManager;
@Inject
private Client client;
@Inject
private DrawManager drawManager;
@Inject
private ScheduledExecutorService executor;
@Inject
private RaidsConfig config;
@Inject
private OverlayManager overlayManager;
@Inject
private RaidsOverlay overlay;
@Inject
private RaidsPointsOverlay pointsOverlay;
@Inject
private RaidsPartyOverlay partyOverlay;
@Inject
private LayoutSolver layoutSolver;
@Inject
private KeyManager keyManager;
@Inject
private SpriteManager spriteManager;
@Inject
private ClientThread clientThread;
@Inject
private TooltipManager tooltipManager;
@Getter
private Raid raid;
@Getter
private boolean inRaidChambers;
@Inject
private ClientToolbar clientToolbar;
private RaidsPanel panel;
private int upperTime = -1;
private int middleTime = -1;
private int lowerTime = -1;
private int raidTime = -1;
private WidgetOverlay widgetOverlay;
private String tooltip;
public boolean canShow;
@Inject
private ItemManager itemManager;
private NavigationButton navButton;
private boolean raidStarted;
@Getter
private String layoutFullCode;
private RaidsTimer timer;
@Getter
private int startPlayerCount;
@Getter
private List<String> partyMembers = new ArrayList<>();
@Getter
private List<String> startingPartyMembers = new ArrayList<>();
@Getter
private Set<String> missingPartyMembers = new HashSet<>();
@@ -241,7 +231,7 @@ public class RaidsPlugin extends Plugin
updateLists();
clientThread.invokeLater(() -> checkRaidPresence(true));
widgetOverlay = overlayManager.getWidgetOverlay(WidgetInfo.RAIDS_POINTS_INFOBOX);
panel = injector.getInstance(RaidsPanel.class);
RaidsPanel panel = injector.getInstance(RaidsPanel.class);
panel.init(config);
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(this.getClass(), "instancereloadhelper.png");
navButton = NavigationButton.builder()
@@ -485,13 +475,12 @@ public class RaidsPlugin extends Plugin
}
}
@Subscribe
public void onOverlayMenuClicked(OverlayMenuClicked event)
{
OverlayMenuEntry entry = event.getEntry();
if (entry.getMenuAction() == MenuAction.RUNELITE_OVERLAY &&
entry.getTarget().equals("Raids party overlay"))
entry.getTarget().equals("Raids party overlay"))
{
switch (entry.getOption())
{
@@ -573,7 +562,7 @@ public class RaidsPlugin extends Plugin
}
}
public void checkRaidPresence(boolean force)
void checkRaidPresence(boolean force)
{
if (client.getGameState() != GameState.LOGGED_IN)
{
@@ -605,6 +594,8 @@ public class RaidsPlugin extends Plugin
return;
}
layoutFullCode = layout.getTest();
log.debug("Full Layout Code: " + layoutFullCode);
raid.updateLayout(layout);
RotationSolver.solve(raid.getCombatRooms());
overlay.setScoutOverlayShown(true);
@@ -1073,23 +1064,4 @@ public class RaidsPlugin extends Plugin
tooltip = builder.toString();
}
private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.hotkey())
{
@Override
public void hotkeyPressed()
{
if (config.scoutOverlayInRaid() && raidStarted)
{
if (overlay.isScoutOverlayShown())
{
overlay.setScoutOverlayShown(false);
}
else
{
overlay.setScoutOverlayShown(true);
}
}
}
};
}

View File

@@ -44,14 +44,6 @@ import net.runelite.client.ui.overlay.components.table.TableComponent;
public class RaidsPointsOverlay extends Overlay
{
@Inject
private Client client;
@Inject
private RaidsPlugin plugin;
private final PanelComponent panel = new PanelComponent();
private static final NumberFormat UNIQUE_FORMAT = NumberFormat.getPercentInstance(Locale.ENGLISH);
static
@@ -60,6 +52,12 @@ public class RaidsPointsOverlay extends Overlay
UNIQUE_FORMAT.setMinimumFractionDigits(2);
}
private final PanelComponent panel = new PanelComponent();
@Inject
private Client client;
@Inject
private RaidsPlugin plugin;
@Inject
private RaidsPointsOverlay(RaidsPlugin plugin)
{
@@ -96,17 +94,6 @@ public class RaidsPointsOverlay extends Overlay
}
tableComponent.addRow("Unique:", UNIQUE_FORMAT.format(uniqueChance));
//TODO this is annoyingly bugged, personalpoints returns null for some reason
/*
if (partySize > 1)
{
double personalChance = uniqueChance * (double)(personalPoints / totalPoints);
panel.getChildren().add(LineComponent.builder()
.left("Personal:")
.right(UNIQUE_FORMAT.format(personalChance))
.build());
}*/
panel.getChildren().add(tableComponent);

View File

@@ -47,7 +47,7 @@ public class RaidsTimer extends InfoBox
@Setter
private boolean stopped;
public RaidsTimer(BufferedImage image, Plugin plugin, Instant startTime)
RaidsTimer(BufferedImage image, Plugin plugin, Instant startTime)
{
super(image, plugin);
this.startTime = startTime;
@@ -55,7 +55,7 @@ public class RaidsTimer extends InfoBox
stopped = false;
}
public void timeFloor()
void timeFloor()
{
Duration elapsed = Duration.between(floorTime, Instant.now());
@@ -75,45 +75,12 @@ public class RaidsTimer extends InfoBox
floorTime = Instant.now();
}
public void timeOlm()
void timeOlm()
{
Duration elapsed = Duration.between(floorTime, Instant.now());
olmTime = LocalTime.ofSecondOfDay(elapsed.getSeconds());
}
@Override
public String getText()
{
if (startTime == null)
{
return "";
}
if (!stopped)
{
Duration elapsed = Duration.between(startTime, Instant.now());
time = LocalTime.ofSecondOfDay(elapsed.getSeconds());
}
if (time.getHour() > 0)
{
return time.format(DateTimeFormatter.ofPattern("HH:mm"));
}
return time.format(DateTimeFormatter.ofPattern("mm:ss"));
}
@Override
public Color getTextColor()
{
if (stopped)
{
return Color.GREEN;
}
return Color.WHITE;
}
@Override
public String getTooltip()
{
@@ -147,4 +114,37 @@ public class RaidsTimer extends InfoBox
return builder.toString();
}
@Override
public String getText()
{
if (startTime == null)
{
return "";
}
if (!stopped)
{
Duration elapsed = Duration.between(startTime, Instant.now());
time = LocalTime.ofSecondOfDay(elapsed.getSeconds());
}
if (time.getHour() > 0)
{
return time.format(DateTimeFormatter.ofPattern("HH:mm"));
}
return time.format(DateTimeFormatter.ofPattern("mm:ss"));
}
@Override
public Color getTextColor()
{
if (stopped)
{
return Color.GREEN;
}
return Color.WHITE;
}
}

View File

@@ -26,17 +26,14 @@ import net.runelite.client.ui.overlay.OverlayManager;
@Slf4j
public class ShortcutPlugin extends Plugin
{
private final List<TileObject> shortcut = new ArrayList<>();
@Inject
private Client client;
@Inject
private OverlayManager overlayManager;
@Inject
private ShortcutOverlay overlay;
private final List<TileObject> shortcut = new ArrayList<>();
List<TileObject> getShortcut()
{
return shortcut;

View File

@@ -27,12 +27,17 @@ package net.runelite.client.plugins.raids.solver;
import java.util.ArrayList;
import java.util.List;
import lombok.Getter;
import lombok.Setter;
public class Layout
{
@Getter
private final List<Room> rooms = new ArrayList<>();
@Getter
@Setter
private String test;
public void add(Room room)
{
rooms.add(room);

View File

@@ -213,6 +213,7 @@ public class LayoutSolver
room.setPrevious(lastRoom);
lastRoom.setNext(room);
layout.add(room);
layout.setTest(code);
position += 8;
}

View File

@@ -32,25 +32,6 @@ import net.runelite.client.plugins.raids.RaidRoom.Boss;
public class RotationSolver
{
private static class Rotation<E> extends ArrayList<E>
{
Rotation(Collection<? extends E> bosses)
{
super(bosses);
}
@Override
public E get(int index)
{
if (index < 0)
{
index = index + size();
}
return super.get(index % size());
}
}
private static final Rotation[] ROTATIONS =
{
new Rotation<>(Arrays.asList(Boss.TEKTON, Boss.VASA, Boss.GUARDIANS, Boss.MYSTICS, Boss.SHAMANS, Boss.MUTTADILES, Boss.VANGUARDS, Boss.VESPULA)),
@@ -147,4 +128,23 @@ public class RotationSolver
return true;
}
private static class Rotation<E> extends ArrayList<E>
{
Rotation(Collection<? extends E> bosses)
{
super(bosses);
}
@Override
public E get(int index)
{
if (index < 0)
{
index = index + size();
}
return super.get(index % size());
}
}
}