Merge pull request #125 from runelite-extended/raidsupdate
Raids Plugin Overhaul
This commit is contained in:
@@ -0,0 +1,502 @@
|
||||
package net.runelite.client.plugins.newraids;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.BoxLayout;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.JPopupMenu;
|
||||
import javax.swing.SwingUtilities;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.game.SkillIconManager;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.ui.PluginPanel;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
|
||||
public class PointsPanel extends PluginPanel
|
||||
{
|
||||
|
||||
static final JPanel infoBoxPanel = new JPanel();
|
||||
public static ArrayList<data> raids = new ArrayList<data>();
|
||||
@Inject
|
||||
private static RaidsPlugin raidsPlugin;
|
||||
@Inject
|
||||
private static Client client;
|
||||
@Inject
|
||||
private static SkillIconManager iconManager;
|
||||
final JMenuItem pausePopup = new JMenuItem("Pause Timer");
|
||||
final JButton pauseButton = new JButton("Pause Timer");
|
||||
final JPanel overallInfo = new JPanel();
|
||||
private final Map<data, XpInfoBox> infoBoxes = new HashMap<>();
|
||||
private final JLabel overallPointsGained = new JLabel(XpInfoBox.htmlLabel("Personal Points: ", 0));
|
||||
private final JLabel overallPointsPerHour = new JLabel(XpInfoBox.htmlLabel("Per Hour: ", 0));
|
||||
private final JLabel teamPointsGained = new JLabel(XpInfoBox.htmlLabel("Team Points: ", 0));
|
||||
private final JLabel teamPointsPerHour = new JLabel(XpInfoBox.htmlLabel("Per Hour: ", 0));
|
||||
private final JLabel raidsCompleted = new JLabel(XpInfoBox.htmlLabel("Raids Done: ", 0));
|
||||
private final JLabel averageTime = new JLabel(XpInfoBox.htmlLabel("Avg. Raid Time: ", "00:00:00"));
|
||||
private final JLabel averagePoints = new JLabel(XpInfoBox.htmlLabel("Avg. Points: ", 0));
|
||||
private final JLabel averagePointsTeam = new JLabel(XpInfoBox.htmlLabel("Avg. Points: ", 0));
|
||||
private final JLabel elapsedTime = new JLabel(XpInfoBox.htmlLabel("Elapsed Time: ", "00:00:00"));
|
||||
private final JLabel blankline1 = new JLabel("<html><br></html>");
|
||||
private final JLabel blankline = new JLabel("<html><br></html>");
|
||||
private final JLabel blankline2 = new JLabel("<html><br></html>");
|
||||
private final JPanel overallPanel = new JPanel();
|
||||
public Date finalTime = new Date();
|
||||
public Date tempTime = new Date();
|
||||
public boolean paused = false;
|
||||
public boolean soloMode;
|
||||
timerSpecial timer = new timerSpecial();
|
||||
ActionListener action = new ActionListener()
|
||||
{
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event)
|
||||
{
|
||||
updateTime();
|
||||
}
|
||||
};
|
||||
@Inject
|
||||
private RaidsConfig raidsConfig;
|
||||
|
||||
PointsPanel(RaidsPlugin raidsPlugin, RaidsConfig raidsConfig, Client client, SkillIconManager iconManager)
|
||||
{
|
||||
|
||||
super();
|
||||
setBorder(new EmptyBorder(6, 6, 6, 6));
|
||||
setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
final JPanel layoutPanel = new JPanel();
|
||||
BoxLayout boxLayout = new BoxLayout(layoutPanel, BoxLayout.Y_AXIS);
|
||||
layoutPanel.setLayout(boxLayout);
|
||||
add(layoutPanel, BorderLayout.NORTH);
|
||||
|
||||
overallPanel.setBorder(new EmptyBorder(10, 10, 10, 10));
|
||||
overallPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
overallPanel.setLayout(new BorderLayout());
|
||||
overallPanel.setVisible(true); // this will only become visible when the player gets exp
|
||||
|
||||
// Create reset all menu
|
||||
final JMenuItem reset = new JMenuItem("Reset Tracker");
|
||||
reset.addActionListener(e -> resetAll(true));
|
||||
|
||||
pausePopup.addActionListener(e -> pauseTime());
|
||||
pauseButton.addActionListener(e -> pauseTime());
|
||||
|
||||
|
||||
// Create popup menu
|
||||
final JPopupMenu popupMenu = new JPopupMenu();
|
||||
popupMenu.setBorder(new EmptyBorder(5, 5, 5, 5));
|
||||
popupMenu.add(reset);
|
||||
popupMenu.add(pausePopup);
|
||||
overallPanel.setComponentPopupMenu(popupMenu);
|
||||
final BufferedImage image = ImageUtil.getResourceStreamFromClass(this.getClass(), "cox.png");
|
||||
ImageIcon i = new ImageIcon(image);
|
||||
final JLabel overallIcon = new JLabel(i);
|
||||
|
||||
|
||||
overallInfo.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
overallInfo.setLayout(new GridLayout(12, 1));
|
||||
overallInfo.setBorder(new EmptyBorder(0, 10, 0, 0));
|
||||
pauseButton.setFont(FontManager.getRunescapeSmallFont());
|
||||
overallInfo.add(pauseButton);
|
||||
overallPointsGained.setFont(FontManager.getRunescapeSmallFont());
|
||||
overallPointsPerHour.setFont(FontManager.getRunescapeSmallFont());
|
||||
teamPointsGained.setFont(FontManager.getRunescapeSmallFont());
|
||||
raidsCompleted.setFont(FontManager.getRunescapeSmallFont());
|
||||
averagePoints.setFont(FontManager.getRunescapeSmallFont());
|
||||
averageTime.setFont(FontManager.getRunescapeSmallFont());
|
||||
teamPointsPerHour.setFont(FontManager.getRunescapeSmallFont());
|
||||
blankline1.setFont(FontManager.getRunescapeSmallFont());
|
||||
blankline.setFont(FontManager.getRunescapeSmallFont());
|
||||
blankline2.setFont(FontManager.getRunescapeSmallFont());
|
||||
averagePointsTeam.setFont(FontManager.getRunescapeSmallFont());
|
||||
elapsedTime.setFont(FontManager.getRunescapeSmallFont());
|
||||
overallInfo.add(teamPointsGained);
|
||||
overallInfo.add(teamPointsPerHour);
|
||||
overallInfo.add(averagePointsTeam);
|
||||
|
||||
overallInfo.add(blankline1);
|
||||
overallInfo.add(overallPointsGained);
|
||||
|
||||
overallInfo.add(overallPointsPerHour);
|
||||
|
||||
overallInfo.add(averagePoints);
|
||||
overallInfo.add(blankline2);
|
||||
overallInfo.add(raidsCompleted);
|
||||
|
||||
overallInfo.add(averageTime);
|
||||
overallInfo.add(elapsedTime);
|
||||
|
||||
overallPanel.add(overallIcon, BorderLayout.WEST);
|
||||
overallPanel.add(overallInfo, BorderLayout.CENTER);
|
||||
|
||||
|
||||
infoBoxPanel.setLayout(new BoxLayout(infoBoxPanel, BoxLayout.Y_AXIS));
|
||||
layoutPanel.add(overallPanel);
|
||||
layoutPanel.add(infoBoxPanel);
|
||||
|
||||
try
|
||||
{
|
||||
for (data d : raids)
|
||||
{
|
||||
infoBoxPanel.add(new XpInfoBox(raidsPlugin, raidsConfig, client, infoBoxPanel, d, iconManager));
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
for(data d : raids){
|
||||
try {
|
||||
infoBoxPanel.add(new XpInfoBox(raidsPlugin, raidsConfig, client, infoBoxPanel, Skill.AGILITY, iconManager));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
*/
|
||||
public static long getDateDiff(Date date1, Date date2, TimeUnit timeUnit)
|
||||
{
|
||||
long diffInMillies = date2.getTime() - date1.getTime();
|
||||
return timeUnit.convert(diffInMillies, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
||||
public static String formatSeconds(int timeInSeconds)
|
||||
{
|
||||
int hours = timeInSeconds / 3600;
|
||||
int secondsLeft = timeInSeconds - hours * 3600;
|
||||
int minutes = secondsLeft / 60;
|
||||
int seconds = secondsLeft - minutes * 60;
|
||||
|
||||
String formattedTime = "";
|
||||
if (hours < 10)
|
||||
{
|
||||
formattedTime += "0";
|
||||
}
|
||||
formattedTime += hours + ":";
|
||||
|
||||
if (minutes < 10)
|
||||
{
|
||||
formattedTime += "0";
|
||||
}
|
||||
formattedTime += minutes + ":";
|
||||
|
||||
if (seconds < 10)
|
||||
{
|
||||
formattedTime += "0";
|
||||
}
|
||||
formattedTime += seconds;
|
||||
|
||||
return formattedTime;
|
||||
}
|
||||
|
||||
@Provides
|
||||
RaidsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(RaidsConfig.class);
|
||||
}
|
||||
|
||||
XpInfoBox test(data d)
|
||||
{
|
||||
try
|
||||
{
|
||||
XpInfoBox x;
|
||||
x = new XpInfoBox(raidsPlugin, raidsConfig, client, infoBoxPanel, d, iconManager);
|
||||
return x;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
SoloBox testS(data d)
|
||||
{
|
||||
try
|
||||
{
|
||||
SoloBox x;
|
||||
x = new SoloBox(raidsPlugin, raidsConfig, client, infoBoxPanel, d, iconManager);
|
||||
return x;
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void update()
|
||||
{
|
||||
int totalPoints = 0;
|
||||
int totalTeamPoints = 0;
|
||||
float teamperhour = 0;
|
||||
infoBoxPanel.removeAll();
|
||||
Date startTime = null;
|
||||
Date finishTime = null;
|
||||
int totalTime = 0;
|
||||
float difference = 0;
|
||||
int raidsDone = 0;
|
||||
for (data d : raids)
|
||||
{
|
||||
SwingUtilities.invokeLater(() -> infoBoxPanel.add(test(d)));
|
||||
totalPoints = totalPoints + d.personal;
|
||||
totalTeamPoints = totalTeamPoints + d.total;
|
||||
raidsDone++;
|
||||
totalTime = totalTime + d.timeTaken;
|
||||
}
|
||||
if (timer.getElapsedTime() > 0)
|
||||
{
|
||||
difference = timer.getElapsedTime();
|
||||
teamperhour = (totalTeamPoints / difference) * 3600;
|
||||
difference = (totalPoints / difference) * 3600;
|
||||
}
|
||||
|
||||
overallInfo.removeAll();
|
||||
overallInfo.setLayout(new GridLayout(12, 1));
|
||||
teamPointsPerHour.setVisible(true);
|
||||
teamPointsGained.setVisible(true);
|
||||
overallInfo.add(pauseButton);
|
||||
overallInfo.add(teamPointsGained);
|
||||
overallInfo.add(teamPointsPerHour);
|
||||
overallInfo.add(averagePointsTeam);
|
||||
|
||||
overallInfo.add(blankline1);
|
||||
overallInfo.add(overallPointsGained);
|
||||
|
||||
overallInfo.add(overallPointsPerHour);
|
||||
|
||||
overallInfo.add(averagePoints);
|
||||
overallInfo.add(blankline2);
|
||||
overallInfo.add(raidsCompleted);
|
||||
|
||||
overallInfo.add(averageTime);
|
||||
overallInfo.add(elapsedTime);
|
||||
overallPointsGained.setText(XpInfoBox.htmlLabel("Personal Points: ", totalPoints));
|
||||
overallPointsPerHour.setText(XpInfoBox.htmlLabel("Per Hour: ", (int) difference));
|
||||
teamPointsGained.setText(XpInfoBox.htmlLabel("Team Points: ", totalTeamPoints));
|
||||
teamPointsPerHour.setText(XpInfoBox.htmlLabel("Per Hour: ", (int) teamperhour));
|
||||
|
||||
raidsCompleted.setText(XpInfoBox.htmlLabel("Raids Done: ", raidsDone));
|
||||
if (raidsDone > 0)
|
||||
{
|
||||
elapsedTime.setText(XpInfoBox.htmlLabel("Elapsed Time: ", formatSeconds((int) timer.getElapsedTime())));
|
||||
averageTime.setText(XpInfoBox.htmlLabel("Avg. Raid Time: ", formatSeconds(totalTime / raidsDone)));
|
||||
averagePoints.setText(XpInfoBox.htmlLabel("Avg. Points: ", totalPoints / raidsDone));
|
||||
averagePointsTeam.setText(XpInfoBox.htmlLabel("Avg. Points: ", totalTeamPoints / raidsDone));
|
||||
}
|
||||
else
|
||||
{
|
||||
elapsedTime.setText(XpInfoBox.htmlLabel("Elapsed Time: ", "00:00:00"));
|
||||
averageTime.setText(XpInfoBox.htmlLabel("Avg. Raid Time: ", "00:00:00"));
|
||||
averagePoints.setText(XpInfoBox.htmlLabel("Avg. Points: ", 0));
|
||||
averagePointsTeam.setText(XpInfoBox.htmlLabel("Avg. Points: ", 0));
|
||||
}
|
||||
|
||||
|
||||
infoBoxPanel.revalidate();
|
||||
}
|
||||
|
||||
void updateSolo()
|
||||
{
|
||||
int totalPoints = 0;
|
||||
int totalTeamPoints = 0;
|
||||
float teamperhour = 0;
|
||||
infoBoxPanel.removeAll();
|
||||
Date startTime = null;
|
||||
Date finishTime = null;
|
||||
int totalTime = 0;
|
||||
float difference = 0;
|
||||
int raidsDone = 0;
|
||||
if (raids.size() > 0)
|
||||
{
|
||||
startTime = raids.get(0).start;
|
||||
finishTime = raids.get(raids.size() - 1).finish;
|
||||
difference = getDateDiff(startTime, finishTime, TimeUnit.SECONDS);
|
||||
}
|
||||
for (data d : raids)
|
||||
{
|
||||
SwingUtilities.invokeLater(() -> infoBoxPanel.add(testS(d)));
|
||||
totalPoints = totalPoints + d.personal;
|
||||
totalTeamPoints = totalTeamPoints + d.total;
|
||||
raidsDone++;
|
||||
totalTime = totalTime + d.timeTaken;
|
||||
}
|
||||
|
||||
if (timer.getElapsedTime() > 0)
|
||||
{
|
||||
difference = timer.getElapsedTime();
|
||||
teamperhour = (totalTeamPoints / difference) * 3600;
|
||||
difference = (totalPoints / difference) * 3600;
|
||||
}
|
||||
overallInfo.removeAll();
|
||||
overallInfo.setLayout(new GridLayout(7, 1));
|
||||
overallInfo.add(pauseButton);
|
||||
overallInfo.add(overallPointsGained);
|
||||
overallInfo.add(overallPointsPerHour);
|
||||
overallInfo.add(blankline);
|
||||
overallInfo.add(raidsCompleted);
|
||||
overallInfo.add(averageTime);
|
||||
overallInfo.add(elapsedTime);
|
||||
overallPointsGained.setText(XpInfoBox.htmlLabel("Personal Points: ", totalPoints));
|
||||
overallPointsPerHour.setText(XpInfoBox.htmlLabel("Per Hour: ", (int) difference));
|
||||
teamPointsGained.setText(XpInfoBox.htmlLabel("Team Points: ", totalTeamPoints));
|
||||
teamPointsPerHour.setText(XpInfoBox.htmlLabel("Per Hour: ", (int) teamperhour));
|
||||
|
||||
raidsCompleted.setText(XpInfoBox.htmlLabel("Raids Done: ", raidsDone));
|
||||
if (raidsDone > 0)
|
||||
{
|
||||
elapsedTime.setText(XpInfoBox.htmlLabel("Elapsed Time: ", formatSeconds((int) timer.getElapsedTime())));
|
||||
averageTime.setText(XpInfoBox.htmlLabel("Avg. Raid Time: ", formatSeconds(totalTime / raidsDone)));
|
||||
averagePoints.setText(XpInfoBox.htmlLabel("Avg. Points: ", totalPoints / raidsDone));
|
||||
averagePointsTeam.setText(XpInfoBox.htmlLabel("Avg. Points: ", totalTeamPoints / raidsDone));
|
||||
}
|
||||
else
|
||||
{
|
||||
elapsedTime.setText(XpInfoBox.htmlLabel("Elapsed Time: ", "00:00:00"));
|
||||
averageTime.setText(XpInfoBox.htmlLabel("Avg. Raid Time: ", "00:00:00"));
|
||||
averagePoints.setText(XpInfoBox.htmlLabel("Avg. Points: ", 0));
|
||||
averagePointsTeam.setText(XpInfoBox.htmlLabel("Avg. Points: ", 0));
|
||||
}
|
||||
teamPointsPerHour.setVisible(false);
|
||||
teamPointsGained.setVisible(false);
|
||||
infoBoxPanel.revalidate();
|
||||
}
|
||||
|
||||
void unpauseTime()
|
||||
{
|
||||
if (!timer.started)
|
||||
{
|
||||
return;
|
||||
}
|
||||
timer.unpause();
|
||||
pausePopup.setText("Pause Timer");
|
||||
pauseButton.setText("Pause Timer");
|
||||
for (ActionListener d : pausePopup.getActionListeners())
|
||||
{
|
||||
pausePopup.removeActionListener(d);
|
||||
}
|
||||
for (ActionListener d : pauseButton.getActionListeners())
|
||||
{
|
||||
pauseButton.removeActionListener(d);
|
||||
}
|
||||
pausePopup.addActionListener(e -> pauseTime());
|
||||
pauseButton.addActionListener(e -> pauseTime());
|
||||
}
|
||||
|
||||
public void updateTime()
|
||||
{
|
||||
finalTime = new Date();
|
||||
int totalPoints = 0;
|
||||
int totalTeamPoints = 0;
|
||||
int raidsDone = 0;
|
||||
int totalTime = 0;
|
||||
if (raids.size() > 0)
|
||||
{
|
||||
int difference;
|
||||
int teamperhour;
|
||||
for (data d : raids)
|
||||
{
|
||||
totalPoints = totalPoints + d.personal;
|
||||
totalTeamPoints = totalTeamPoints + d.total;
|
||||
raidsDone++;
|
||||
totalTime = totalTime + d.timeTaken;
|
||||
}
|
||||
if (timer.getElapsedTime() > 0)
|
||||
{
|
||||
difference = (int) timer.getElapsedTime();
|
||||
teamperhour = (int) ((totalTeamPoints / (float) difference) * 3600);
|
||||
difference = (int) ((totalPoints / (float) difference) * 3600);
|
||||
overallPointsGained.setText(XpInfoBox.htmlLabel("Personal Points: ", totalPoints));
|
||||
overallPointsPerHour.setText(XpInfoBox.htmlLabel("Per Hour: ", difference));
|
||||
teamPointsGained.setText(XpInfoBox.htmlLabel("Team Points: ", totalTeamPoints));
|
||||
teamPointsPerHour.setText(XpInfoBox.htmlLabel("Per Hour: ", teamperhour));
|
||||
}
|
||||
|
||||
elapsedTime.setText(XpInfoBox.htmlLabel("Elapsed Time: ", formatSeconds((int) timer.getElapsedTime())));
|
||||
revalidate();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void pauseTime()
|
||||
{
|
||||
|
||||
if (!timer.started)
|
||||
{
|
||||
return;
|
||||
}
|
||||
timer.pause();
|
||||
pausePopup.setText("Resume Timer");
|
||||
pauseButton.setText("Resume Timer");
|
||||
for (ActionListener d : pausePopup.getActionListeners())
|
||||
{
|
||||
pausePopup.removeActionListener(d);
|
||||
}
|
||||
for (ActionListener d : pauseButton.getActionListeners())
|
||||
{
|
||||
pauseButton.removeActionListener(d);
|
||||
}
|
||||
pausePopup.addActionListener(e -> unpauseTime());
|
||||
pauseButton.addActionListener(e -> unpauseTime());
|
||||
}
|
||||
|
||||
void resetAll(boolean solo)
|
||||
{
|
||||
timer = new timerSpecial();
|
||||
pausePopup.setText("Pause Timer");
|
||||
pauseButton.setText("Pause Timer");
|
||||
for (ActionListener d : pausePopup.getActionListeners())
|
||||
{
|
||||
pausePopup.removeActionListener(d);
|
||||
}
|
||||
for (ActionListener d : pauseButton.getActionListeners())
|
||||
{
|
||||
pauseButton.removeActionListener(d);
|
||||
}
|
||||
pausePopup.addActionListener(e -> pauseTime());
|
||||
pauseButton.addActionListener(e -> pauseTime());
|
||||
raids.clear();
|
||||
if (soloMode)
|
||||
{
|
||||
updateSolo();
|
||||
}
|
||||
else
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void setSolo(boolean solo)
|
||||
{
|
||||
soloMode = solo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Kamiel
|
||||
* 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.newraids;
|
||||
|
||||
import com.google.common.base.Joiner;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import net.runelite.client.plugins.newraids.solver.Layout;
|
||||
import net.runelite.client.plugins.newraids.solver.Room;
|
||||
|
||||
public class Raid
|
||||
{
|
||||
@Getter
|
||||
private final RaidRoom[] rooms = new RaidRoom[16];
|
||||
|
||||
@Getter
|
||||
private Layout layout;
|
||||
|
||||
public void updateLayout(Layout layout)
|
||||
{
|
||||
if (layout == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.layout = layout;
|
||||
|
||||
for (int i = 0; i < rooms.length; i++)
|
||||
{
|
||||
if (layout.getRoomAt(i) == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
RaidRoom room = rooms[i];
|
||||
|
||||
if (room == null)
|
||||
{
|
||||
RaidRoom.Type type = RaidRoom.Type.fromCode(layout.getRoomAt(i).getSymbol());
|
||||
room = new RaidRoom(null, type);
|
||||
|
||||
if (type == RaidRoom.Type.COMBAT)
|
||||
{
|
||||
room.setBoss(RaidRoom.Boss.UNKNOWN);
|
||||
}
|
||||
|
||||
if (type == RaidRoom.Type.PUZZLE)
|
||||
{
|
||||
room.setPuzzle(RaidRoom.Puzzle.UNKNOWN);
|
||||
}
|
||||
|
||||
setRoom(room, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public RaidRoom getRoom(int position)
|
||||
{
|
||||
return rooms[position];
|
||||
}
|
||||
|
||||
public void setRoom(RaidRoom room, int position)
|
||||
{
|
||||
if (position < rooms.length)
|
||||
{
|
||||
rooms[position] = room;
|
||||
}
|
||||
}
|
||||
|
||||
public RaidRoom[] getCombatRooms()
|
||||
{
|
||||
List<RaidRoom> combatRooms = new ArrayList<>();
|
||||
|
||||
for (Room room : layout.getRooms())
|
||||
{
|
||||
if (room == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rooms[room.getPosition()].getType() == RaidRoom.Type.COMBAT)
|
||||
{
|
||||
combatRooms.add(rooms[room.getPosition()]);
|
||||
}
|
||||
}
|
||||
|
||||
return combatRooms.toArray(new RaidRoom[combatRooms.size()]);
|
||||
}
|
||||
|
||||
public String getRotationString()
|
||||
{
|
||||
return Joiner.on(",").join(Arrays.stream(getCombatRooms()).map(r -> r.getBoss().getName()).toArray());
|
||||
}
|
||||
|
||||
public String toCode()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (RaidRoom room : rooms)
|
||||
{
|
||||
if (room != null)
|
||||
{
|
||||
builder.append(room.getType().getCode());
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.append(" ");
|
||||
}
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public String toRoomString()
|
||||
{
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (Room r : getLayout().getRooms())
|
||||
{
|
||||
final int position = r.getPosition();
|
||||
final RaidRoom room = getRoom(position);
|
||||
|
||||
if (room == null || !(room.getType() == RaidRoom.Type.COMBAT || room.getType() == RaidRoom.Type.PUZZLE))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (room.getType())
|
||||
{
|
||||
case PUZZLE:
|
||||
final RaidRoom.Puzzle puzzle = room.getPuzzle();
|
||||
sb.append(puzzle.getName());
|
||||
|
||||
if (puzzle == RaidRoom.Puzzle.UNKNOWN)
|
||||
{
|
||||
sb.append(" (puzzle)");
|
||||
}
|
||||
|
||||
sb.append(", ");
|
||||
break;
|
||||
case COMBAT:
|
||||
final RaidRoom.Boss boss = room.getBoss();
|
||||
sb.append(boss.getName());
|
||||
|
||||
if (boss == RaidRoom.Boss.UNKNOWN)
|
||||
{
|
||||
sb.append(" (combat)");
|
||||
}
|
||||
|
||||
sb.append(", ");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
final String roomsString = sb.toString();
|
||||
return roomsString.substring(0, roomsString.length() - 2);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,161 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Kamiel
|
||||
* 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.newraids;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Tile;
|
||||
|
||||
public class RaidRoom
|
||||
{
|
||||
public 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;
|
||||
|
||||
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() + ")";
|
||||
}
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum Type
|
||||
{
|
||||
START("Start", "#"),
|
||||
END("End", "¤"),
|
||||
SCAVENGERS("Scavengers", "S"),
|
||||
FARMING("Farming", "F"),
|
||||
COMBAT("Combat", "C"),
|
||||
PUZZLE("Puzzle", "P"),
|
||||
EMPTY("Empty", " ");
|
||||
|
||||
@Getter
|
||||
private final String name;
|
||||
|
||||
@Getter
|
||||
private final String code;
|
||||
|
||||
public static Type fromCode(char code)
|
||||
{
|
||||
for (Type type : Type.values())
|
||||
{
|
||||
if (type.getCode().equalsIgnoreCase(String.valueOf(code)))
|
||||
{
|
||||
return type;
|
||||
}
|
||||
}
|
||||
|
||||
return Type.EMPTY;
|
||||
}
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum Boss
|
||||
{
|
||||
TEKTON("Tekton"),
|
||||
MUTTADILES("Muttadiles"),
|
||||
GUARDIANS("Guardians"),
|
||||
VESPULA("Vespula"),
|
||||
SHAMANS("Shamans"),
|
||||
VASA("Vasa"),
|
||||
VANGUARDS("Vanguards"),
|
||||
MYSTICS("Mystics"),
|
||||
UNKNOWN("Unknown");
|
||||
|
||||
@Getter
|
||||
private final String name;
|
||||
|
||||
public static Boss fromString(String name)
|
||||
{
|
||||
for (Boss boss : Boss.values())
|
||||
{
|
||||
if (boss.getName().equalsIgnoreCase(name))
|
||||
{
|
||||
return boss;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@AllArgsConstructor
|
||||
public enum Puzzle
|
||||
{
|
||||
CRABS("Crabs"),
|
||||
ICE_DEMON("Ice Demon"),
|
||||
TIGHTROPE("Tightrope"),
|
||||
THIEVING("Thieving"),
|
||||
UNKNOWN("Unknown");
|
||||
|
||||
@Getter
|
||||
private final String name;
|
||||
|
||||
public static Puzzle fromString(String name)
|
||||
{
|
||||
for (Puzzle puzzle : Puzzle.values())
|
||||
{
|
||||
if (puzzle.getName().equalsIgnoreCase(name))
|
||||
{
|
||||
return puzzle;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Kamiel
|
||||
* 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.newraids;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("raids")
|
||||
public interface RaidsConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "raidsTimer",
|
||||
name = "Display elapsed raid time",
|
||||
description = "Display elapsed raid time"
|
||||
)
|
||||
default boolean raidsTimer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "pointsMessage",
|
||||
name = "Display points in chatbox after raid",
|
||||
description = "Display a message with total points, individual points and percentage at the end of a raid"
|
||||
)
|
||||
default boolean pointsMessage()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "scoutOverlay",
|
||||
name = "Show scout overlay",
|
||||
description = "Display an overlay that shows the current raid layout (when entering lobby)"
|
||||
)
|
||||
default boolean scoutOverlay()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "scoutOverlayAtBank",
|
||||
name = "Show scout overlay outside lobby",
|
||||
description = "Keep the overlay active while at the raids area"
|
||||
)
|
||||
default boolean scoutOverlayAtBank()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "scoutOverlayInRaid",
|
||||
name = "Show scout overlay inside raid",
|
||||
description = "Keep the overlay active while inside raid"
|
||||
)
|
||||
default boolean scoutOverlayInRaid()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "whitelistedRooms",
|
||||
name = "Whitelisted rooms",
|
||||
description = "Display whitelisted rooms in green on the overlay. Separate with comma (full name)"
|
||||
)
|
||||
default String whitelistedRooms()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "blacklistedRooms",
|
||||
name = "Blacklisted rooms",
|
||||
description = "Display blacklisted rooms in red on the overlay. Separate with comma (full name)"
|
||||
)
|
||||
default String blacklistedRooms()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
keyName = "enableRotationWhitelist",
|
||||
name = "Enable rotation whitelist",
|
||||
description = "Enable the rotation whitelist"
|
||||
)
|
||||
default boolean enableRotationWhitelist()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 8,
|
||||
keyName = "whitelistedRotations",
|
||||
name = "Whitelisted rotations",
|
||||
description = "Warn when boss rotation doesn't match a whitelisted one. Add rotations like [tekton, muttadile, guardians]"
|
||||
)
|
||||
default String whitelistedRotations()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
keyName = "enableLayoutWhitelist",
|
||||
name = "Enable layout whitelist",
|
||||
description = "Enable the layout whitelist"
|
||||
)
|
||||
default boolean enableLayoutWhitelist()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
keyName = "whitelistedLayouts",
|
||||
name = "Whitelisted layouts",
|
||||
description = "Warn when layout doesn't match a whitelisted one. Add layouts like CFSCPPCSCF separated with comma"
|
||||
)
|
||||
default String whitelistedLayouts()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 12,
|
||||
keyName = "ptsHr",
|
||||
name = "Enable points per hour message",
|
||||
description = "Enable the message"
|
||||
)
|
||||
default boolean ptsHr()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
keyName = "layoutMessage",
|
||||
name = "Send raid layout message when entering raid",
|
||||
description = "Sends game message with raid layout on entering new raid"
|
||||
)
|
||||
default boolean layoutMessage()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 13,
|
||||
keyName = "ptsPanelUpdate",
|
||||
name = "Enable points panel",
|
||||
description = "Enable the panel"
|
||||
)
|
||||
default boolean ptsPanel()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 14,
|
||||
keyName = "soloPanel",
|
||||
name = "Solo Points Only",
|
||||
description = "Display Only Solo Points Info"
|
||||
)
|
||||
default boolean soloPanel()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 15,
|
||||
keyName = "oldOverlay",
|
||||
name = "Old Points Overlay",
|
||||
description = "Use the old points overlay"
|
||||
)
|
||||
default boolean oldOverlay()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,162 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Kamiel
|
||||
* 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.newraids;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Setter;
|
||||
import net.runelite.api.Client;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import net.runelite.client.plugins.newraids.solver.Room;
|
||||
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;
|
||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
|
||||
public class RaidsOverlay extends Overlay
|
||||
{
|
||||
private static final int OLM_PLANE = 0;
|
||||
private final PanelComponent panelComponent = new PanelComponent();
|
||||
private Client client;
|
||||
private RaidsPlugin plugin;
|
||||
private RaidsConfig config;
|
||||
@Setter
|
||||
private boolean scoutOverlayShown = false;
|
||||
|
||||
@Inject
|
||||
private RaidsOverlay(Client client, RaidsPlugin plugin, RaidsConfig config)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.TOP_LEFT);
|
||||
setPriority(OverlayPriority.LOW);
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Raids overlay"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (!config.scoutOverlay() || !scoutOverlayShown || plugin.isInRaidChambers() && client.getPlane() == OLM_PLANE)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
panelComponent.getChildren().clear();
|
||||
|
||||
if (plugin.getRaid() == null || plugin.getRaid().getLayout() == null)
|
||||
{
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text("Unable to scout this raid!")
|
||||
.color(Color.RED)
|
||||
.build());
|
||||
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
|
||||
Color color = Color.WHITE;
|
||||
String layout = plugin.getRaid().getLayout().toCodeString();
|
||||
|
||||
if (config.enableLayoutWhitelist() && !plugin.getLayoutWhitelist().contains(layout.toLowerCase()))
|
||||
{
|
||||
color = Color.RED;
|
||||
}
|
||||
|
||||
panelComponent.getChildren().add(TitleComponent.builder()
|
||||
.text(layout)
|
||||
.color(color)
|
||||
.build());
|
||||
|
||||
int bossMatches = 0;
|
||||
int bossCount = 0;
|
||||
|
||||
if (config.enableRotationWhitelist())
|
||||
{
|
||||
bossMatches = plugin.getRotationMatches();
|
||||
}
|
||||
|
||||
for (Room layoutRoom : plugin.getRaid().getLayout().getRooms())
|
||||
{
|
||||
int position = layoutRoom.getPosition();
|
||||
RaidRoom room = plugin.getRaid().getRoom(position);
|
||||
|
||||
if (room == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
color = Color.WHITE;
|
||||
|
||||
switch (room.getType())
|
||||
{
|
||||
case COMBAT:
|
||||
bossCount++;
|
||||
if (plugin.getRoomWhitelist().contains(room.getBoss().getName().toLowerCase()))
|
||||
{
|
||||
color = Color.GREEN;
|
||||
}
|
||||
else if (plugin.getRoomBlacklist().contains(room.getBoss().getName().toLowerCase())
|
||||
|| config.enableRotationWhitelist() && bossCount > bossMatches)
|
||||
{
|
||||
color = Color.RED;
|
||||
}
|
||||
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left(room.getType().getName())
|
||||
.right(room.getBoss().getName())
|
||||
.rightColor(color)
|
||||
.build());
|
||||
|
||||
break;
|
||||
|
||||
case PUZZLE:
|
||||
if (plugin.getRoomWhitelist().contains(room.getPuzzle().getName().toLowerCase()))
|
||||
{
|
||||
color = Color.GREEN;
|
||||
}
|
||||
else if (plugin.getRoomBlacklist().contains(room.getPuzzle().getName().toLowerCase()))
|
||||
{
|
||||
color = Color.RED;
|
||||
}
|
||||
|
||||
panelComponent.getChildren().add(LineComponent.builder()
|
||||
.left(room.getType().getName())
|
||||
.right(room.getPuzzle().getName())
|
||||
.rightColor(color)
|
||||
.build());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return panelComponent.render(graphics);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Lyzrds
|
||||
* 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.newraids;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.FlowLayout;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.lang.reflect.Method;
|
||||
import javax.inject.Inject;
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.PluginPanel;
|
||||
|
||||
public class RaidsPanel extends PluginPanel
|
||||
{
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private RaidsPlugin raidsPlugin;
|
||||
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
private JButton reloadButton = new JButton("Reload Instance");
|
||||
private JButton reloadScouter = new JButton("Reload Raid Overlay");
|
||||
private JLabel reloadMessage = new JLabel("<html><center><h3>Instance Reload Helper </h3>Reloading an instance will cause your client to disconnect temporarily.<br></center></html>");
|
||||
|
||||
void init(RaidsConfig config)
|
||||
{
|
||||
|
||||
// this may or may not qualify as a hack
|
||||
// but this lets the editor pane expand to fill the whole parent panel
|
||||
getParent().setLayout(new FlowLayout());
|
||||
getParent().add(this, BorderLayout.CENTER);
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
|
||||
setBackground(ColorScheme.DARK_GRAY_COLOR);
|
||||
|
||||
JPanel reloadContainer = new JPanel();
|
||||
JPanel scouterContainer = new JPanel();
|
||||
JPanel buttons = new JPanel();
|
||||
reloadContainer.setLayout(new BorderLayout());
|
||||
buttons.setLayout(new BorderLayout());
|
||||
buttons.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
reloadContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
scouterContainer.setLayout(new BorderLayout());
|
||||
scouterContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
|
||||
JPanel reloadFrame = new JPanel();
|
||||
JPanel scoutFrame = new JPanel();
|
||||
reloadButton.addActionListener((ActionEvent e) ->
|
||||
{
|
||||
|
||||
|
||||
if ((client.getGameState() == GameState.LOGGED_IN))
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
//look for client.gameStateChanged(-1); in src files to find
|
||||
Method m = client.getClass().getClassLoader().loadClass("jr").getDeclaredMethod("fn", int.class, int.class);
|
||||
m.setAccessible(true);
|
||||
m.invoke(null, 40, -1893789506);
|
||||
|
||||
//Method m = client.getClass().getClassLoader().loadClass("jr").getDeclaredMethod("fn", int.class, int.class);
|
||||
//m.setAccessible(true);
|
||||
//m.invoke(null, 40, -1893789506);
|
||||
raidsPlugin.canShow = false;
|
||||
raidsPlugin.timerOverride = true;
|
||||
//TODO: Since this is mainly for raids i'd like to reload the raids scouting plugin after the dc is finished
|
||||
|
||||
}
|
||||
catch (ReflectiveOperationException f)
|
||||
{
|
||||
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) ->
|
||||
{
|
||||
if ((client.getGameState() == GameState.LOGGED_IN))
|
||||
{
|
||||
raidsPlugin.canShow = false;
|
||||
raidsPlugin.checkRaidPresence(true);
|
||||
}
|
||||
});
|
||||
|
||||
reloadFrame.add(reloadButton);
|
||||
scoutFrame.add(reloadScouter);
|
||||
reloadContainer.add(reloadFrame, BorderLayout.NORTH);
|
||||
reloadContainer.add(scoutFrame, BorderLayout.SOUTH);
|
||||
add(reloadMessage, BorderLayout.PAGE_START);
|
||||
add(reloadContainer, BorderLayout.CENTER);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,958 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Kamiel
|
||||
* 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.newraids;
|
||||
|
||||
import com.google.inject.Binder;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import javax.inject.Inject;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.InstanceTemplates;
|
||||
import net.runelite.api.NullObjectID;
|
||||
import static net.runelite.api.Perspective.SCENE_SIZE;
|
||||
import net.runelite.api.Point;
|
||||
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.events.ChatMessage;
|
||||
import net.runelite.api.events.ConfigChanged;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.WidgetHiddenChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
import net.runelite.client.callback.ClientThread;
|
||||
import net.runelite.client.chat.ChatColorType;
|
||||
import net.runelite.client.chat.ChatMessageBuilder;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.chat.QueuedMessage;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.game.SkillIconManager;
|
||||
import net.runelite.client.game.SpriteManager;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.plugins.newraids.solver.Layout;
|
||||
import net.runelite.client.plugins.newraids.solver.LayoutSolver;
|
||||
import net.runelite.client.plugins.newraids.solver.RotationSolver;
|
||||
import net.runelite.client.ui.ClientToolbar;
|
||||
import net.runelite.client.ui.NavigationButton;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Raids Scouter",
|
||||
description = "Show helpful information for the Chambers of Xeric raid",
|
||||
tags = {"combat", "raid", "overlay", "pve", "pvm", "bosses"},
|
||||
type = PluginType.PVM
|
||||
)
|
||||
@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 KC_MESSAGE = "Your completed Chambers of Xeric count is:";
|
||||
private static final String KC_MESSAGECM = "Your completed Chambers of Xeric Challenge Mode count is:";
|
||||
private static final String RAID_COMPLETE_MESSAGE = "Congratulations - your raid is complete!";
|
||||
private static final String RAID_COMPLETE_MESSAGE2 = "Congratulations - your raid is complete! Duration:";
|
||||
private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###.##");
|
||||
private static final String SPLIT_REGEX = "\\s*,\\s*";
|
||||
private static final Pattern ROTATION_REGEX = Pattern.compile("\\[(.*?)]");
|
||||
@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<>();
|
||||
public boolean canShow;
|
||||
public boolean timerOverride = false;
|
||||
data raidToAdd = new data();
|
||||
int ticks = 0;
|
||||
int raidSeconds;
|
||||
int backupTime;
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
@Inject
|
||||
private InfoBoxManager infoBoxManager;
|
||||
@Inject
|
||||
private SkillIconManager iconManager;
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private RaidsConfig config;
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
@Inject
|
||||
private RaidsOverlay overlay;
|
||||
@Inject
|
||||
private RaidsPointsOverlay pointsOverlay;
|
||||
@Inject
|
||||
private LayoutSolver layoutSolver;
|
||||
@Inject
|
||||
private SpriteManager spriteManager;
|
||||
@Inject
|
||||
private ClientThread clientThread;
|
||||
@Getter
|
||||
private Raid raid;
|
||||
private RaidsPanel panel;
|
||||
private PointsPanel pointsPanel;
|
||||
private NavigationButton navButton;
|
||||
private NavigationButton navButton2;
|
||||
@Getter
|
||||
private boolean inRaidChambers;
|
||||
private RaidsTimer timer;
|
||||
@Inject
|
||||
private ClientToolbar clientToolbar;
|
||||
|
||||
@Provides
|
||||
RaidsConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(RaidsConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(Binder binder)
|
||||
{
|
||||
binder.bind(RaidsOverlay.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
if (config.oldOverlay())
|
||||
{
|
||||
overlayManager.add(pointsOverlay);
|
||||
}
|
||||
updateLists();
|
||||
clientThread.invokeLater(() -> checkRaidPresence(true));
|
||||
panel = injector.getInstance(RaidsPanel.class);
|
||||
pointsPanel = new PointsPanel(this, config, client, iconManager);
|
||||
pointsPanel.init();
|
||||
if (config.soloPanel())
|
||||
{
|
||||
pointsPanel.setSolo(true);
|
||||
pointsPanel.updateSolo();
|
||||
}
|
||||
else
|
||||
{
|
||||
pointsPanel.setSolo(false);
|
||||
pointsPanel.update();
|
||||
}
|
||||
panel.init(config);
|
||||
|
||||
final BufferedImage icon = ImageUtil.getResourceStreamFromClass(this.getClass(), "instancereloadhelper.png");
|
||||
final BufferedImage iconPoint = ImageUtil.getResourceStreamFromClass(this.getClass(), "cox.png");
|
||||
|
||||
navButton = NavigationButton.builder()
|
||||
.tooltip("Raids Reload")
|
||||
.icon(icon)
|
||||
.priority(8)
|
||||
.panel(panel)
|
||||
.build();
|
||||
navButton2 = NavigationButton.builder()
|
||||
.tooltip("CoX Points")
|
||||
.icon(iconPoint)
|
||||
.priority(9)
|
||||
.panel(pointsPanel)
|
||||
.build();
|
||||
clientToolbar.addNavigation(navButton);
|
||||
if (config.ptsPanel())
|
||||
{
|
||||
clientToolbar.addNavigation(navButton2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
clientToolbar.removeNavigation(navButton);
|
||||
clientToolbar.removeNavigation(navButton2);
|
||||
overlayManager.remove(overlay);
|
||||
infoBoxManager.removeInfoBox(timer);
|
||||
overlayManager.remove(pointsOverlay);
|
||||
inRaidChambers = false;
|
||||
raid = null;
|
||||
timer = null;
|
||||
|
||||
final Widget widget = client.getWidget(WidgetInfo.RAIDS_POINTS_INFOBOX);
|
||||
if (widget != null)
|
||||
{
|
||||
widget.setHidden(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onConfigChanged(ConfigChanged event)
|
||||
{
|
||||
if (config.ptsPanel())
|
||||
{
|
||||
if (config.soloPanel())
|
||||
{
|
||||
pointsPanel.updateSolo();
|
||||
pointsPanel.setSolo(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
pointsPanel.update();
|
||||
pointsPanel.setSolo(false);
|
||||
}
|
||||
pointsPanel.revalidate();
|
||||
}
|
||||
if (!config.oldOverlay())
|
||||
{
|
||||
overlayManager.remove(pointsOverlay);
|
||||
}
|
||||
if (!event.getGroup().equals("raids"))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getKey().equals("raidsTimer"))
|
||||
{
|
||||
updateInfoBoxState();
|
||||
return;
|
||||
}
|
||||
|
||||
updateLists();
|
||||
clientThread.invokeLater(() -> checkRaidPresence(true));
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onVarbitChanged(VarbitChanged event)
|
||||
{
|
||||
checkRaidPresence(false);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetHiddenChanged(WidgetHiddenChanged event)
|
||||
{
|
||||
if (!inRaidChambers || event.isHidden())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Widget widget = event.getWidget();
|
||||
|
||||
if (widget == client.getWidget(WidgetInfo.RAIDS_POINTS_INFOBOX))
|
||||
{
|
||||
|
||||
if (config.oldOverlay())
|
||||
{
|
||||
widget.setHidden(true);
|
||||
overlayManager.add(pointsOverlay);
|
||||
}
|
||||
else
|
||||
{
|
||||
widget.setHidden(false);
|
||||
overlayManager.remove(pointsOverlay);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onChatMessage(ChatMessage event)
|
||||
{
|
||||
/*
|
||||
String t = Text.removeTags(event.getMessage());
|
||||
System.out.println(t);
|
||||
if(t.equals("Test")){
|
||||
long timeTake = r(2000,5000);
|
||||
data test = new data();
|
||||
test.add(r(50000,75000),r(10000,20000),r(20000,40000), (int) timeTake,2000,"TEST",new Date(),new Date());
|
||||
pointsPanel.raids.add(test);
|
||||
if(config.soloPanel()){
|
||||
pointsPanel.updateSolo();
|
||||
}else{
|
||||
pointsPanel.update();
|
||||
}
|
||||
if(!pointsPanel.timer.started){
|
||||
pointsPanel.timer.start(timeTake);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
String test = Text.removeTags(event.getMessage());
|
||||
if (raidToAdd != null)
|
||||
{
|
||||
raidToAdd.cm = false;
|
||||
}
|
||||
if (test.startsWith(KC_MESSAGE))
|
||||
{
|
||||
PointsPanel.raids.get(PointsPanel.raids.size() - 1).kc = Integer.parseInt(test.replaceAll("\\D+", ""));
|
||||
PointsPanel.raids.get(PointsPanel.raids.size() - 1).cm = false;
|
||||
|
||||
if (config.soloPanel())
|
||||
{
|
||||
pointsPanel.updateSolo();
|
||||
}
|
||||
else
|
||||
{
|
||||
pointsPanel.update();
|
||||
}
|
||||
|
||||
//raidToAdd.kc = Integer.parseInt(test.replaceAll("\\D+",""));
|
||||
}
|
||||
if (test.startsWith(KC_MESSAGECM))
|
||||
{
|
||||
PointsPanel.raids.get(PointsPanel.raids.size() - 1).kc = Integer.parseInt(test.replaceAll("\\D+", ""));
|
||||
PointsPanel.raids.get(PointsPanel.raids.size() - 1).cm = true;
|
||||
|
||||
if (config.soloPanel())
|
||||
{
|
||||
pointsPanel.updateSolo();
|
||||
}
|
||||
else
|
||||
{
|
||||
pointsPanel.update();
|
||||
}
|
||||
|
||||
//raidToAdd.kc = Integer.parseInt(test.replaceAll("\\D+",""));
|
||||
}
|
||||
if (inRaidChambers && event.getType() == ChatMessageType.FRIENDSCHATNOTIFICATION)
|
||||
{
|
||||
String message = Text.removeTags(event.getMessage());
|
||||
if (message.startsWith(RAID_START_MESSAGE))
|
||||
{
|
||||
raidToAdd.start = new Date();
|
||||
}
|
||||
if (message.startsWith(RAID_COMPLETE_MESSAGE))
|
||||
{
|
||||
raidToAdd.finish = new Date();
|
||||
}
|
||||
|
||||
if (config.raidsTimer() && message.startsWith(RAID_START_MESSAGE))
|
||||
{
|
||||
|
||||
timer = new RaidsTimer(spriteManager.getSprite(TAB_QUESTS_BROWN_RAIDING_PARTY, 0), this, Instant.now());
|
||||
infoBoxManager.addInfoBox(timer);
|
||||
}
|
||||
|
||||
if (timer != null && message.contains(LEVEL_COMPLETE_MESSAGE))
|
||||
{
|
||||
timer.timeFloor();
|
||||
}
|
||||
|
||||
|
||||
if (message.startsWith(RAID_COMPLETE_MESSAGE))
|
||||
{
|
||||
String stripped = message.replaceAll("[^\\d]", "");
|
||||
backupTime = 0;
|
||||
int sSec = 0;
|
||||
int sMin = 0;
|
||||
int sHour = 0;
|
||||
if (stripped.length() > 1)
|
||||
{
|
||||
sSec = Integer.parseInt(stripped.substring(stripped.length() - 2));
|
||||
stripped = stripped.substring(0, stripped.length() - 2);
|
||||
}
|
||||
if (stripped.length() > 1)
|
||||
{
|
||||
sMin = Integer.parseInt(stripped.substring(stripped.length() - 2));
|
||||
stripped = stripped.substring(0, stripped.length() - 2);
|
||||
}
|
||||
else if (stripped.length() > 0)
|
||||
{
|
||||
sMin = Integer.parseInt(stripped.substring(stripped.length() - 1));
|
||||
stripped = stripped.substring(0, stripped.length() - 1);
|
||||
}
|
||||
if (stripped.length() > 1)
|
||||
{
|
||||
sHour = Integer.parseInt(stripped.substring(stripped.length() - 2));
|
||||
stripped = stripped.substring(0, stripped.length() - 2);
|
||||
}
|
||||
else if (stripped.length() > 0)
|
||||
{
|
||||
sHour = Integer.parseInt(stripped.substring(stripped.length() - 1));
|
||||
stripped = stripped.substring(0, stripped.length() - 1);
|
||||
}
|
||||
backupTime = (sSec) + (sMin * 60) + (sHour * 3600);
|
||||
raidToAdd.timeTaken = backupTime;
|
||||
if (timer != null)
|
||||
{
|
||||
|
||||
timer.timeOlm();
|
||||
raidSeconds = backupTime;
|
||||
timerOverride = false;
|
||||
timer.setStopped(true);
|
||||
}
|
||||
raidToAdd.personal = client.getVar(Varbits.PERSONAL_POINTS);
|
||||
raidToAdd.total = client.getVar(Varbits.TOTAL_POINTS);
|
||||
raidToAdd.hr = (int) (((float) raidToAdd.personal / (float) raidToAdd.timeTaken) * 3600);
|
||||
if (config.ptsPanel())
|
||||
{
|
||||
PointsPanel.raids.add(raidToAdd);
|
||||
if (!pointsPanel.timer.started)
|
||||
{
|
||||
pointsPanel.timer.start(raidToAdd.timeTaken);
|
||||
}
|
||||
if (config.soloPanel())
|
||||
{
|
||||
pointsPanel.updateSolo();
|
||||
}
|
||||
else
|
||||
{
|
||||
pointsPanel.update();
|
||||
}
|
||||
raidToAdd = new data();
|
||||
}
|
||||
if (config.pointsMessage())
|
||||
{
|
||||
int totalPoints = client.getVar(Varbits.TOTAL_POINTS);
|
||||
int personalPoints = client.getVar(Varbits.PERSONAL_POINTS);
|
||||
|
||||
double percentage = personalPoints / (totalPoints / 100.0);
|
||||
|
||||
String chatMessage = new ChatMessageBuilder()
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append("Total points: ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(POINTS_FORMAT.format(totalPoints))
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(", Personal points: ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(POINTS_FORMAT.format(personalPoints))
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(" (")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(DECIMAL_FORMAT.format(percentage))
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append("%)")
|
||||
.build();
|
||||
|
||||
|
||||
chatMessageManager.queue(QueuedMessage.builder()
|
||||
.type(ChatMessageType.FRIENDSCHATNOTIFICATION)
|
||||
.runeLiteFormattedMessage(chatMessage)
|
||||
.build());
|
||||
if (config.ptsHr())
|
||||
{
|
||||
String pts;
|
||||
if (timer != null)
|
||||
{
|
||||
pts = POINTS_FORMAT.format(((float) personalPoints / (float) raidSeconds) * 3600);
|
||||
}
|
||||
else
|
||||
{
|
||||
pts = POINTS_FORMAT.format(((float) personalPoints / (float) backupTime) * 3600);
|
||||
}
|
||||
|
||||
|
||||
String chatMessage2 = new ChatMessageBuilder()
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append("Pts/Hr: ")
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(pts)
|
||||
.build();
|
||||
|
||||
chatMessageManager.queue(QueuedMessage.builder()
|
||||
.type(ChatMessageType.FRIENDSCHATNOTIFICATION)
|
||||
.runeLiteFormattedMessage(chatMessage2)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void checkRaidPresence(boolean force)
|
||||
{
|
||||
|
||||
if (client.getGameState() != GameState.LOGGED_IN)
|
||||
{
|
||||
return;
|
||||
}
|
||||
boolean setting = true;
|
||||
if (!force)
|
||||
{
|
||||
setting = client.getVar(Varbits.IN_RAID) == 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
if (force || inRaidChambers != setting)
|
||||
{
|
||||
inRaidChambers = setting;
|
||||
updateInfoBoxState();
|
||||
|
||||
if (inRaidChambers)
|
||||
{
|
||||
raid = buildRaid();
|
||||
|
||||
if (raid == null)
|
||||
{
|
||||
System.out.println("in cm");
|
||||
log.debug("Failed to build raid");
|
||||
return;
|
||||
}
|
||||
|
||||
Layout layout = layoutSolver.findLayout(raid.toCode());
|
||||
|
||||
if (layout == null)
|
||||
{
|
||||
log.debug("Could not find layout match");
|
||||
return;
|
||||
}
|
||||
|
||||
raid.updateLayout(layout);
|
||||
RotationSolver.solve(raid.getCombatRooms());
|
||||
raidToAdd.raid = getRaid().toRoomString();
|
||||
sendRaidLayoutMessage();
|
||||
Vector<String> puzzles = new Vector<String>();
|
||||
puzzles.clear();
|
||||
for (RaidRoom r : raid.getRooms())
|
||||
{
|
||||
if (r != null)
|
||||
{
|
||||
if (r.getPuzzle() != null)
|
||||
{
|
||||
if (r.getPuzzle().getName() != null)
|
||||
{
|
||||
puzzles.add(r.getPuzzle().getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//Push puzzles to api
|
||||
String urlString = "http://lyzrds.com/puzzles/api.php";
|
||||
boolean add = true;
|
||||
if (puzzles.size() > 3)
|
||||
{
|
||||
add = false;
|
||||
}
|
||||
if (puzzles.size() == 0)
|
||||
{
|
||||
add = false;
|
||||
}
|
||||
switch (puzzles.size())
|
||||
{
|
||||
case 1:
|
||||
urlString = urlString + "?p1=" + puzzles.get(0);
|
||||
break;
|
||||
case 2:
|
||||
urlString = urlString + "?p1=" + puzzles.get(0) + "&p2=" + puzzles.get(1);
|
||||
break;
|
||||
case 3:
|
||||
urlString = urlString + "?p1=" + puzzles.get(0) + "&p2=" + puzzles.get(1) + "&p3=" + puzzles.get(2);
|
||||
break;
|
||||
|
||||
}
|
||||
urlString = urlString + "&r=" + getRaid().getLayout().toCodeString() + ":" + getRaid().toRoomString();
|
||||
//System.out.println(urlString +"&r=" + getRaid().getLayout().toCodeString() +":"+ getRaid().toRoomString());
|
||||
if (add && canShow)
|
||||
{
|
||||
URL oracle = null;
|
||||
try
|
||||
{
|
||||
oracle = new URL(urlString.replace(" ", ""));
|
||||
}
|
||||
catch (MalformedURLException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
URLConnection yc = null;
|
||||
try
|
||||
{
|
||||
yc = oracle.openConnection();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
BufferedReader in = null;
|
||||
try
|
||||
{
|
||||
in = new BufferedReader(new InputStreamReader(
|
||||
yc.getInputStream()));
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
try
|
||||
{
|
||||
in.close();
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
canShow = true;
|
||||
overlay.setScoutOverlayShown(true);
|
||||
}
|
||||
else if (!config.scoutOverlayAtBank())
|
||||
{
|
||||
overlay.setScoutOverlayShown(false);
|
||||
}
|
||||
}
|
||||
|
||||
// If we left party raid was started or we left raid
|
||||
if (client.getVar(VarPlayer.IN_RAID_PARTY) == -1 && (!inRaidChambers || !config.scoutOverlayInRaid()))
|
||||
{
|
||||
overlay.setScoutOverlayShown(false);
|
||||
canShow = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void sendRaidLayoutMessage()
|
||||
{
|
||||
if (!config.layoutMessage())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
final String layout = getRaid().getLayout().toCodeString();
|
||||
final String rooms = getRaid().toRoomString();
|
||||
final String raidData = "[" + layout + "]: " + rooms;
|
||||
|
||||
chatMessageManager.queue(QueuedMessage.builder()
|
||||
.type(ChatMessageType.FRIENDSCHATNOTIFICATION)
|
||||
.runeLiteFormattedMessage(new ChatMessageBuilder()
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append("Layout: ")
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(raidData)
|
||||
.build())
|
||||
.build());
|
||||
}
|
||||
|
||||
private void updateInfoBoxState()
|
||||
{
|
||||
if (timer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (inRaidChambers && config.raidsTimer())
|
||||
{
|
||||
if (!infoBoxManager.getInfoBoxes().contains(timer))
|
||||
{
|
||||
infoBoxManager.addInfoBox(timer);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
infoBoxManager.removeInfoBox(timer);
|
||||
}
|
||||
|
||||
if (!inRaidChambers)
|
||||
{
|
||||
timer = null;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLists()
|
||||
{
|
||||
updateList(roomWhitelist, config.whitelistedRooms());
|
||||
updateList(roomBlacklist, config.blacklistedRooms());
|
||||
updateList(rotationWhitelist, config.whitelistedRotations());
|
||||
updateList(layoutWhitelist, config.whitelistedLayouts());
|
||||
}
|
||||
|
||||
private void updateList(ArrayList<String> list, String input)
|
||||
{
|
||||
list.clear();
|
||||
|
||||
if (list == rotationWhitelist)
|
||||
{
|
||||
Matcher m = ROTATION_REGEX.matcher(input);
|
||||
while (m.find())
|
||||
{
|
||||
String rotation = m.group(1).toLowerCase();
|
||||
|
||||
if (!list.contains(rotation))
|
||||
{
|
||||
list.add(rotation);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
list.addAll(Arrays.asList(input.toLowerCase().split(SPLIT_REGEX)));
|
||||
}
|
||||
}
|
||||
|
||||
int getRotationMatches()
|
||||
{
|
||||
String rotation = raid.getRotationString().toLowerCase();
|
||||
String[] bosses = rotation.split(SPLIT_REGEX);
|
||||
|
||||
if (rotationWhitelist.contains(rotation))
|
||||
{
|
||||
return bosses.length;
|
||||
}
|
||||
|
||||
for (String whitelisted : rotationWhitelist)
|
||||
{
|
||||
int matches = 0;
|
||||
String[] whitelistedBosses = whitelisted.split(SPLIT_REGEX);
|
||||
|
||||
for (int i = 0; i < whitelistedBosses.length; i++)
|
||||
{
|
||||
if (i < bosses.length && whitelistedBosses[i].equals(bosses[i]))
|
||||
{
|
||||
matches++;
|
||||
}
|
||||
else
|
||||
{
|
||||
matches = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (matches >= 2)
|
||||
{
|
||||
return matches;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
private Point findLobbyBase()
|
||||
{
|
||||
Tile[][] tiles = client.getScene().getTiles()[LOBBY_PLANE];
|
||||
|
||||
for (int x = 0; x < SCENE_SIZE; x++)
|
||||
{
|
||||
for (int y = 0; y < SCENE_SIZE; y++)
|
||||
{
|
||||
if (tiles[x][y] == null || tiles[x][y].getWallObject() == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (tiles[x][y].getWallObject().getId() == NullObjectID.NULL_12231)
|
||||
{
|
||||
return tiles[x][y].getSceneLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private Raid buildRaid()
|
||||
{
|
||||
Point gridBase = findLobbyBase();
|
||||
|
||||
if (gridBase == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
Raid raid = new Raid();
|
||||
Tile[][] tiles;
|
||||
int position, x, y, offsetX;
|
||||
int startX = -2;
|
||||
|
||||
for (int plane = 3; plane > 1; plane--)
|
||||
{
|
||||
tiles = client.getScene().getTiles()[plane];
|
||||
|
||||
if (tiles[gridBase.getX() + RaidRoom.ROOM_MAX_SIZE][gridBase.getY()] == null)
|
||||
{
|
||||
position = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
position = 0;
|
||||
}
|
||||
|
||||
for (int i = 1; i > -2; i--)
|
||||
{
|
||||
y = gridBase.getY() + (i * RaidRoom.ROOM_MAX_SIZE);
|
||||
|
||||
for (int j = startX; j < 4; j++)
|
||||
{
|
||||
x = gridBase.getX() + (j * RaidRoom.ROOM_MAX_SIZE);
|
||||
offsetX = 0;
|
||||
|
||||
if (x > SCENE_SIZE && position > 1 && position < 4)
|
||||
{
|
||||
position++;
|
||||
}
|
||||
|
||||
if (x < 0)
|
||||
{
|
||||
offsetX = Math.abs(x) + 1; //add 1 because the tile at x=0 will always be null
|
||||
}
|
||||
|
||||
if (x < SCENE_SIZE && y >= 0 && y < SCENE_SIZE)
|
||||
{
|
||||
if (tiles[x + offsetX][y] == null)
|
||||
{
|
||||
if (position == 4)
|
||||
{
|
||||
position++;
|
||||
break;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
if (position == 0 && startX != j)
|
||||
{
|
||||
startX = j;
|
||||
}
|
||||
|
||||
Tile base = tiles[offsetX > 0 ? 1 : x][y];
|
||||
RaidRoom room = determineRoom(base);
|
||||
raid.setRoom(room, position + Math.abs((plane - 3) * 8));
|
||||
position++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return raid;
|
||||
}
|
||||
|
||||
private RaidRoom determineRoom(Tile base)
|
||||
{
|
||||
RaidRoom room = new RaidRoom(base, RaidRoom.Type.EMPTY);
|
||||
int chunkData = client.getInstanceTemplateChunks()[base.getPlane()][(base.getSceneLocation().getX()) / 8][base.getSceneLocation().getY() / 8];
|
||||
InstanceTemplates template = InstanceTemplates.findMatch(chunkData);
|
||||
|
||||
if (template == null)
|
||||
{
|
||||
return room;
|
||||
}
|
||||
|
||||
switch (template)
|
||||
{
|
||||
case RAIDS_LOBBY:
|
||||
case RAIDS_START:
|
||||
room.setType(RaidRoom.Type.START);
|
||||
break;
|
||||
|
||||
case RAIDS_END:
|
||||
room.setType(RaidRoom.Type.END);
|
||||
break;
|
||||
|
||||
case RAIDS_SCAVENGERS:
|
||||
case RAIDS_SCAVENGERS2:
|
||||
room.setType(RaidRoom.Type.SCAVENGERS);
|
||||
break;
|
||||
|
||||
case RAIDS_SHAMANS:
|
||||
room.setType(RaidRoom.Type.COMBAT);
|
||||
room.setBoss(RaidRoom.Boss.SHAMANS);
|
||||
break;
|
||||
|
||||
case RAIDS_VASA:
|
||||
room.setType(RaidRoom.Type.COMBAT);
|
||||
room.setBoss(RaidRoom.Boss.VASA);
|
||||
break;
|
||||
|
||||
case RAIDS_VANGUARDS:
|
||||
room.setType(RaidRoom.Type.COMBAT);
|
||||
room.setBoss(RaidRoom.Boss.VANGUARDS);
|
||||
break;
|
||||
|
||||
case RAIDS_ICE_DEMON:
|
||||
room.setType(RaidRoom.Type.PUZZLE);
|
||||
room.setPuzzle(RaidRoom.Puzzle.ICE_DEMON);
|
||||
break;
|
||||
|
||||
case RAIDS_THIEVING:
|
||||
room.setType(RaidRoom.Type.PUZZLE);
|
||||
room.setPuzzle(RaidRoom.Puzzle.THIEVING);
|
||||
break;
|
||||
|
||||
case RAIDS_FARMING:
|
||||
case RAIDS_FARMING2:
|
||||
room.setType(RaidRoom.Type.FARMING);
|
||||
break;
|
||||
|
||||
case RAIDS_MUTTADILES:
|
||||
room.setType(RaidRoom.Type.COMBAT);
|
||||
room.setBoss(RaidRoom.Boss.MUTTADILES);
|
||||
break;
|
||||
|
||||
case RAIDS_MYSTICS:
|
||||
room.setType(RaidRoom.Type.COMBAT);
|
||||
room.setBoss(RaidRoom.Boss.MYSTICS);
|
||||
break;
|
||||
|
||||
case RAIDS_TEKTON:
|
||||
room.setType(RaidRoom.Type.COMBAT);
|
||||
room.setBoss(RaidRoom.Boss.TEKTON);
|
||||
break;
|
||||
|
||||
case RAIDS_TIGHTROPE:
|
||||
room.setType(RaidRoom.Type.PUZZLE);
|
||||
room.setPuzzle(RaidRoom.Puzzle.TIGHTROPE);
|
||||
break;
|
||||
|
||||
case RAIDS_GUARDIANS:
|
||||
room.setType(RaidRoom.Type.COMBAT);
|
||||
room.setBoss(RaidRoom.Boss.GUARDIANS);
|
||||
break;
|
||||
|
||||
case RAIDS_CRABS:
|
||||
room.setType(RaidRoom.Type.PUZZLE);
|
||||
room.setPuzzle(RaidRoom.Puzzle.CRABS);
|
||||
break;
|
||||
|
||||
case RAIDS_VESPULA:
|
||||
room.setType(RaidRoom.Type.COMBAT);
|
||||
room.setBoss(RaidRoom.Boss.VESPULA);
|
||||
break;
|
||||
}
|
||||
|
||||
return room;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Kamiel
|
||||
* 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.newraids;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Varbits;
|
||||
import static net.runelite.client.plugins.newraids.RaidsPlugin.POINTS_FORMAT;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.components.LineComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
|
||||
public class RaidsPointsOverlay extends Overlay
|
||||
{
|
||||
private final PanelComponent panel = new PanelComponent();
|
||||
@Inject
|
||||
private Client client;
|
||||
@Inject
|
||||
private RaidsPlugin plugin;
|
||||
|
||||
@Inject
|
||||
public RaidsPointsOverlay()
|
||||
{
|
||||
setPosition(OverlayPosition.TOP_RIGHT);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (!plugin.isInRaidChambers())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
int totalPoints = client.getVar(Varbits.TOTAL_POINTS);
|
||||
int personalPoints = client.getVar(Varbits.PERSONAL_POINTS);
|
||||
int partySize = client.getVar(Varbits.RAID_PARTY_SIZE);
|
||||
|
||||
panel.getChildren().clear();
|
||||
panel.getChildren().add(LineComponent.builder()
|
||||
.left("Total:")
|
||||
.right(POINTS_FORMAT.format(totalPoints))
|
||||
.build());
|
||||
|
||||
panel.getChildren().add(LineComponent.builder()
|
||||
.left(client.getLocalPlayer().getName() + ":")
|
||||
.right(POINTS_FORMAT.format(personalPoints))
|
||||
.build());
|
||||
|
||||
if (partySize > 1)
|
||||
{
|
||||
panel.getChildren().add(LineComponent.builder()
|
||||
.left("Party size:")
|
||||
.right(String.valueOf(partySize))
|
||||
.build());
|
||||
}
|
||||
|
||||
return panel.render(graphics);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,159 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Kamiel
|
||||
* 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.newraids;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import lombok.Setter;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBox;
|
||||
|
||||
public class RaidsTimer extends InfoBox
|
||||
{
|
||||
private final Instant startTime;
|
||||
public LocalTime time;
|
||||
private Instant floorTime;
|
||||
private LocalTime firstFloorTime;
|
||||
private LocalTime secondFloorTime;
|
||||
private LocalTime thirdFloorTime;
|
||||
private LocalTime olmTime;
|
||||
|
||||
@Setter
|
||||
private boolean stopped;
|
||||
|
||||
public RaidsTimer(BufferedImage image, Plugin plugin, Instant startTime)
|
||||
{
|
||||
super(image, plugin);
|
||||
this.startTime = startTime;
|
||||
floorTime = startTime;
|
||||
stopped = false;
|
||||
}
|
||||
|
||||
public void timeFloor()
|
||||
{
|
||||
Duration elapsed = Duration.between(floorTime, Instant.now());
|
||||
|
||||
if (firstFloorTime == null)
|
||||
{
|
||||
firstFloorTime = LocalTime.ofSecondOfDay(elapsed.getSeconds());
|
||||
}
|
||||
else if (secondFloorTime == null)
|
||||
{
|
||||
secondFloorTime = LocalTime.ofSecondOfDay(elapsed.getSeconds());
|
||||
}
|
||||
else if (thirdFloorTime == null)
|
||||
{
|
||||
|
||||
thirdFloorTime = LocalTime.ofSecondOfDay(elapsed.getSeconds());
|
||||
}
|
||||
|
||||
floorTime = Instant.now();
|
||||
}
|
||||
|
||||
|
||||
public int getSeconds()
|
||||
{
|
||||
return time.getSecond() + (time.getMinute() * 60) + (time.getHour() * 3600);
|
||||
}
|
||||
|
||||
|
||||
public void timeOlm()
|
||||
{
|
||||
Duration elapsed = Duration.between(floorTime, Instant.now());
|
||||
olmTime = LocalTime.ofSecondOfDay(elapsed.getSeconds());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTooltip()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append("Elapsed raid time: ");
|
||||
builder.append(time.format(DateTimeFormatter.ofPattern("HH:mm:ss")));
|
||||
|
||||
if (firstFloorTime != null)
|
||||
{
|
||||
builder.append("</br>First floor: ");
|
||||
builder.append(firstFloorTime.format(DateTimeFormatter.ofPattern("mm:ss")));
|
||||
}
|
||||
|
||||
if (secondFloorTime != null)
|
||||
{
|
||||
builder.append("</br>Second floor: ");
|
||||
builder.append(secondFloorTime.format(DateTimeFormatter.ofPattern("mm:ss")));
|
||||
}
|
||||
|
||||
if (thirdFloorTime != null)
|
||||
{
|
||||
|
||||
builder.append("</br>Third floor: ");
|
||||
builder.append(thirdFloorTime.format(DateTimeFormatter.ofPattern("mm:ss")));
|
||||
}
|
||||
|
||||
if (olmTime != null)
|
||||
{
|
||||
builder.append("</br>Olm: ");
|
||||
builder.append(olmTime.format(DateTimeFormatter.ofPattern("mm:ss")));
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,209 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||
* Copyright (c) 2018, Psikoi <https://github.com/psikoi>
|
||||
* 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.newraids;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.game.SkillIconManager;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.DynamicGridLayout;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.StackFormatter;
|
||||
|
||||
class SoloBox extends JPanel
|
||||
{
|
||||
static final DecimalFormat POINTS_FORMAT = new DecimalFormat("#,###");
|
||||
private static final DecimalFormat TWO_DECIMAL_FORMAT = new DecimalFormat("0.00");
|
||||
// Templates
|
||||
private static final String HTML_TOOL_TIP_TEMPLATE =
|
||||
"<html>%s %s done<br/>"
|
||||
+ "%s %s/hr<br/>"
|
||||
+ "%s till goal lvl</html>";
|
||||
private static final String HTML_LABEL_TEMPLATE =
|
||||
"<html><body style='color:%s'>%s<span style='color:white'>%s</span></body></html>";
|
||||
|
||||
// Instance members
|
||||
private final JPanel panel;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final data raid;
|
||||
|
||||
/* The tracker's wrapping container */
|
||||
private final JPanel container = new JPanel();
|
||||
|
||||
/* Contains the skill icon and the stats panel */
|
||||
private final JPanel headerPanel = new JPanel();
|
||||
|
||||
/* Contains all the skill information (exp gained, per hour, etc) */
|
||||
private final JPanel statsPanel = new JPanel();
|
||||
|
||||
|
||||
private final JLabel personalPoints = new JLabel();
|
||||
private final JLabel hourlyPoints = new JLabel();
|
||||
private final JLabel totalPoints = new JLabel();
|
||||
private final JLabel raidTime = new JLabel();
|
||||
private final JLabel layout = new JLabel();
|
||||
private final JLabel teamHour = new JLabel();
|
||||
private final JLabel killCount = new JLabel();
|
||||
private final JMenuItem pauseSkill = new JMenuItem("Pause");
|
||||
|
||||
private RaidsConfig raidsConfig;
|
||||
|
||||
private boolean paused = false;
|
||||
|
||||
SoloBox(RaidsPlugin raidsPlugin, RaidsConfig raidsConfig, Client client, JPanel panel, data raid, SkillIconManager iconManager) throws IOException
|
||||
{
|
||||
this.raidsConfig = raidsConfig;
|
||||
this.panel = panel;
|
||||
this.raid = raid;
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
setBorder(new EmptyBorder(5, 0, 0, 0));
|
||||
|
||||
container.setLayout(new BorderLayout());
|
||||
container.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
|
||||
|
||||
// Create reset others menu
|
||||
//pauseSkill.addActionListener(e -> raidsPlugin.pauseSkill(skill, !paused));
|
||||
|
||||
BufferedImage image = ImageUtil.getResourceStreamFromClass(this.getClass(), "cox.png");
|
||||
ImageIcon i = new ImageIcon(image);
|
||||
|
||||
JLabel skillIcon = new JLabel(i);
|
||||
skillIcon.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
skillIcon.setVerticalAlignment(SwingConstants.CENTER);
|
||||
skillIcon.setPreferredSize(new Dimension(35, 35));
|
||||
|
||||
headerPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
headerPanel.setLayout(new BorderLayout());
|
||||
|
||||
|
||||
statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
statsPanel.setBorder(new EmptyBorder(9, 2, 9, 2));
|
||||
statsPanel.setLayout(new DynamicGridLayout(2, 2));
|
||||
personalPoints.setFont(FontManager.getRunescapeSmallFont());
|
||||
personalPoints.setText("Personal: " + POINTS_FORMAT.format(raid.personal));
|
||||
hourlyPoints.setFont(FontManager.getRunescapeSmallFont());
|
||||
hourlyPoints.setText("Points/Hr: " + POINTS_FORMAT.format(raid.hr));
|
||||
totalPoints.setFont(FontManager.getRunescapeSmallFont());
|
||||
totalPoints.setText("Total: " + POINTS_FORMAT.format(raid.total));
|
||||
teamHour.setFont(FontManager.getRunescapeSmallFont());
|
||||
teamHour.setText("Points/Hr: " + POINTS_FORMAT.format((((float) raid.total / raid.timeTaken) * 3600)));
|
||||
killCount.setFont(FontManager.getRunescapeSmallFont());
|
||||
killCount.setText("KC: " + raid.kc);
|
||||
raidTime.setFont(FontManager.getRunescapeSmallFont());
|
||||
raidTime.setText("Time: " + formatSeconds(raid.timeTaken));
|
||||
//maybe add drop rate
|
||||
statsPanel.add(personalPoints);
|
||||
statsPanel.add(hourlyPoints);
|
||||
statsPanel.add(killCount);
|
||||
statsPanel.add(raidTime);
|
||||
|
||||
|
||||
headerPanel.add(skillIcon, BorderLayout.WEST);
|
||||
headerPanel.add(statsPanel, BorderLayout.CENTER);
|
||||
|
||||
JPanel progressWrapper = new JPanel();
|
||||
progressWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
progressWrapper.setLayout(new BorderLayout());
|
||||
progressWrapper.setBorder(new EmptyBorder(0, 7, 7, 7));
|
||||
layout.setFont(FontManager.getRunescapeSmallFont());
|
||||
if (raid.cm)
|
||||
{
|
||||
layout.setText("<html><p>Challenge Mode</p></html>");
|
||||
}
|
||||
else
|
||||
{
|
||||
layout.setText("<html><p>" + raid.raid + "</p></html>");
|
||||
}
|
||||
|
||||
|
||||
progressWrapper.add(layout, BorderLayout.NORTH);
|
||||
|
||||
container.add(headerPanel, BorderLayout.NORTH);
|
||||
container.add(progressWrapper, BorderLayout.SOUTH);
|
||||
|
||||
|
||||
add(container, BorderLayout.NORTH);
|
||||
}
|
||||
|
||||
|
||||
static String htmlLabel(String key, int value)
|
||||
{
|
||||
String valueStr = StackFormatter.quantityToRSDecimalStack(value);
|
||||
return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr);
|
||||
}
|
||||
|
||||
static String htmlLabel(String key, String value)
|
||||
{
|
||||
String valueStr = value;
|
||||
return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr);
|
||||
}
|
||||
|
||||
public static String formatSeconds(int timeInSeconds)
|
||||
{
|
||||
int hours = timeInSeconds / 3600;
|
||||
int secondsLeft = timeInSeconds - hours * 3600;
|
||||
int minutes = secondsLeft / 60;
|
||||
int seconds = secondsLeft - minutes * 60;
|
||||
|
||||
String formattedTime = "";
|
||||
if (hours < 10)
|
||||
{
|
||||
formattedTime += "0";
|
||||
}
|
||||
formattedTime += hours + ":";
|
||||
|
||||
if (minutes < 10)
|
||||
{
|
||||
formattedTime += "0";
|
||||
}
|
||||
formattedTime += minutes + ":";
|
||||
|
||||
if (seconds < 10)
|
||||
{
|
||||
formattedTime += "0";
|
||||
}
|
||||
formattedTime += seconds;
|
||||
|
||||
return formattedTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,210 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Adam <Adam@sigterm.info>
|
||||
* Copyright (c) 2018, Psikoi <https://github.com/psikoi>
|
||||
* 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.newraids;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import javax.swing.ImageIcon;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JMenuItem;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.client.game.SkillIconManager;
|
||||
import net.runelite.client.ui.ColorScheme;
|
||||
import net.runelite.client.ui.DynamicGridLayout;
|
||||
import net.runelite.client.ui.FontManager;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
|
||||
class XpInfoBox extends JPanel
|
||||
{
|
||||
static final DecimalFormat POINTS_FORMAT = new DecimalFormat("#,###");
|
||||
private static final DecimalFormat TWO_DECIMAL_FORMAT = new DecimalFormat("0.00");
|
||||
// Templates
|
||||
private static final String HTML_TOOL_TIP_TEMPLATE =
|
||||
"<html>%s %s done<br/>"
|
||||
+ "%s %s/hr<br/>"
|
||||
+ "%s till goal lvl</html>";
|
||||
private static final String HTML_LABEL_TEMPLATE =
|
||||
"<html><body style='color:%s'>%s<span style='color:white'>%s</span></body></html>";
|
||||
|
||||
// Instance members
|
||||
private final JPanel panel;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final data raid;
|
||||
|
||||
/* The tracker's wrapping container */
|
||||
private final JPanel container = new JPanel();
|
||||
|
||||
/* Contains the skill icon and the stats panel */
|
||||
private final JPanel headerPanel = new JPanel();
|
||||
|
||||
/* Contains all the skill information (exp gained, per hour, etc) */
|
||||
private final JPanel statsPanel = new JPanel();
|
||||
|
||||
|
||||
private final JLabel personalPoints = new JLabel();
|
||||
private final JLabel hourlyPoints = new JLabel();
|
||||
private final JLabel totalPoints = new JLabel();
|
||||
private final JLabel raidTime = new JLabel();
|
||||
private final JLabel layout = new JLabel();
|
||||
private final JLabel teamHour = new JLabel();
|
||||
private final JLabel killCount = new JLabel();
|
||||
private final JMenuItem pauseSkill = new JMenuItem("Pause");
|
||||
|
||||
private RaidsConfig raidsConfig;
|
||||
|
||||
private boolean paused = false;
|
||||
|
||||
XpInfoBox(RaidsPlugin raidsPlugin, RaidsConfig raidsConfig, Client client, JPanel panel, data raid, SkillIconManager iconManager) throws IOException
|
||||
{
|
||||
this.raidsConfig = raidsConfig;
|
||||
this.panel = panel;
|
||||
this.raid = raid;
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
setBorder(new EmptyBorder(5, 0, 0, 0));
|
||||
|
||||
container.setLayout(new BorderLayout());
|
||||
container.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
|
||||
|
||||
// Create reset others menu
|
||||
//pauseSkill.addActionListener(e -> raidsPlugin.pauseSkill(skill, !paused));
|
||||
|
||||
BufferedImage image = ImageUtil.getResourceStreamFromClass(this.getClass(), "cox.png");
|
||||
ImageIcon i = new ImageIcon(image);
|
||||
|
||||
JLabel skillIcon = new JLabel(i);
|
||||
skillIcon.setHorizontalAlignment(SwingConstants.CENTER);
|
||||
skillIcon.setVerticalAlignment(SwingConstants.CENTER);
|
||||
skillIcon.setPreferredSize(new Dimension(35, 35));
|
||||
|
||||
headerPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
headerPanel.setLayout(new BorderLayout());
|
||||
|
||||
|
||||
statsPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
statsPanel.setBorder(new EmptyBorder(9, 2, 9, 2));
|
||||
statsPanel.setLayout(new DynamicGridLayout(3, 2));
|
||||
personalPoints.setFont(FontManager.getRunescapeSmallFont());
|
||||
personalPoints.setText("Personal: " + POINTS_FORMAT.format(raid.personal));
|
||||
hourlyPoints.setFont(FontManager.getRunescapeSmallFont());
|
||||
hourlyPoints.setText("Points/Hr: " + POINTS_FORMAT.format(raid.hr));
|
||||
totalPoints.setFont(FontManager.getRunescapeSmallFont());
|
||||
totalPoints.setText("Total: " + POINTS_FORMAT.format(raid.total));
|
||||
teamHour.setFont(FontManager.getRunescapeSmallFont());
|
||||
teamHour.setText("Points/Hr: " + POINTS_FORMAT.format((((float) raid.total / raid.timeTaken) * 3600)));
|
||||
killCount.setFont(FontManager.getRunescapeSmallFont());
|
||||
killCount.setText("KC: " + raid.kc);
|
||||
raidTime.setFont(FontManager.getRunescapeSmallFont());
|
||||
raidTime.setText("Time: " + formatSeconds(raid.timeTaken));
|
||||
//maybe add drop rate
|
||||
statsPanel.add(personalPoints);
|
||||
statsPanel.add(totalPoints);
|
||||
statsPanel.add(hourlyPoints);
|
||||
statsPanel.add(teamHour);
|
||||
statsPanel.add(killCount);
|
||||
statsPanel.add(raidTime);
|
||||
|
||||
|
||||
headerPanel.add(skillIcon, BorderLayout.WEST);
|
||||
headerPanel.add(statsPanel, BorderLayout.CENTER);
|
||||
|
||||
JPanel progressWrapper = new JPanel();
|
||||
progressWrapper.setBackground(ColorScheme.DARKER_GRAY_COLOR);
|
||||
progressWrapper.setLayout(new BorderLayout());
|
||||
progressWrapper.setBorder(new EmptyBorder(0, 7, 7, 7));
|
||||
layout.setFont(FontManager.getRunescapeSmallFont());
|
||||
if (raid.cm)
|
||||
{
|
||||
layout.setText("<html><p>Challenge Mode</p></html>");
|
||||
}
|
||||
else
|
||||
{
|
||||
layout.setText("<html><p>" + raid.raid + "</p></html>");
|
||||
}
|
||||
|
||||
|
||||
progressWrapper.add(layout, BorderLayout.NORTH);
|
||||
|
||||
container.add(headerPanel, BorderLayout.NORTH);
|
||||
container.add(progressWrapper, BorderLayout.SOUTH);
|
||||
|
||||
|
||||
add(container, BorderLayout.NORTH);
|
||||
}
|
||||
|
||||
|
||||
static String htmlLabel(String key, int value)
|
||||
{
|
||||
String valueStr = POINTS_FORMAT.format(value);
|
||||
return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr);
|
||||
}
|
||||
|
||||
static String htmlLabel(String key, String value)
|
||||
{
|
||||
String valueStr = value;
|
||||
return String.format(HTML_LABEL_TEMPLATE, ColorUtil.toHexColor(ColorScheme.LIGHT_GRAY_COLOR), key, valueStr);
|
||||
}
|
||||
|
||||
public static String formatSeconds(int timeInSeconds)
|
||||
{
|
||||
int hours = timeInSeconds / 3600;
|
||||
int secondsLeft = timeInSeconds - hours * 3600;
|
||||
int minutes = secondsLeft / 60;
|
||||
int seconds = secondsLeft - minutes * 60;
|
||||
|
||||
String formattedTime = "";
|
||||
if (hours < 10)
|
||||
{
|
||||
formattedTime += "0";
|
||||
}
|
||||
formattedTime += hours + ":";
|
||||
|
||||
if (minutes < 10)
|
||||
{
|
||||
formattedTime += "0";
|
||||
}
|
||||
formattedTime += minutes + ":";
|
||||
|
||||
if (seconds < 10)
|
||||
{
|
||||
formattedTime += "0";
|
||||
}
|
||||
formattedTime += seconds;
|
||||
|
||||
return formattedTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package net.runelite.client.plugins.newraids;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
public class data
|
||||
{
|
||||
int total;
|
||||
int personal;
|
||||
int hr;
|
||||
int timeTaken;
|
||||
int kc;
|
||||
boolean cm;
|
||||
String raid;
|
||||
Date start;
|
||||
Date finish;
|
||||
|
||||
void add(int total, int personal, int hr, int timeTaken, int kc, boolean cm, String raid, Date start, Date finish)
|
||||
{
|
||||
this.total = total;
|
||||
this.personal = personal;
|
||||
this.hr = hr;
|
||||
this.kc = kc;
|
||||
this.cm = cm;
|
||||
this.timeTaken = timeTaken;
|
||||
this.raid = raid;
|
||||
this.start = start;
|
||||
this.finish = finish;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Kamiel
|
||||
* 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.newraids.solver;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
|
||||
public class Layout
|
||||
{
|
||||
@Getter
|
||||
private final List<Room> rooms = new ArrayList<>();
|
||||
|
||||
public void add(Room room)
|
||||
{
|
||||
rooms.add(room);
|
||||
}
|
||||
|
||||
public Room getRoomAt(int position)
|
||||
{
|
||||
for (Room room : rooms)
|
||||
{
|
||||
if (room.getPosition() == position)
|
||||
{
|
||||
return room;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public String toCode()
|
||||
{
|
||||
StringBuilder builder = new StringBuilder();
|
||||
|
||||
for (Room room : rooms)
|
||||
{
|
||||
builder.append(room.getSymbol());
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public String toCodeString()
|
||||
{
|
||||
return toCode().replaceAll("#", "").replaceAll("¤", "");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,226 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Kamiel
|
||||
* 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.newraids.solver;
|
||||
|
||||
import com.google.inject.Singleton;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/*
|
||||
* Implementation of https://github.com/WooxSolo/raids-layout
|
||||
* Copyright (c) 2017 WooxSolo
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in all
|
||||
* copies or substantial portions of the Software.
|
||||
*/
|
||||
@Slf4j
|
||||
@Singleton
|
||||
public class LayoutSolver
|
||||
{
|
||||
@Getter
|
||||
private static final List<Layout> layouts = new ArrayList<>();
|
||||
private static final Pattern regex = Pattern.compile("^([A-Z]*)\\.([A-Z]*) - #([A-Z]*)#([A-Z]*)$");
|
||||
private static final String[] codes =
|
||||
{
|
||||
"FSCCP.PCSCF - #WNWSWN#ESEENW",
|
||||
"FSCCS.PCPSF - #WSEEEN#WSWNWS",
|
||||
"FSCPC.CSCPF - #WNWWSE#EENWWW",
|
||||
"SCCFC.PSCSF - #EEENWW#WSEEEN",
|
||||
"SCCFP.CCSPF - #NESEEN#WSWNWS",
|
||||
"SCFCP.CCSPF - #ESEENW#ESWWNW",
|
||||
"SCFCP.CSCFS - #ENEESW#ENWWSW",
|
||||
"SCFCPC.CSPCSF - #ESWWNWS#NESENES",
|
||||
"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",
|
||||
"SCFCP.CSCPF - #ENESEN#WWWSEE",
|
||||
"SCPFC.PCSCF - #WNEEES#NWSWNW",
|
||||
"SFCCPC.PCSCPF - #WSEENES#WWWNEEE",
|
||||
"FSPCC.PSCCF - #WWWSEE#ENWWSW",
|
||||
"FSCCP.PCSCF - #ENWWWS#NEESEN",
|
||||
"SCPFC.CCSSF - #NEESEN#WSWWNE"
|
||||
};
|
||||
|
||||
public LayoutSolver()
|
||||
{
|
||||
build();
|
||||
}
|
||||
|
||||
public Layout findLayout(String code)
|
||||
{
|
||||
Layout solution = null;
|
||||
int matches = 0;
|
||||
boolean match;
|
||||
|
||||
for (Layout layout : layouts)
|
||||
{
|
||||
match = true;
|
||||
|
||||
for (int i = 0; i < code.length(); i++)
|
||||
{
|
||||
Room room = layout.getRoomAt(i);
|
||||
char c = code.charAt(i);
|
||||
|
||||
if (room != null && c != ' ' && c != room.getSymbol())
|
||||
{
|
||||
match = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (match)
|
||||
{
|
||||
solution = layout;
|
||||
matches++;
|
||||
log.debug("Found matching layout: " + layout.toCode());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (matches == 1)
|
||||
{
|
||||
return solution;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private int calcStart(String directions)
|
||||
{
|
||||
int startPos = 0;
|
||||
int position = 0;
|
||||
|
||||
for (int i = 0; i < directions.length(); i++)
|
||||
{
|
||||
char c = directions.charAt(i);
|
||||
int delta = dirToPosDelta(c);
|
||||
position += delta;
|
||||
|
||||
if (position < 0 || position >= 8 || (position == 3 && delta == -1) || (position == 4 && delta == 1))
|
||||
{
|
||||
position -= delta;
|
||||
startPos -= delta;
|
||||
}
|
||||
}
|
||||
|
||||
return startPos;
|
||||
}
|
||||
|
||||
private int dirToPosDelta(char direction)
|
||||
{
|
||||
switch (String.valueOf(direction))
|
||||
{
|
||||
case "N":
|
||||
return -4;
|
||||
|
||||
case "E":
|
||||
return 1;
|
||||
|
||||
case "S":
|
||||
return 4;
|
||||
|
||||
case "W":
|
||||
return -1;
|
||||
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void build()
|
||||
{
|
||||
for (String code : codes)
|
||||
{
|
||||
Matcher match = regex.matcher(code);
|
||||
|
||||
if (!match.find())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String symbols, directions;
|
||||
int position = calcStart(match.group(3));
|
||||
Layout layout = new Layout();
|
||||
Room lastRoom = null;
|
||||
Room room;
|
||||
|
||||
for (int floor = 0; floor < 2; floor++)
|
||||
{
|
||||
symbols = match.group(1 + floor);
|
||||
directions = match.group(3 + floor);
|
||||
|
||||
for (int i = 0; i < directions.length(); i++)
|
||||
{
|
||||
char symbol = (i == 0 ? '#' : symbols.charAt(i - 1));
|
||||
|
||||
room = new Room(position, symbol);
|
||||
|
||||
if (lastRoom != null)
|
||||
{
|
||||
lastRoom.setNext(room);
|
||||
room.setPrevious(lastRoom);
|
||||
}
|
||||
|
||||
layout.add(room);
|
||||
lastRoom = room;
|
||||
|
||||
int delta = dirToPosDelta(directions.charAt(i));
|
||||
position += delta;
|
||||
}
|
||||
|
||||
room = new Room(position, '¤');
|
||||
room.setPrevious(lastRoom);
|
||||
lastRoom.setNext(room);
|
||||
layout.add(room);
|
||||
position += 8;
|
||||
}
|
||||
|
||||
layouts.add(layout);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Kamiel
|
||||
* 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.newraids.solver;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
public class Room
|
||||
{
|
||||
@Getter
|
||||
private final int position;
|
||||
|
||||
@Getter
|
||||
private final char symbol;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private Room next;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
private Room previous;
|
||||
|
||||
Room(int position, char symbol)
|
||||
{
|
||||
this.position = position;
|
||||
this.symbol = symbol;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* Copyright (c) 2018, Kamiel
|
||||
* 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.newraids.solver;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import net.runelite.client.plugins.newraids.RaidRoom;
|
||||
import net.runelite.client.plugins.newraids.RaidRoom.Boss;
|
||||
|
||||
public class RotationSolver
|
||||
{
|
||||
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)),
|
||||
new Rotation<>(Arrays.asList(Boss.TEKTON, Boss.MUTTADILES, Boss.GUARDIANS, Boss.VESPULA, Boss.SHAMANS, Boss.VASA, Boss.VANGUARDS, Boss.MYSTICS)),
|
||||
new Rotation<>(Arrays.asList(Boss.VESPULA, Boss.VANGUARDS, Boss.MUTTADILES, Boss.SHAMANS, Boss.MYSTICS, Boss.GUARDIANS, Boss.VASA, Boss.TEKTON)),
|
||||
new Rotation<>(Arrays.asList(Boss.MYSTICS, Boss.VANGUARDS, Boss.VASA, Boss.SHAMANS, Boss.VESPULA, Boss.GUARDIANS, Boss.MUTTADILES, Boss.TEKTON))
|
||||
};
|
||||
|
||||
public static boolean solve(RaidRoom[] rooms)
|
||||
{
|
||||
if (rooms == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
Rotation<Boss> match = null;
|
||||
Integer start = null;
|
||||
Integer index = null;
|
||||
int known = 0;
|
||||
|
||||
for (int i = 0; i < rooms.length; i++)
|
||||
{
|
||||
if (rooms[i] == null || rooms[i].getBoss() == null || rooms[i].getBoss() == Boss.UNKNOWN)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (start == null)
|
||||
{
|
||||
start = i;
|
||||
}
|
||||
|
||||
known++;
|
||||
}
|
||||
|
||||
if (known < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (known == rooms.length)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
for (Rotation rotation : ROTATIONS)
|
||||
{
|
||||
COMPARE:
|
||||
for (int i = 0; i < rotation.size(); i++)
|
||||
{
|
||||
if (rooms[start].getBoss() == rotation.get(i))
|
||||
{
|
||||
for (int j = start + 1; j < rooms.length; j++)
|
||||
{
|
||||
if (rooms[j].getBoss() == null || rooms[j].getBoss() == Boss.UNKNOWN)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rooms[j].getBoss() != rotation.get(i + j - start))
|
||||
{
|
||||
break COMPARE;
|
||||
}
|
||||
}
|
||||
|
||||
if (match != null && match != rotation)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
index = i - start;
|
||||
match = rotation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (match == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
for (int i = 0; i < rooms.length; i++)
|
||||
{
|
||||
if (rooms[i] == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (rooms[i].getBoss() == null || rooms[i].getBoss() == Boss.UNKNOWN)
|
||||
{
|
||||
rooms[i].setBoss(match.get(index + i));
|
||||
}
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package net.runelite.client.plugins.newraids;
|
||||
|
||||
public class timerSpecial
|
||||
{
|
||||
public boolean started = false;
|
||||
private long startTime = 0;
|
||||
private long difference = 0;
|
||||
private long pause = 0;
|
||||
private long unpaused = 0;
|
||||
private long tempTime = 0;
|
||||
private boolean paused = false;
|
||||
|
||||
public void start()
|
||||
{
|
||||
startTime = System.currentTimeMillis();
|
||||
tempTime = startTime;
|
||||
}
|
||||
|
||||
public void start(long offset)
|
||||
{
|
||||
startTime = System.currentTimeMillis() - offset * 1000;
|
||||
tempTime = startTime;
|
||||
started = true;
|
||||
}
|
||||
|
||||
public void pause()
|
||||
{
|
||||
pause = System.currentTimeMillis();
|
||||
tempTime = (System.currentTimeMillis() - startTime) / 1000;
|
||||
paused = true;
|
||||
}
|
||||
|
||||
public void unpause()
|
||||
{
|
||||
paused = false;
|
||||
unpaused = System.currentTimeMillis();
|
||||
difference = unpaused - pause;
|
||||
startTime = startTime + difference;
|
||||
}
|
||||
|
||||
public void reset()
|
||||
{
|
||||
startTime = 0;
|
||||
difference = 0;
|
||||
pause = 0;
|
||||
unpaused = 0;
|
||||
tempTime = 0;
|
||||
paused = false;
|
||||
startTime = System.currentTimeMillis();
|
||||
tempTime = startTime;
|
||||
started = false;
|
||||
}
|
||||
|
||||
public long getElapsedTime()
|
||||
{
|
||||
if (paused)
|
||||
{
|
||||
return (tempTime);
|
||||
}
|
||||
return (System.currentTimeMillis() - startTime) / 1000;
|
||||
// return (System.currentTimeMillis() - startTime + difference) / 1000; //returns in seconds
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
* THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI
|
||||
* No rights reserved. Use, redistribute, and modify at your own discretion,
|
||||
* and in accordance with Yagex and RuneLite guidelines.
|
||||
* However, aforementioned monkey would prefer if you don't sell this plugin for profit.
|
||||
* Good luck on your raids!
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.zcox;
|
||||
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("Cox")
|
||||
|
||||
public interface CoxConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "Muttadile",
|
||||
name = "Muttadile Marker",
|
||||
description = ""
|
||||
)
|
||||
default boolean Muttadile()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
keyName = "Tekton",
|
||||
name = "Tekton Marker",
|
||||
description = ""
|
||||
)
|
||||
default boolean Tekton()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
keyName = "Guardians",
|
||||
name = "Guardians timing",
|
||||
description = ""
|
||||
)
|
||||
default boolean Guardians()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
keyName = "OlmSpec",
|
||||
name = "Olm Next Spec",
|
||||
description = ""
|
||||
)
|
||||
default boolean OlmSpec()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
keyName = "OlmTick",
|
||||
name = "Olm Tick Counter",
|
||||
description = ""
|
||||
)
|
||||
default boolean OlmTick()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
keyName = "OlmCrystals",
|
||||
name = "Olm AoE Indicator",
|
||||
description = ""
|
||||
)
|
||||
default boolean OlmCrystals()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 6,
|
||||
keyName = "LargeCrystals",
|
||||
name = "Mark Large AoE Crystals rather then small ones",
|
||||
description = ""
|
||||
)
|
||||
default boolean LargeCrystals()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,339 @@
|
||||
/*
|
||||
* THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI
|
||||
* No rights reserved. Use, redistribute, and modify at your own discretion,
|
||||
* and in accordance with Yagex and RuneLite guidelines.
|
||||
* However, aforementioned monkey would prefer if you don't sell this plugin for profit.
|
||||
* Good luck on your raids!
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.zcox;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldArea;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
public class CoxOverlay extends Overlay
|
||||
{
|
||||
private final Client client;
|
||||
|
||||
|
||||
private final CoxPlugin plugin;
|
||||
private final CoxConfig config;
|
||||
|
||||
@Inject
|
||||
private CoxOverlay(Client client, CoxPlugin plugin, CoxConfig config)
|
||||
{
|
||||
this.client = client;
|
||||
this.plugin = plugin;
|
||||
this.config = config;
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
setPriority(OverlayPriority.HIGH);
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (plugin.isRunMutta())
|
||||
{
|
||||
if (config.Muttadile())
|
||||
{
|
||||
NPC boss = plugin.getMomma_NPC();
|
||||
|
||||
NPC baby = plugin.getMutta_NPC();
|
||||
if (boss != null)
|
||||
{
|
||||
int size = 1;
|
||||
NPCComposition composition = boss.getTransformedComposition();
|
||||
{
|
||||
size = composition.getSize();
|
||||
}
|
||||
|
||||
List<WorldPoint> meleeRangeMom = getHitSquares(boss.getWorldLocation(), size, 1, false);
|
||||
|
||||
for (WorldPoint p : meleeRangeMom)
|
||||
{
|
||||
drawTile(graphics, p, Color.RED, 2, 155, 10);
|
||||
}
|
||||
}
|
||||
if (baby != null)
|
||||
{
|
||||
int size = 1;
|
||||
NPCComposition compositionbaby = baby.getTransformedComposition();
|
||||
{
|
||||
size = compositionbaby.getSize();
|
||||
}
|
||||
|
||||
List<WorldPoint> meleeRange = getHitSquares(baby.getWorldLocation(), size, 1, false);
|
||||
|
||||
for (WorldPoint p : meleeRange)
|
||||
{
|
||||
drawTile(graphics, p, Color.RED, 1, 155, 10);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isRunGuard())
|
||||
{
|
||||
if (config.Guardians())
|
||||
{
|
||||
NPC G1 = plugin.getGuard1_NPC();
|
||||
NPC G2 = plugin.getGuard2_NPC();
|
||||
int tick = plugin.getGuardTick();
|
||||
if (tick == 5)
|
||||
{
|
||||
if (G1 != null)
|
||||
{
|
||||
int size = 1;
|
||||
NPCComposition composition = G1.getTransformedComposition();
|
||||
{
|
||||
size = composition.getSize();
|
||||
}
|
||||
|
||||
List<WorldPoint> meleeRange = getHitSquares(G1.getWorldLocation(), size, 1, true);
|
||||
|
||||
for (WorldPoint p : meleeRange)
|
||||
{
|
||||
drawTile(graphics, p, Color.GREEN, 1, 155, 10);
|
||||
}
|
||||
}
|
||||
if (G2 != null)
|
||||
{
|
||||
int size = 1;
|
||||
NPCComposition composition = G2.getTransformedComposition();
|
||||
{
|
||||
size = composition.getSize();
|
||||
}
|
||||
|
||||
List<WorldPoint> meleeRange = getHitSquares(G2.getWorldLocation(), size, 1, true);
|
||||
|
||||
for (WorldPoint p : meleeRange)
|
||||
{
|
||||
drawTile(graphics, p, Color.GREEN, 1, 155, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (plugin.isRunTekton())
|
||||
{
|
||||
if (config.Tekton())
|
||||
{
|
||||
|
||||
NPC boss = plugin.getTekton_NPC();
|
||||
|
||||
if (boss != null)
|
||||
{
|
||||
int size = 1;
|
||||
NPCComposition composition = boss.getTransformedComposition();
|
||||
{
|
||||
size = composition.getSize();
|
||||
}
|
||||
|
||||
List<WorldPoint> meleeRange = getHitSquares(boss.getWorldLocation(), size, 1, false);
|
||||
|
||||
for (WorldPoint p : meleeRange)
|
||||
{
|
||||
drawTile(graphics, p, Color.WHITE, 1, 155, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isRunOlm())
|
||||
{
|
||||
NPC boss = plugin.getOlm_NPC();
|
||||
if (config.OlmCrystals())
|
||||
{
|
||||
for (WorldPoint p : plugin.getOlm_Crystals())
|
||||
{
|
||||
drawTile(graphics, p, Color.RED, 1, 255, 0);
|
||||
}
|
||||
for (WorldPoint p : plugin.getOlm_Heal())
|
||||
{
|
||||
drawTile(graphics, p, Color.BLUE, 3, 255, 0);
|
||||
}
|
||||
for (WorldPoint p : plugin.getOlm_PSN())
|
||||
{
|
||||
drawTile(graphics, p, Color.GREEN, 3, 255, 0);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
if (config.OlmSpec())
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
if (config.OlmTick())
|
||||
{
|
||||
if (boss != null)
|
||||
{
|
||||
int tick = plugin.getOlm_TicksUntilAction();
|
||||
int cycle = plugin.getOlm_ActionCycle();
|
||||
int spec = plugin.getOlm_NextSpec();
|
||||
final String tickStr = String.valueOf(tick);
|
||||
String cycleStr = "?";
|
||||
switch (cycle)
|
||||
{
|
||||
case 1:
|
||||
switch (spec)
|
||||
{
|
||||
case 1:
|
||||
cycleStr = "Portals";
|
||||
break;
|
||||
case 2:
|
||||
cycleStr = "lightning";
|
||||
break;
|
||||
case 3:
|
||||
cycleStr = "Crystals";
|
||||
break;
|
||||
case 4:
|
||||
cycleStr = "Heal";
|
||||
break;
|
||||
case -1:
|
||||
cycleStr = "??";
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
cycleStr = "Sauto";
|
||||
break;
|
||||
case 3:
|
||||
cycleStr = "Null";
|
||||
break;
|
||||
case 4:
|
||||
cycleStr = "Nauto";
|
||||
break;
|
||||
case -1:
|
||||
cycleStr = "??";
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
final String combinedStr = cycleStr + ":" + tickStr;
|
||||
Point canvasPoint = boss.getCanvasTextLocation(graphics, combinedStr, 130);
|
||||
renderTextLocation(graphics, combinedStr, 12, Font.BOLD, Color.WHITE, canvasPoint);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private void drawTile(Graphics2D graphics, WorldPoint point, Color color, int strokeWidth, int outlineAlpha, int fillAlpha)
|
||||
{
|
||||
WorldPoint playerLocation = client.getLocalPlayer().getWorldLocation();
|
||||
if (point.distanceTo(playerLocation) >= 32)
|
||||
{
|
||||
return;
|
||||
}
|
||||
LocalPoint lp = LocalPoint.fromWorld(client, point);
|
||||
if (lp == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Polygon poly = Perspective.getCanvasTilePoly(client, lp);
|
||||
if (poly == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//OverlayUtil.renderPolygon(graphics, poly, color);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha));
|
||||
graphics.setStroke(new BasicStroke(strokeWidth));
|
||||
graphics.draw(poly);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
|
||||
graphics.fill(poly);
|
||||
}
|
||||
|
||||
private void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color, int outlineWidth, int outlineAlpha, int fillAlpha)
|
||||
{
|
||||
int size = 1;
|
||||
NPCComposition composition = actor.getTransformedComposition();
|
||||
if (composition != null)
|
||||
{
|
||||
size = composition.getSize();
|
||||
}
|
||||
LocalPoint lp = actor.getLocalLocation();
|
||||
Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size);
|
||||
|
||||
if (tilePoly != null)
|
||||
{
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha));
|
||||
graphics.setStroke(new BasicStroke(outlineWidth));
|
||||
graphics.draw(tilePoly);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha));
|
||||
graphics.fill(tilePoly);
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint)
|
||||
{
|
||||
graphics.setFont(new Font("Arial", fontStyle, fontSize));
|
||||
if (canvasPoint != null)
|
||||
{
|
||||
final Point canvasCenterPoint = new Point(
|
||||
canvasPoint.getX(),
|
||||
canvasPoint.getY());
|
||||
final Point canvasCenterPoint_shadow = new Point(
|
||||
canvasPoint.getX() + 1,
|
||||
canvasPoint.getY() + 1);
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK);
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor);
|
||||
}
|
||||
}
|
||||
|
||||
private List<WorldPoint> getHitSquares(WorldPoint npcLoc, int npcSize, int thickness, boolean includeUnder)
|
||||
{
|
||||
List<WorldPoint> little = new WorldArea(npcLoc, npcSize, npcSize).toWorldPointList();
|
||||
List<WorldPoint> big = new WorldArea(npcLoc.getX() - thickness, npcLoc.getY() - thickness, npcSize + (thickness * 2), npcSize + (thickness * 2), npcLoc.getPlane()).toWorldPointList();
|
||||
if (!includeUnder)
|
||||
{
|
||||
for (Iterator<WorldPoint> it = big.iterator(); it.hasNext(); )
|
||||
{
|
||||
WorldPoint p = it.next();
|
||||
if (little.contains(p))
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
return big;
|
||||
}
|
||||
|
||||
private void renderPoly(Graphics2D graphics, Color color, Polygon polygon)
|
||||
{
|
||||
if (polygon != null)
|
||||
{
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.draw(polygon);
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20));
|
||||
graphics.fill(polygon);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,518 @@
|
||||
/*
|
||||
* THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI
|
||||
* No rights reserved. Use, redistribute, and modify at your own discretion,
|
||||
* and in accordance with Yagex and RuneLite guidelines.
|
||||
* However, aforementioned monkey would prefer if you don't sell this plugin for profit.
|
||||
* Good luck on your raids!
|
||||
*/
|
||||
|
||||
package net.runelite.client.plugins.zcox;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GraphicsObject;
|
||||
import net.runelite.api.MessageNode;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NpcID;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "CoX Helper ",
|
||||
description = "All-in-one plugin for Chambers of Xeric",
|
||||
tags = {"CoX", "chamber", "xeric", "helper"},
|
||||
enabledByDefault = false,
|
||||
type = PluginType.PVM
|
||||
)
|
||||
|
||||
public class CoxPlugin extends Plugin
|
||||
{
|
||||
private static final int GAMEOBJECT_ID_PSN = 30032;
|
||||
private static final int GRAPHICSOBJECT_ID_CRYSTAL = 1447;
|
||||
private static final int GRAPHICSOBJECT_ID_HEAL = 1363;
|
||||
private static final int ANIMATION_ID_G1 = 430;
|
||||
int sleepcount = 0;
|
||||
private boolean needOlm = false;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int guardTick = -1;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runGuard = false;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Guard1_NPC;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Guard2_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runMutta;
|
||||
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Mutta_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Momma_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int OlmPhase = 0;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runTekton;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Tekton_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runVanguards;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC meleeVanguard_NPC;
|
||||
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC mageVanguard_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC rangeVanguard_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private boolean runOlm;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Olm_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC OlmMelee_NPC;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int Olm_TicksUntilAction = -1;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int Olm_ActionCycle = -1; //4:0 = auto 3:0 = null 2:0 = auto 1:0 = spec + actioncycle =4
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private int Olm_NextSpec = -1; // 1= crystals 2=lightnig 3=portals 4= heal hand if p4
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> Olm_Crystals = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> Olm_Heal = new ArrayList<>();
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<WorldPoint> Olm_PSN = new ArrayList<>();
|
||||
|
||||
@Inject
|
||||
private ChatMessageManager chatMessageManager;
|
||||
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Inject
|
||||
private OverlayManager overlayManager;
|
||||
|
||||
@Inject
|
||||
private CoxOverlay overlay;
|
||||
|
||||
@Inject
|
||||
private CoxConfig config;
|
||||
|
||||
@Provides
|
||||
CoxConfig getConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(CoxConfig.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void startUp()
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown()
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onChatMessage(ChatMessage chatMessage)
|
||||
{
|
||||
MessageNode messageNode = chatMessage.getMessageNode();
|
||||
|
||||
if (messageNode.getValue().toLowerCase().contains("The Great Olm rises with the power of".toLowerCase()) || messageNode.getValue().toLowerCase().contains("!olm".toLowerCase()))
|
||||
{
|
||||
System.out.println("finding Olm NPC");
|
||||
if (!runOlm)
|
||||
{
|
||||
Olm_ActionCycle = -1;
|
||||
Olm_TicksUntilAction = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_ActionCycle = -1;
|
||||
Olm_TicksUntilAction = 3;
|
||||
}
|
||||
OlmPhase = 0;
|
||||
runOlm = true;
|
||||
needOlm = true;
|
||||
Olm_NextSpec = -1;
|
||||
}
|
||||
|
||||
if (messageNode.getValue().toLowerCase().contains("The Great Olm is giving its all. this is its final stand".toLowerCase()))
|
||||
{
|
||||
System.out.println("finding Olm NPC");
|
||||
if (!runOlm)
|
||||
{
|
||||
Olm_ActionCycle = -1;
|
||||
Olm_TicksUntilAction = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_ActionCycle = -1;
|
||||
Olm_TicksUntilAction = 3;
|
||||
}
|
||||
OlmPhase = 1;
|
||||
System.out.println("OLM PHASE:" + OlmPhase);
|
||||
runOlm = true;
|
||||
needOlm = true;
|
||||
Olm_NextSpec = -1;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onNpcSpawned(NpcSpawned npcSpawned)
|
||||
{
|
||||
NPC npc = npcSpawned.getNpc();
|
||||
switch (npc.getId())
|
||||
{
|
||||
case NpcID.TEKTON:
|
||||
case NpcID.TEKTON_7541:
|
||||
case NpcID.TEKTON_7542:
|
||||
case NpcID.TEKTON_7545:
|
||||
case NpcID.TEKTON_ENRAGED:
|
||||
case NpcID.TEKTON_ENRAGED_7544:
|
||||
runTekton = true;
|
||||
Tekton_NPC = npc;
|
||||
break;
|
||||
|
||||
case NpcID.MUTTADILE://momadile resting
|
||||
Momma_NPC = npc;
|
||||
break;
|
||||
case NpcID.MUTTADILE_7562:
|
||||
runMutta = true;
|
||||
Mutta_NPC = npc;
|
||||
break;
|
||||
case NpcID.MUTTADILE_7563:
|
||||
runMutta = true;
|
||||
Momma_NPC = npc;
|
||||
break;
|
||||
|
||||
// case NpcID.GREAT_OLM_7554:
|
||||
// System.out.println("Found Olm NPC");
|
||||
// if (!runOlm)
|
||||
// {
|
||||
// Olm_ActionCycle = 4;
|
||||
/// Olm_TicksUntilAction = 4;
|
||||
// } else {
|
||||
// Olm_ActionCycle = 4;
|
||||
// Olm_TicksUntilAction = 3;
|
||||
//// }
|
||||
// OlmPhase++;
|
||||
// System.out.println("OLM PHASE:"+OlmPhase);
|
||||
// runOlm = true;
|
||||
// Olm_NPC = npc;
|
||||
// Olm_NextSpec = 1;
|
||||
// break;
|
||||
//
|
||||
// case NpcID.GREAT_OLM_LEFT_CLAW:
|
||||
// case NpcID.GREAT_OLM_LEFT_CLAW_7555:
|
||||
// OlmMelee_NPC = npc;
|
||||
// break;
|
||||
case NpcID.GUARDIAN:
|
||||
Guard1_NPC = npc;
|
||||
guardTick = -1;
|
||||
runGuard = true;
|
||||
break;
|
||||
case NpcID.GUARDIAN_7570:
|
||||
Guard2_NPC = npc;
|
||||
guardTick = -1;
|
||||
runGuard = true;
|
||||
break;
|
||||
|
||||
//add vanguards
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onNpcDespawned(NpcDespawned npcDespawned)
|
||||
{
|
||||
NPC npc = npcDespawned.getNpc();
|
||||
switch (npc.getId())
|
||||
{
|
||||
case NpcID.TEKTON:
|
||||
case NpcID.TEKTON_7541:
|
||||
case NpcID.TEKTON_7542:
|
||||
case NpcID.TEKTON_7545:
|
||||
case NpcID.TEKTON_ENRAGED:
|
||||
case NpcID.TEKTON_ENRAGED_7544:
|
||||
runTekton = false;
|
||||
Tekton_NPC = null;
|
||||
break;
|
||||
|
||||
case NpcID.MUTTADILE:
|
||||
Momma_NPC = null;
|
||||
break;
|
||||
case NpcID.MUTTADILE_7562:
|
||||
Mutta_NPC = null;
|
||||
break;
|
||||
|
||||
case NpcID.MUTTADILE_7563:
|
||||
runMutta = false;
|
||||
Momma_NPC = null;
|
||||
break;
|
||||
|
||||
// case NpcID.GREAT_OLM_7554:
|
||||
// Olm_NPC = null;
|
||||
// break;
|
||||
|
||||
//case NpcID.GREAT_OLM_LEFT_CLAW:
|
||||
// case NpcID.GREAT_OLM_LEFT_CLAW_7555:
|
||||
// OlmMelee_NPC = null;
|
||||
// break;
|
||||
//
|
||||
case NpcID.GUARDIAN:
|
||||
Guard1_NPC = null;
|
||||
runGuard = false;
|
||||
Guard2_NPC = null;
|
||||
break;
|
||||
case NpcID.GUARDIAN_7570:
|
||||
Guard2_NPC = null;
|
||||
Guard1_NPC = null;
|
||||
runGuard = false;
|
||||
break;
|
||||
case NpcID.GUARDIAN_7571:
|
||||
case NpcID.GUARDIAN_7572:
|
||||
Guard1_NPC = null;
|
||||
runGuard = false;
|
||||
Guard2_NPC = null;
|
||||
break;
|
||||
//add vanguards
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
|
||||
if (client.getVar(Varbits.IN_RAID) == 0)
|
||||
{
|
||||
runOlm = false;
|
||||
runGuard = false;
|
||||
runMutta = false;
|
||||
runTekton = false;
|
||||
needOlm = false;
|
||||
OlmPhase = 0;
|
||||
sleepcount = 0;
|
||||
Olm_Heal.clear();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
if (needOlm = true)
|
||||
{
|
||||
for (NPC monster : client.getNpcs())
|
||||
{
|
||||
if (monster.getId() == NpcID.GREAT_OLM)
|
||||
{
|
||||
needOlm = false;
|
||||
Olm_NPC = monster;
|
||||
System.out.println("Found olm Npc");
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (runGuard)
|
||||
{
|
||||
if (guardTick == -1)
|
||||
{
|
||||
if (Guard1_NPC != null)
|
||||
{
|
||||
if (Guard1_NPC.getAnimation() == ANIMATION_ID_G1)
|
||||
{
|
||||
guardTick = 5;
|
||||
}
|
||||
}
|
||||
if (Guard2_NPC != null)
|
||||
{
|
||||
if (Guard2_NPC.getAnimation() == ANIMATION_ID_G1)
|
||||
{
|
||||
guardTick = 5;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
guardTick--;
|
||||
}
|
||||
if (guardTick == 0)
|
||||
{
|
||||
guardTick = 5;
|
||||
}
|
||||
|
||||
}
|
||||
if (runOlm)
|
||||
{
|
||||
Olm_Crystals.clear();
|
||||
Olm_Heal.clear();
|
||||
|
||||
sleepcount--;
|
||||
|
||||
if (Olm_TicksUntilAction == 1)
|
||||
{
|
||||
if (Olm_ActionCycle == 1)
|
||||
{
|
||||
Olm_ActionCycle = 4;
|
||||
Olm_TicksUntilAction = 4;
|
||||
if (Olm_NextSpec == 1)
|
||||
{
|
||||
if (OlmPhase == 1)
|
||||
{
|
||||
Olm_NextSpec = 4; // 4 = heal 3= cry 2 = lightn 1 = swap
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_NextSpec = 3;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_NextSpec--;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Olm_ActionCycle != -1)
|
||||
{
|
||||
Olm_ActionCycle--;
|
||||
}
|
||||
Olm_TicksUntilAction = 4;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Olm_TicksUntilAction--;
|
||||
}
|
||||
|
||||
//for (GameObject i : client.getGameObjects()) {
|
||||
// if (i.getId() == GRAPHICSOBJECT_ID_CRYSTAL) {
|
||||
// WorldPoint newloc;
|
||||
// for (int x = -1; x <= 1; x++) {
|
||||
// for (int y = -1; y <= 1; y++) {
|
||||
// newloc = WorldPoint.fromLocal(client, o.getLocation());
|
||||
|
||||
// if (config.LargeCrystals()) {
|
||||
// newloc = newloc.dx(x);
|
||||
// newloc = newloc.dy(y);
|
||||
// }
|
||||
// Olm_Crystals.add(newloc);
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
//
|
||||
// }
|
||||
// if (o.getId() == GRAPHICSOBJECT_ID_HEAL) {
|
||||
// Olm_Heal.add(WorldPoint.fromLocal(client, o.getLocation()));
|
||||
// }
|
||||
//}
|
||||
|
||||
|
||||
for (GraphicsObject o : client.getGraphicsObjects())
|
||||
{
|
||||
if (o.getId() == GRAPHICSOBJECT_ID_CRYSTAL)
|
||||
{
|
||||
WorldPoint newloc;
|
||||
for (int x = -1; x <= 1; x++)
|
||||
{
|
||||
for (int y = -1; y <= 1; y++)
|
||||
{
|
||||
newloc = WorldPoint.fromLocal(client, o.getLocation());
|
||||
|
||||
if (config.LargeCrystals())
|
||||
{
|
||||
newloc = newloc.dx(x);
|
||||
newloc = newloc.dy(y);
|
||||
}
|
||||
Olm_Crystals.add(newloc);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (sleepcount <= 0)
|
||||
{
|
||||
if (o.getId() == 1338)
|
||||
{
|
||||
Olm_TicksUntilAction = 1;
|
||||
Olm_NextSpec = 2;
|
||||
Olm_ActionCycle = 4; //spec=1 null=3
|
||||
sleepcount = 5;
|
||||
System.out.println("setting off 1338 id - crystals");
|
||||
}
|
||||
if (o.getId() == 1356)
|
||||
{
|
||||
Olm_TicksUntilAction = 4;
|
||||
Olm_NextSpec = 1;
|
||||
Olm_ActionCycle = 4; //spec=1 null=3
|
||||
sleepcount = 50;
|
||||
System.out.println("setting off 1338 id - lighning");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (o.getId() == GRAPHICSOBJECT_ID_HEAL)
|
||||
{
|
||||
Olm_Heal.add(WorldPoint.fromLocal(client, o.getLocation()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,38 +1,22 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* 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.ztob;
|
||||
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
public class BloatTimerOverlay extends Overlay {
|
||||
|
||||
@@ -50,20 +34,29 @@ public class BloatTimerOverlay extends Overlay {
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
}
|
||||
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
|
||||
if (config.bloatTimer())
|
||||
{
|
||||
final String tickCounter = String.valueOf(plugin.bloatTimer);
|
||||
int secondConversion = (int) (plugin.bloatTimer * .6);
|
||||
if (plugin.getBloat_NPC() != null)
|
||||
{
|
||||
Point canvasPoint = plugin.getBloat_NPC().getCanvasTextLocation(graphics, tickCounter, 60);
|
||||
if (plugin.bloatTimer <= 37)
|
||||
{
|
||||
renderTextLocation(graphics, tickCounter + "( " + secondConversion + " )", 15, Font.BOLD, Color.WHITE, canvasPoint);
|
||||
}
|
||||
else
|
||||
{
|
||||
renderTextLocation(graphics, tickCounter + "( " + secondConversion + " )", 15, Font.BOLD, Color.RED, canvasPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (config.bloatTimer()) {
|
||||
final String tickCounter = String.valueOf(plugin.bloatTimer);
|
||||
int secondConversion = (int) (plugin.bloatTimer * .6);
|
||||
if (plugin.getBloat_NPC() != null) {
|
||||
Point canvasPoint = plugin.getBloat_NPC().getCanvasTextLocation(graphics, tickCounter, 60);
|
||||
if (plugin.bloatTimer <= 37) {
|
||||
renderTextLocation(graphics, tickCounter + "( " + secondConversion + " )", 15, Font.BOLD, Color.WHITE, canvasPoint);
|
||||
} else {
|
||||
renderTextLocation(graphics, tickCounter + "( " + secondConversion + " )", 15, Font.BOLD, Color.RED, canvasPoint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
@@ -91,15 +84,17 @@ public class BloatTimerOverlay extends Overlay {
|
||||
graphics.fill(poly);
|
||||
}
|
||||
|
||||
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, net.runelite.api.Point canvasPoint) {
|
||||
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, net.runelite.api.Point canvasPoint)
|
||||
{
|
||||
graphics.setFont(new Font("Arial", fontStyle, fontSize));
|
||||
if (canvasPoint != null) {
|
||||
if (canvasPoint != null)
|
||||
{
|
||||
final net.runelite.api.Point canvasCenterPoint = new net.runelite.api.Point(
|
||||
canvasPoint.getX(),
|
||||
canvasPoint.getY());
|
||||
final net.runelite.api.Point canvasCenterPoint_shadow = new Point(
|
||||
canvasPoint.getX() + 1,
|
||||
canvasPoint.getY() + 1);
|
||||
canvasPoint.getY() + 1);
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK);
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor);
|
||||
}
|
||||
|
||||
@@ -14,16 +14,18 @@ import net.runelite.client.config.ConfigItem;
|
||||
|
||||
@ConfigGroup("Theatre")
|
||||
|
||||
public interface TheatreConfig extends Config {
|
||||
public interface TheatreConfig extends Config
|
||||
{
|
||||
@ConfigItem(
|
||||
position = 0,
|
||||
keyName = "MaidenBlood",
|
||||
name = "Maiden blood attack",
|
||||
description = ""
|
||||
)
|
||||
default boolean MaidenBlood() {
|
||||
return true;
|
||||
}
|
||||
default boolean MaidenBlood()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 1,
|
||||
@@ -31,9 +33,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Maiden blood spawns",
|
||||
description = ""
|
||||
)
|
||||
default boolean MaidenSpawns() {
|
||||
return true;
|
||||
}
|
||||
default boolean MaidenSpawns()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 2,
|
||||
@@ -41,9 +44,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Bloat Indicator",
|
||||
description = ""
|
||||
)
|
||||
default boolean BloatIndicator() {
|
||||
return true;
|
||||
}
|
||||
default boolean BloatIndicator()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 3,
|
||||
@@ -51,9 +55,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Bloat Timer",
|
||||
description = ""
|
||||
)
|
||||
default boolean bloatTimer() {
|
||||
return true;
|
||||
}
|
||||
default boolean bloatTimer()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 4,
|
||||
@@ -61,9 +66,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Bloat Feet",
|
||||
description = ""
|
||||
)
|
||||
default boolean bloatFeetIndicator() {
|
||||
return true;
|
||||
}
|
||||
default boolean bloatFeetIndicator()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 5,
|
||||
@@ -71,9 +77,11 @@ public interface TheatreConfig extends Config {
|
||||
name = "Nylocas pillar health",
|
||||
description = ""
|
||||
)
|
||||
default boolean NyloPillars() {
|
||||
return true;
|
||||
}
|
||||
default boolean NyloPillars()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ConfigItem(
|
||||
@@ -82,9 +90,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Nylocas explosions",
|
||||
description = ""
|
||||
)
|
||||
default boolean NyloBlasts() {
|
||||
return true;
|
||||
}
|
||||
default boolean NyloBlasts()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 7,
|
||||
@@ -103,9 +112,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Sotetseg maze",
|
||||
description = ""
|
||||
)
|
||||
default boolean SotetsegMaze1() {
|
||||
return true;
|
||||
}
|
||||
default boolean SotetsegMaze1()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 9,
|
||||
@@ -113,9 +123,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Sotetseg maze (solo mode)",
|
||||
description = ""
|
||||
)
|
||||
default boolean SotetsegMaze2() {
|
||||
return true;
|
||||
}
|
||||
default boolean SotetsegMaze2()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 10,
|
||||
@@ -123,9 +134,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Xarpus Exhumed",
|
||||
description = ""
|
||||
)
|
||||
default boolean XarpusExhumed() {
|
||||
return true;
|
||||
}
|
||||
default boolean XarpusExhumed()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 11,
|
||||
@@ -133,9 +145,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Xarpus Tick",
|
||||
description = ""
|
||||
)
|
||||
default boolean XarpusTick() {
|
||||
return false;
|
||||
}
|
||||
default boolean XarpusTick()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 12,
|
||||
@@ -143,9 +156,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Xarpus Exhume Counter",
|
||||
description = ""
|
||||
)
|
||||
default boolean XarpusExhumeOverlay() {
|
||||
return false;
|
||||
}
|
||||
default boolean XarpusExhumeOverlay()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 13,
|
||||
@@ -153,9 +167,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Verzik Projectile Markers",
|
||||
description = ""
|
||||
)
|
||||
default boolean VerzikCupcakes() {
|
||||
return false;
|
||||
}
|
||||
default boolean VerzikCupcakes()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 14,
|
||||
@@ -163,9 +178,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Verzik P3 Tick",
|
||||
description = ""
|
||||
)
|
||||
default boolean VerzikTick() {
|
||||
return false;
|
||||
}
|
||||
default boolean VerzikTick()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 15,
|
||||
@@ -173,9 +189,10 @@ public interface TheatreConfig extends Config {
|
||||
name = "Verzik P3 Melee Range",
|
||||
description = ""
|
||||
)
|
||||
default boolean VerzikMelee() {
|
||||
return false;
|
||||
}
|
||||
default boolean VerzikMelee()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 16,
|
||||
@@ -183,19 +200,21 @@ public interface TheatreConfig extends Config {
|
||||
name = "Verzik Yellow Timing",
|
||||
description = ""
|
||||
)
|
||||
default boolean VerzikYellow() {
|
||||
return false;
|
||||
}
|
||||
default boolean VerzikYellow()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 17,
|
||||
keyName = "Verzik Nylo",
|
||||
name = "Verzik Nylo Overlay",
|
||||
description = ""
|
||||
)
|
||||
default boolean NyloTargetOverlay() {
|
||||
return false;
|
||||
}
|
||||
keyName = "Verzik Nylo",
|
||||
name = "Verzik Nylo Overlay",
|
||||
description = ""
|
||||
)
|
||||
default boolean NyloTargetOverlay()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
position = 18,
|
||||
@@ -203,9 +222,11 @@ public interface TheatreConfig extends Config {
|
||||
name = "Verzik P3 Tile Overlay",
|
||||
description = ""
|
||||
)
|
||||
default boolean verzikTankTile() {
|
||||
return true;
|
||||
}
|
||||
default boolean verzikTankTile()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -8,18 +8,32 @@
|
||||
|
||||
package net.runelite.client.plugins.ztob;
|
||||
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldArea;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import java.awt.BasicStroke;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import java.awt.Polygon;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GroundObject;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NPCComposition;
|
||||
import net.runelite.api.NpcID;
|
||||
import net.runelite.api.Perspective;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.Projectile;
|
||||
import net.runelite.api.coords.LocalPoint;
|
||||
import net.runelite.api.coords.WorldArea;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
public class TheatreOverlay extends Overlay {
|
||||
private final Client client;
|
||||
@@ -37,53 +51,71 @@ public class TheatreOverlay extends Overlay {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (plugin.isRunMaiden()) {
|
||||
if (config.MaidenBlood()) {
|
||||
for (WorldPoint point : plugin.getMaiden_BloodSpatters()) {
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if (plugin.isRunMaiden())
|
||||
{
|
||||
if (config.MaidenBlood())
|
||||
{
|
||||
for (WorldPoint point : plugin.getMaiden_BloodSpatters())
|
||||
{
|
||||
drawTile(graphics, point, new Color(36, 248, 229), 2, 150, 10);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.MaidenSpawns()) {
|
||||
for (WorldPoint point : plugin.getMaiden_SpawnLocations()) {
|
||||
if (config.MaidenSpawns())
|
||||
{
|
||||
for (WorldPoint point : plugin.getMaiden_SpawnLocations())
|
||||
{
|
||||
drawTile(graphics, point, new Color(36, 248, 229), 2, 180, 20);
|
||||
}
|
||||
for (WorldPoint point : plugin.getMaiden_SpawnLocations2()) {
|
||||
drawTile(graphics, point, new Color(36, 248, 229), 1, 120, 10);
|
||||
for (WorldPoint point : plugin.getMaiden_SpawnLocations2())
|
||||
{
|
||||
drawTile(graphics, point, new Color(36, 248, 229), 1, 120, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isRunBloat() && config.BloatIndicator()) {
|
||||
if (config.bloatFeetIndicator()) {
|
||||
if (plugin.getTemp().size() > 0) {
|
||||
if (plugin.isTempFlag()) {
|
||||
for (WorldPoint point : plugin.getTemp()) {
|
||||
if (plugin.isRunBloat() && config.BloatIndicator())
|
||||
{
|
||||
if (config.bloatFeetIndicator())
|
||||
{
|
||||
if (plugin.getTemp().size() > 0)
|
||||
{
|
||||
if (plugin.isTempFlag())
|
||||
{
|
||||
for (WorldPoint point : plugin.getTemp())
|
||||
{
|
||||
|
||||
drawTile(graphics, point, Color.black, 4, 255, 0);
|
||||
drawTile(graphics, point, Color.black, 4, 255, 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
} else if (plugin.getTemp2().size() > 0) {
|
||||
if (plugin.isTemp2Flag()) {
|
||||
for (WorldPoint point : plugin.getTemp2()) {
|
||||
}
|
||||
}
|
||||
else if (plugin.getTemp2().size() > 0)
|
||||
{
|
||||
if (plugin.isTemp2Flag())
|
||||
{
|
||||
for (WorldPoint point : plugin.getTemp2())
|
||||
{
|
||||
|
||||
drawTile(graphics, point, Color.black, 4, 255, 0);
|
||||
drawTile(graphics, point, Color.black, 4, 255, 0);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NPC bloat = plugin.getBloat_NPC();
|
||||
int state = plugin.getBloat_State();
|
||||
if (bloat == null) {
|
||||
if (bloat == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
switch (state) {
|
||||
switch (state)
|
||||
{
|
||||
case 2:
|
||||
renderNpcOverlay(graphics, bloat, Color.GREEN, 3, 150, 0);
|
||||
break;
|
||||
@@ -96,8 +128,10 @@ public class TheatreOverlay extends Overlay {
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isRunNylocas()) {
|
||||
if (config.NyloPillars()) {
|
||||
if (plugin.isRunNylocas())
|
||||
{
|
||||
if (config.NyloPillars())
|
||||
{
|
||||
Map<NPC, Integer> pillars = plugin.getNylocas_Pillars();
|
||||
for (NPC npc : pillars.keySet()) {
|
||||
final int health = pillars.get(npc);
|
||||
@@ -114,13 +148,15 @@ public class TheatreOverlay extends Overlay {
|
||||
}
|
||||
}
|
||||
|
||||
if (config.NyloBlasts()) {
|
||||
if (config.NyloBlasts())
|
||||
{
|
||||
final Map<NPC, Integer> npcMap = plugin.getNylocas_Map();
|
||||
for (NPC npc : npcMap.keySet()) {
|
||||
for (NPC npc : npcMap.keySet())
|
||||
{
|
||||
int ticksLeft = npcMap.get(npc);
|
||||
if (ticksLeft > -1) {
|
||||
if (ticksLeft <= 6) {
|
||||
Color color = new Color(255, 255, 0, 180);
|
||||
Color color = new Color(255, 255, 0, 180);
|
||||
int outlineWidth = 2;
|
||||
int outlineAlpha = 150;
|
||||
renderNpcOverlay(graphics, npc, color, outlineWidth, outlineAlpha, 15);
|
||||
@@ -130,18 +166,23 @@ public class TheatreOverlay extends Overlay {
|
||||
}
|
||||
}
|
||||
|
||||
if (plugin.isRunSotetseg()) {
|
||||
if (config.SotetsegMaze1()) {
|
||||
if (plugin.isRunSotetseg())
|
||||
{
|
||||
if (config.SotetsegMaze1())
|
||||
{
|
||||
int i = 1;
|
||||
for (GroundObject o : plugin.getRedTiles().keySet()) {
|
||||
for (GroundObject o : plugin.getRedTiles().keySet())
|
||||
{
|
||||
Polygon poly = o.getCanvasTilePoly();
|
||||
if (poly != null) {
|
||||
if (poly != null)
|
||||
{
|
||||
graphics.setColor(Color.WHITE);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.draw(poly);
|
||||
}
|
||||
Point textLocation = o.getCanvasTextLocation(graphics, String.valueOf(i), 0);
|
||||
if (textLocation != null) {
|
||||
if (textLocation != null)
|
||||
{
|
||||
OverlayUtil.renderTextLocation(graphics, textLocation, String.valueOf(i), Color.WHITE);
|
||||
}
|
||||
|
||||
@@ -149,40 +190,51 @@ public class TheatreOverlay extends Overlay {
|
||||
}
|
||||
}
|
||||
|
||||
if (config.SotetsegMaze2()) {
|
||||
for (WorldPoint p : plugin.getRedTilesOverworld()) {
|
||||
if (config.SotetsegMaze2())
|
||||
{
|
||||
for (WorldPoint p : plugin.getRedTilesOverworld())
|
||||
{
|
||||
drawTile(graphics, p, Color.WHITE, 2, 255, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (plugin.isRunXarpus()) {
|
||||
if (plugin.isRunXarpus())
|
||||
{
|
||||
NPC boss = plugin.getXarpus_NPC();
|
||||
|
||||
if (boss.getId() == NpcID.XARPUS_8340 && !plugin.isXarpus_Stare() && config.XarpusTick()) {
|
||||
if (boss.getId() == NpcID.XARPUS_8340 && !plugin.isXarpus_Stare() && config.XarpusTick())
|
||||
{
|
||||
int tick = plugin.getXarpus_TicksUntilShoot();
|
||||
if (tick < 1) {
|
||||
if (tick < 1)
|
||||
{
|
||||
tick = tick % 4 + 4;
|
||||
}
|
||||
final String ticksLeftStr = String.valueOf(tick);
|
||||
Point canvasPoint = boss.getCanvasTextLocation(graphics, ticksLeftStr, 130);
|
||||
renderTextLocation(graphics, ticksLeftStr, 12, Font.BOLD, Color.WHITE, canvasPoint);
|
||||
}
|
||||
if (boss.getId() == NpcID.XARPUS_8339 && config.XarpusExhumed()) {
|
||||
for (GroundObject o : plugin.getXarpus_Exhumeds().keySet()) {
|
||||
if (boss.getId() == NpcID.XARPUS_8339 && config.XarpusExhumed())
|
||||
{
|
||||
for (GroundObject o : plugin.getXarpus_Exhumeds().keySet())
|
||||
{
|
||||
|
||||
|
||||
|
||||
Polygon poly = o.getCanvasTilePoly();
|
||||
if (poly != null) {
|
||||
if (poly != null)
|
||||
{
|
||||
graphics.setColor(new Color(0, 255, 0, 130));
|
||||
graphics.setStroke(new BasicStroke(1));
|
||||
graphics.draw(poly);
|
||||
}
|
||||
}
|
||||
for (Map.Entry<GroundObject, Integer> exhumes : plugin.getXarpusExhumedsTimer().entrySet()) {
|
||||
for (Map.Entry<GroundObject, Integer> exhumes : plugin.getXarpusExhumedsTimer().entrySet())
|
||||
{
|
||||
final String ticksremaining = String.valueOf(exhumes.getValue());
|
||||
if (Integer.valueOf(ticksremaining) > 0) {
|
||||
if (Integer.valueOf(ticksremaining) > 0)
|
||||
{
|
||||
GroundObject ex = exhumes.getKey();
|
||||
Point point = ex.getCanvasTextLocation(graphics, ticksremaining, 0);
|
||||
renderTextLocation(graphics, ticksremaining, 12, Font.BOLD, Color.white, point);
|
||||
@@ -196,21 +248,27 @@ public class TheatreOverlay extends Overlay {
|
||||
}
|
||||
|
||||
|
||||
if (plugin.isRunVerzik()) {
|
||||
if (plugin.isRunVerzik())
|
||||
{
|
||||
|
||||
|
||||
if (config.VerzikCupcakes()) {
|
||||
for (WorldPoint p : plugin.getVerzik_RangeProjectiles().values()) {
|
||||
if (config.VerzikCupcakes())
|
||||
{
|
||||
for (WorldPoint p : plugin.getVerzik_RangeProjectiles().values())
|
||||
{
|
||||
drawTile(graphics, p, Color.RED, 2, 180, 50);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.VerzikYellow()) {
|
||||
for (WorldPoint p : plugin.getVerzik_YellowTiles()) {
|
||||
drawTile(graphics, p, Color.YELLOW, 3, 255, 0);
|
||||
if (config.VerzikYellow())
|
||||
{
|
||||
for (WorldPoint p : plugin.getVerzik_YellowTiles())
|
||||
{
|
||||
drawTile(graphics, p, Color.YELLOW, 3, 255, 0);
|
||||
Projectile yellowBall = plugin.getVerzik_YellowBall();
|
||||
if (yellowBall != null) {
|
||||
final int ticksToImpact = yellowBall.getRemainingCycles() / 30;
|
||||
if (yellowBall != null)
|
||||
{
|
||||
final int ticksToImpact = yellowBall.getRemainingCycles() / 30;
|
||||
final String countdownStr = String.valueOf(ticksToImpact);
|
||||
Point canvasPoint = Perspective.getCanvasTextLocation(client, graphics, LocalPoint.fromWorld(client, p), countdownStr, 0);
|
||||
renderTextLocation(graphics, countdownStr, 12, Font.BOLD, Color.WHITE, canvasPoint);
|
||||
@@ -220,32 +278,40 @@ public class TheatreOverlay extends Overlay {
|
||||
}
|
||||
|
||||
final NPC boss = plugin.getVerzik_NPC();
|
||||
if (boss.getId() == NpcID.VERZIK_VITUR_8374) {
|
||||
if (config.verzikTankTile()) {
|
||||
renderNpcOverlay(graphics, boss, new Color(75, 0, 130), 1, 255, 0);
|
||||
if (boss.getId() == NpcID.VERZIK_VITUR_8374)
|
||||
{
|
||||
if (config.verzikTankTile())
|
||||
{
|
||||
renderNpcOverlay(graphics, boss, new Color(75, 0, 130), 1, 255, 0);
|
||||
}
|
||||
|
||||
if (config.VerzikTick()) {
|
||||
if (config.VerzikTick())
|
||||
{
|
||||
final int ticksLeft = plugin.getP3_TicksUntilAttack();
|
||||
if (ticksLeft > 0 && ticksLeft < 8) {
|
||||
if (ticksLeft > 0 && ticksLeft < 8)
|
||||
{
|
||||
final String ticksLeftStr = String.valueOf(ticksLeft);
|
||||
Point canvasPoint = boss.getCanvasTextLocation(graphics, ticksLeftStr, 60);
|
||||
renderTextLocation(graphics, ticksLeftStr, 15, Font.BOLD, Color.WHITE, canvasPoint);
|
||||
}
|
||||
}
|
||||
|
||||
if (config.VerzikMelee()) {
|
||||
if (config.VerzikMelee())
|
||||
{
|
||||
List<WorldPoint> meleeRange = getHitSquares(boss.getWorldLocation(), 7, 1, false);
|
||||
|
||||
for (WorldPoint p : meleeRange) {
|
||||
drawTile(graphics, p, Color.WHITE, 1, 155, 10);
|
||||
for (WorldPoint p : meleeRange)
|
||||
{
|
||||
drawTile(graphics, p, Color.WHITE, 1, 155, 10);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (boss.getAnimation() == 8117) {
|
||||
if (boss.getAnimation() == 8117)
|
||||
{
|
||||
final int ticksLeft = plugin.getRedCrabsTimer();
|
||||
if (ticksLeft > 0) {
|
||||
if (ticksLeft > 0)
|
||||
{
|
||||
final String ticksLeftStr = String.valueOf(ticksLeft);
|
||||
Point canvasPoint = boss.getCanvasTextLocation(graphics, ticksLeftStr, 60);
|
||||
renderTextLocation(graphics, ticksLeftStr, 15, Font.BOLD, Color.WHITE, canvasPoint);
|
||||
@@ -279,16 +345,19 @@ public class TheatreOverlay extends Overlay {
|
||||
graphics.fill(poly);
|
||||
}
|
||||
|
||||
private void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color, int outlineWidth, int outlineAlpha, int fillAlpha) {
|
||||
private void renderNpcOverlay(Graphics2D graphics, NPC actor, Color color, int outlineWidth, int outlineAlpha, int fillAlpha)
|
||||
{
|
||||
int size = 1;
|
||||
NPCComposition composition = actor.getTransformedComposition();
|
||||
if (composition != null) {
|
||||
if (composition != null)
|
||||
{
|
||||
size = composition.getSize();
|
||||
}
|
||||
LocalPoint lp = actor.getLocalLocation();
|
||||
Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size);
|
||||
|
||||
if (tilePoly != null) {
|
||||
if (tilePoly != null)
|
||||
{
|
||||
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha));
|
||||
graphics.setStroke(new BasicStroke(outlineWidth));
|
||||
graphics.draw(tilePoly);
|
||||
@@ -297,27 +366,33 @@ public class TheatreOverlay extends Overlay {
|
||||
}
|
||||
}
|
||||
|
||||
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) {
|
||||
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint)
|
||||
{
|
||||
graphics.setFont(new Font("Arial", fontStyle, fontSize));
|
||||
if (canvasPoint != null) {
|
||||
if (canvasPoint != null)
|
||||
{
|
||||
final Point canvasCenterPoint = new Point(
|
||||
canvasPoint.getX(),
|
||||
canvasPoint.getY());
|
||||
final Point canvasCenterPoint_shadow = new Point(
|
||||
canvasPoint.getX() + 1,
|
||||
canvasPoint.getY() + 1);
|
||||
canvasPoint.getY() + 1);
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK);
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor);
|
||||
}
|
||||
}
|
||||
|
||||
private List<WorldPoint> getHitSquares(WorldPoint npcLoc, int npcSize, int thickness, boolean includeUnder) {
|
||||
private List<WorldPoint> getHitSquares(WorldPoint npcLoc, int npcSize, int thickness, boolean includeUnder)
|
||||
{
|
||||
List<WorldPoint> little = new WorldArea(npcLoc, npcSize, npcSize).toWorldPointList();
|
||||
List<WorldPoint> big = new WorldArea(npcLoc.getX() - thickness, npcLoc.getY() - thickness, npcSize + (thickness * 2), npcSize + (thickness * 2), npcLoc.getPlane()).toWorldPointList();
|
||||
if (!includeUnder) {
|
||||
for (Iterator<WorldPoint> it = big.iterator(); it.hasNext(); ) {
|
||||
List<WorldPoint> big = new WorldArea(npcLoc.getX() - thickness, npcLoc.getY() - thickness, npcSize + (thickness * 2), npcSize + (thickness * 2), npcLoc.getPlane()).toWorldPointList();
|
||||
if (!includeUnder)
|
||||
{
|
||||
for (Iterator<WorldPoint> it = big.iterator(); it.hasNext(); )
|
||||
{
|
||||
WorldPoint p = it.next();
|
||||
if (little.contains(p)) {
|
||||
if (little.contains(p))
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,39 @@
|
||||
package net.runelite.client.plugins.ztob;
|
||||
|
||||
import com.google.inject.Provides;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.GraphicsObject;
|
||||
import net.runelite.api.GroundObject;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.MenuEntry;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.NpcID;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.api.Projectile;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.*;
|
||||
import net.runelite.api.events.AnimationChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.GraphicsObjectCreated;
|
||||
import net.runelite.api.events.GroundObjectSpawned;
|
||||
import net.runelite.api.events.MenuEntryAdded;
|
||||
import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.api.events.ProjectileMoved;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import net.runelite.client.chat.ChatMessageManager;
|
||||
import net.runelite.client.config.ConfigManager;
|
||||
@@ -24,15 +52,12 @@ import net.runelite.client.plugins.PluginType;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.util.Text;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.*;
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Theater of Blood",
|
||||
description = "All-in-one plugin for Theatre of Blood",
|
||||
tags = {"ToB"},
|
||||
tags = {"ToB", "theatre", "blood"},
|
||||
enabledByDefault = false,
|
||||
type = PluginType.PVM
|
||||
type = PluginType.PVM
|
||||
)
|
||||
|
||||
public class TheatrePlugin extends Plugin {
|
||||
@@ -55,24 +80,30 @@ public class TheatrePlugin extends Plugin {
|
||||
private static final int PROJECTILE_ID_P3_GREEN = 1598;
|
||||
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<GroundObject, Integer> xarpusExhumedsTimer = new HashMap<>();
|
||||
@Getter
|
||||
int exhumecount;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private final Map<GroundObject, Integer> xarpusExhumedsTimer = new HashMap<>();
|
||||
|
||||
@Getter
|
||||
int bloatTimer = 0;
|
||||
|
||||
int bloatFeetTimer = 0;
|
||||
NPC BossNylo = null;
|
||||
private boolean bloatFlag = false;
|
||||
|
||||
@Getter
|
||||
private Set<WorldPoint> bloatTiles = new HashSet<>();
|
||||
|
||||
@Getter
|
||||
private Set<WorldPoint> temp = new HashSet<>();
|
||||
@Getter
|
||||
|
||||
@Getter
|
||||
private Set<WorldPoint> temp2 = new HashSet<>();
|
||||
@Getter
|
||||
|
||||
@Getter
|
||||
private Set<WorldPoint> localTemp = new HashSet<>();
|
||||
NPC BossNylo = null;
|
||||
private boolean bloatFlag = false;
|
||||
|
||||
//@Getter
|
||||
//private List<WorldPoint> bloatTiles = new ArrayList<>();
|
||||
@@ -168,7 +199,8 @@ public class TheatrePlugin extends Plugin {
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private NPC Verzik_NPC;
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
private List<NPC> tornadoList;
|
||||
|
||||
@Getter(AccessLevel.PACKAGE)
|
||||
@@ -224,7 +256,6 @@ public class TheatrePlugin extends Plugin {
|
||||
overlayManager.remove(bloatTimerOverlay);
|
||||
}
|
||||
|
||||
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded event) {
|
||||
if (client.getGameState() != GameState.LOGGED_IN || !config.NyloMenu() || !runNylocas) {
|
||||
@@ -232,12 +263,10 @@ public class TheatrePlugin extends Plugin {
|
||||
}
|
||||
|
||||
final String pOptionToReplace = Text.removeTags(event.getOption()).toUpperCase();
|
||||
Map<KitType, ItemComposition> playerEquipment = new HashMap<>();
|
||||
|
||||
int attackType = 0; //0=idk 1= melee 2= range 3= mage
|
||||
|
||||
for (KitType kitType : KitType.values()) {
|
||||
|
||||
int itemId = client.getLocalPlayer().getPlayerComposition().getEquipmentId(kitType);
|
||||
switch (itemId) {
|
||||
case ItemID.DRAGON_CLAWS:
|
||||
@@ -302,7 +331,8 @@ public class TheatrePlugin extends Plugin {
|
||||
}
|
||||
|
||||
}
|
||||
if (!pOptionToReplace.equals("ATTACK")) {
|
||||
|
||||
if (!pOptionToReplace.equals("ATTACK")) {
|
||||
return;
|
||||
}
|
||||
int Id = 0;
|
||||
@@ -912,7 +942,7 @@ public class TheatrePlugin extends Plugin {
|
||||
Keep = "Nylocas Ischyros";
|
||||
break;
|
||||
case 2:
|
||||
Keep = "Nylocal Toxobolos";
|
||||
Keep = "Nylocas Toxobolos";
|
||||
break;
|
||||
case 3:
|
||||
Keep = "Nylocas Hagios";
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
package net.runelite.client.plugins.ztob;
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Graphics2D;
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
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.components.LineComponent;
|
||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG;
|
||||
import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE;
|
||||
|
||||
public class TheatreXarpusOverlay extends Overlay {
|
||||
private final TheatrePlugin plugin;
|
||||
private final TheatreConfig config;
|
||||
PanelComponent panelComponent = new PanelComponent();
|
||||
|
||||
@Inject
|
||||
private TheatreXarpusOverlay(TheatrePlugin plugin, TheatreConfig config) {
|
||||
private TheatreXarpusOverlay(TheatrePlugin plugin, TheatreConfig config)
|
||||
{
|
||||
super(plugin);
|
||||
setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT);
|
||||
setPosition(OverlayPosition.DYNAMIC);
|
||||
@@ -29,10 +30,10 @@ public class TheatreXarpusOverlay extends Overlay {
|
||||
getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Theatre xarpus overlay"));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
if (plugin.isRunXarpus()) {
|
||||
if (plugin.isRunXarpus())
|
||||
{
|
||||
if (config.XarpusExhumeOverlay()) {
|
||||
if (plugin.getXarpus_NPC().getId() == 8339) {
|
||||
panelComponent.getChildren().clear();
|
||||
|
||||
@@ -1,36 +1,18 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* 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.ztob;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.Graphics2D;
|
||||
import javax.inject.Inject;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.NPC;
|
||||
import net.runelite.api.Point;
|
||||
import net.runelite.client.ui.overlay.*;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.awt.*;
|
||||
import net.runelite.client.ui.overlay.Overlay;
|
||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||
import net.runelite.client.ui.overlay.OverlayPriority;
|
||||
import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
|
||||
public class VerzikNyloOverlay extends Overlay {
|
||||
|
||||
@@ -48,34 +30,47 @@ public class VerzikNyloOverlay extends Overlay {
|
||||
setLayer(OverlayLayer.ABOVE_SCENE);
|
||||
}
|
||||
|
||||
public Dimension render(Graphics2D graphics) {
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
|
||||
if (plugin.isRunVerzik()) {
|
||||
if (config.NyloTargetOverlay()) {
|
||||
if (plugin.getCrabList().size() > 0) {
|
||||
if (plugin.isRunVerzik())
|
||||
{
|
||||
if (config.NyloTargetOverlay())
|
||||
{
|
||||
if (plugin.getCrabList().size() > 0)
|
||||
{
|
||||
|
||||
for (NPC npc : plugin.getCrabList()) {
|
||||
if (npc.isDead()) {
|
||||
for (NPC npc : plugin.getCrabList())
|
||||
{
|
||||
if (npc.isDead())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
String renderText = "";
|
||||
if (npc.getInteracting() != null) {
|
||||
if (npc.getInteracting() != null)
|
||||
{
|
||||
|
||||
renderText = npc.getInteracting().getName();
|
||||
Point point = npc.getCanvasTextLocation(graphics, npc.getInteracting().getName(), 0);
|
||||
Point point = npc.getCanvasTextLocation(graphics, npc.getInteracting().getName(), 0);
|
||||
|
||||
|
||||
if (npc.getInteracting().getName().toLowerCase().equals(client.getLocalPlayer().getName().toLowerCase())) {
|
||||
point = npc.getCanvasTextLocation(graphics, client.getLocalPlayer().getName(), 0);
|
||||
if (npc.getInteracting().getName().toLowerCase().equals(client.getLocalPlayer().getName().toLowerCase()))
|
||||
{
|
||||
point = npc.getCanvasTextLocation(graphics, client.getLocalPlayer().getName(), 0);
|
||||
renderText = "YOU NIGGA RUN!";
|
||||
|
||||
} else if (npc.getInteracting().getName().toLowerCase().equals("afyy")) {
|
||||
point = npc.getCanvasTextLocation(graphics, "Ricecup", 0);
|
||||
}
|
||||
else if (npc.getInteracting().getName().toLowerCase().equals("afyy"))
|
||||
{
|
||||
point = npc.getCanvasTextLocation(graphics, "Ricecup", 0);
|
||||
renderText = "Ricecup";
|
||||
}
|
||||
if (renderText.equals("YOU NIGGA RUN!")) {
|
||||
if (renderText.equals("YOU NIGGA RUN!"))
|
||||
{
|
||||
renderTextLocation(graphics, renderText, 12, Font.BOLD, Color.RED, point);
|
||||
} else {
|
||||
}
|
||||
else
|
||||
{
|
||||
renderTextLocation(graphics, renderText, 12, Font.BOLD, Color.GREEN, point);
|
||||
}
|
||||
}
|
||||
@@ -89,15 +84,17 @@ public class VerzikNyloOverlay extends Overlay {
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) {
|
||||
private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint)
|
||||
{
|
||||
graphics.setFont(new Font("Arial", fontStyle, fontSize));
|
||||
if (canvasPoint != null) {
|
||||
if (canvasPoint != null)
|
||||
{
|
||||
final Point canvasCenterPoint = new Point(
|
||||
canvasPoint.getX(),
|
||||
canvasPoint.getY());
|
||||
final Point canvasCenterPoint_shadow = new Point(
|
||||
canvasPoint.getX() + 1,
|
||||
canvasPoint.getY() + 1);
|
||||
canvasPoint.getY() + 1);
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK);
|
||||
OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor);
|
||||
}
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
Reference in New Issue
Block a user