Update barb assault plugin (#148)
This commit is contained in:
@@ -38,7 +38,7 @@ import net.runelite.api.coords.WorldPoint;
|
||||
*/
|
||||
public interface Actor extends Renderable
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Gets the combat level of the actor.
|
||||
*
|
||||
@@ -247,7 +247,7 @@ public interface Actor extends Renderable
|
||||
* @param overheadText the overhead text
|
||||
*/
|
||||
void setOverheadText(String overheadText);
|
||||
|
||||
|
||||
/**
|
||||
* Used by the "Tick Counter Plugin
|
||||
*/
|
||||
|
||||
@@ -569,7 +569,7 @@ public class WidgetID
|
||||
static final int VENT_C_STATUS = 25;
|
||||
}
|
||||
|
||||
static class BarbarianAssault
|
||||
public static class BarbarianAssault
|
||||
{
|
||||
static class ATK
|
||||
{
|
||||
@@ -579,13 +579,21 @@ public class WidgetID
|
||||
static final int ROLE_SPRITE = 11;
|
||||
static final int ROLE = 12;
|
||||
}
|
||||
static class HLR
|
||||
{
|
||||
static class HLR {
|
||||
static final int TEAMMATE1 = 18;
|
||||
static final int TEAMMATE2 = 22;
|
||||
static final int TEAMMATE3 = 26;
|
||||
static final int TEAMMATE4 = 30;
|
||||
}
|
||||
public static class REWARD_VALUES
|
||||
{
|
||||
public static final int RUNNERS_PASSED = 14;
|
||||
static final int HITPOINTS_REPLENISHED = 19;
|
||||
static final int WRONG_POISON_PACKS_USED = 20;
|
||||
static final int EGGS_COLLECTED = 21;
|
||||
static final int FAILED_ATTACKER_ATTACKS = 22;
|
||||
static final int HONOUR_POINTS_REWARD = 49;
|
||||
}
|
||||
static final int CORRECT_STYLE = 3;
|
||||
static final int CURRENT_WAVE_WIDGET = 4;
|
||||
static final int CURRENT_WAVE = 5;
|
||||
|
||||
@@ -383,6 +383,12 @@ public enum WidgetInfo
|
||||
BA_DEF_ROLE_SPRITE(WidgetID.BA_DEFENDER_GROUP_ID, WidgetID.BarbarianAssault.ROLE_SPRITE),
|
||||
|
||||
BA_REWARD_TEXT(WidgetID.BA_REWARD_GROUP_ID, WidgetID.BarbarianAssault.REWARD_TEXT),
|
||||
BA_RUNNERS_PASSED(WidgetID.BA_REWARD_GROUP_ID, WidgetID.BarbarianAssault.REWARD_VALUES.RUNNERS_PASSED),
|
||||
BA_HITPOINTS_REPLENISHED(WidgetID.BA_REWARD_GROUP_ID, WidgetID.BarbarianAssault.REWARD_VALUES.HITPOINTS_REPLENISHED),
|
||||
BA_WRONG_POISON_PACKS(WidgetID.BA_REWARD_GROUP_ID, WidgetID.BarbarianAssault.REWARD_VALUES.WRONG_POISON_PACKS_USED),
|
||||
BA_EGGS_COLLECTED(WidgetID.BA_REWARD_GROUP_ID, WidgetID.BarbarianAssault.REWARD_VALUES.EGGS_COLLECTED),
|
||||
BA_FAILED_ATTACKER_ATTACKS(WidgetID.BA_REWARD_GROUP_ID, WidgetID.BarbarianAssault.REWARD_VALUES.FAILED_ATTACKER_ATTACKS),
|
||||
BA_HONOUR_POINTS_REWARD(WidgetID.BA_REWARD_GROUP_ID, WidgetID.BarbarianAssault.REWARD_VALUES.HONOUR_POINTS_REWARD),
|
||||
|
||||
LEVEL_UP(WidgetID.LEVEL_UP_GROUP_ID, 0),
|
||||
LEVEL_UP_SKILL(WidgetID.LEVEL_UP_GROUP_ID, WidgetID.LevelUp.SKILL),
|
||||
|
||||
@@ -29,6 +29,8 @@ import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
@ConfigGroup("barbarianAssault")
|
||||
public interface BarbarianAssaultConfig extends Config
|
||||
{
|
||||
@@ -80,10 +82,34 @@ public interface BarbarianAssaultConfig extends Config
|
||||
@ConfigItem(
|
||||
keyName = "highlightCollectorEggs",
|
||||
name = "Highlight collector eggs",
|
||||
description = "Highlight called egg colors"
|
||||
description = "Highlight called egg colors",
|
||||
position = 4
|
||||
)
|
||||
default boolean highlightCollectorEggs()
|
||||
{
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showTotalRewards",
|
||||
name = "Summarize total reward points",
|
||||
description = "Displays total eggs/healed hp and missed attacks/lost runners",
|
||||
position = 5
|
||||
)
|
||||
default boolean showTotalRewards(){ return false; };
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "showSummaryOfPoints",
|
||||
name = "Display summary of advanced points",
|
||||
description = "Gives summary of advanced points breakdown in chat log",
|
||||
position = 7
|
||||
)
|
||||
default boolean showSummaryOfPoints() { return false; };
|
||||
@ConfigItem(
|
||||
keyName = "wrongPoisonFoodTextColor",
|
||||
name = "Change healer wrong poison pack color",
|
||||
description = "Change healer wrong poison pack color",
|
||||
position = 8
|
||||
)
|
||||
default Color wrongPoisonFoodTextColor() { return Color.BLACK;}
|
||||
}
|
||||
|
||||
@@ -54,11 +54,10 @@ import net.runelite.client.ui.overlay.OverlayUtil;
|
||||
class BarbarianAssaultOverlay extends Overlay
|
||||
{
|
||||
private static final int MAX_EGG_DISTANCE = 2500;
|
||||
|
||||
|
||||
private final int HEALTH_BAR_HEIGHT = 20;
|
||||
private final Color HEALTH_BAR_COLOR = new Color(225, 35, 0, 125);
|
||||
private static final Color BACKGROUND = new Color(0, 0, 0, 150);
|
||||
private static final int OFFSET_Z = 20;
|
||||
|
||||
private final Client client;
|
||||
private final BarbarianAssaultPlugin plugin;
|
||||
@@ -68,7 +67,6 @@ class BarbarianAssaultOverlay extends Overlay
|
||||
@Setter
|
||||
private Round currentRound;
|
||||
|
||||
|
||||
@Inject
|
||||
private BarbarianAssaultOverlay(Client client, BarbarianAssaultPlugin plugin, BarbarianAssaultConfig config)
|
||||
{
|
||||
@@ -120,115 +118,99 @@ class BarbarianAssaultOverlay extends Overlay
|
||||
if (role == Role.COLLECTOR && config.highlightCollectorEggs())
|
||||
{
|
||||
String heardCall = plugin.getCollectorHeardCall();
|
||||
Color highlightColor;
|
||||
Map<WorldPoint, Integer> calledEggMap;
|
||||
|
||||
Color highlightColor = BarbarianAssaultPlugin.getEggColor(heardCall);
|
||||
Map<WorldPoint, Integer> calledEggMap = plugin.getCalledEggMap();
|
||||
Map<WorldPoint, Integer> yellowEggMap = plugin.getYellowEggs();
|
||||
|
||||
switch (heardCall)
|
||||
{
|
||||
case "Red eggs":
|
||||
calledEggMap = plugin.getRedEggs();
|
||||
highlightColor = Color.RED;
|
||||
break;
|
||||
case "Green eggs":
|
||||
calledEggMap = plugin.getGreenEggs();
|
||||
highlightColor = Color.GREEN;
|
||||
break;
|
||||
case "Blue eggs":
|
||||
calledEggMap = plugin.getBlueEggs();
|
||||
highlightColor = Color.BLUE;
|
||||
break;
|
||||
default:
|
||||
calledEggMap = null;
|
||||
highlightColor = null;
|
||||
}
|
||||
|
||||
if (calledEggMap != null)
|
||||
{
|
||||
for (WorldPoint worldPoint : calledEggMap.keySet())
|
||||
{
|
||||
int quantity = calledEggMap.get(worldPoint);
|
||||
renderEggLocation(graphics, worldPoint, quantity, highlightColor);
|
||||
}
|
||||
renderEggLocations(graphics, calledEggMap, highlightColor);
|
||||
}
|
||||
|
||||
// Always show yellow eggs
|
||||
for (WorldPoint worldPoint : yellowEggMap.keySet())
|
||||
renderEggLocations(graphics, yellowEggMap, Color.YELLOW);
|
||||
}
|
||||
if (role == Role.HEALER)
|
||||
{
|
||||
for (HealerTeam teammate : HealerTeam.values())
|
||||
{
|
||||
int quantity = yellowEggMap.get(worldPoint);
|
||||
renderEggLocation(graphics, worldPoint, quantity, highlightColor);
|
||||
Widget widget = client.getWidget(teammate.getTeammate());
|
||||
if (widget == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] teammateHealth = widget.getText().split(" / ");
|
||||
final int curHealth = Integer.parseInt(teammateHealth[0]);
|
||||
final int maxHealth = Integer.parseInt(teammateHealth[1]);
|
||||
|
||||
int width = teammate.getWidth();
|
||||
final int filledWidth = getBarWidth(maxHealth, curHealth, width);
|
||||
|
||||
int offsetX = teammate.getOffset().getX();
|
||||
int offsetY = teammate.getOffset().getY();
|
||||
int x = widget.getCanvasLocation().getX() - offsetX;
|
||||
int y = widget.getCanvasLocation().getY() - offsetY;
|
||||
|
||||
graphics.setColor(HEALTH_BAR_COLOR);
|
||||
graphics.fillRect(x, y, filledWidth, HEALTH_BAR_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
if (role == Role.HEALER)
|
||||
{
|
||||
for (HealerTeam teammate : HealerTeam.values())
|
||||
{
|
||||
Widget widget = client.getWidget(teammate.getTeammate());
|
||||
if (widget == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String[] teammateHealth = widget.getText().split(" / ");
|
||||
final int curHealth = Integer.parseInt(teammateHealth[0]);
|
||||
final int maxHealth = Integer.parseInt(teammateHealth[1]);
|
||||
|
||||
int width = teammate.getWidth();
|
||||
final int filledWidth = getBarWidth(maxHealth, curHealth, width);
|
||||
|
||||
int offsetX = teammate.getOffset().getX();
|
||||
int offsetY = teammate.getOffset().getY();
|
||||
int x = widget.getCanvasLocation().getX() - offsetX;
|
||||
int y = widget.getCanvasLocation().getY() - offsetY;
|
||||
|
||||
graphics.setColor(HEALTH_BAR_COLOR);
|
||||
graphics.fillRect(x, y, filledWidth, HEALTH_BAR_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return null;
|
||||
return null;
|
||||
}
|
||||
|
||||
private void renderEggLocation(Graphics2D graphics, WorldPoint location, int quantity, Color color)
|
||||
private void renderEggLocations(Graphics2D graphics, Map<WorldPoint, Integer> eggMap, Color color)
|
||||
{
|
||||
LocalPoint groundPoint = LocalPoint.fromWorld(client, location);
|
||||
Player player = client.getLocalPlayer();
|
||||
|
||||
if (groundPoint == null || player == null)
|
||||
if (player == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (player.getLocalLocation().distanceTo(groundPoint) > MAX_EGG_DISTANCE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Polygon poly = Perspective.getCanvasTilePoly(client, groundPoint);
|
||||
final Stroke originalStroke = graphics.getStroke();
|
||||
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.drawPolygon(poly);
|
||||
graphics.setStroke(originalStroke);
|
||||
for (WorldPoint worldPoint : eggMap.keySet())
|
||||
{
|
||||
LocalPoint groundPoint = LocalPoint.fromWorld(client, worldPoint);
|
||||
|
||||
String quantityText = "x" + quantity;
|
||||
Point textPoint = Perspective.getCanvasTextLocation(client, graphics, groundPoint, quantityText, 0);
|
||||
OverlayUtil.renderTextLocation(graphics, textPoint, quantityText, Color.WHITE);
|
||||
if (groundPoint == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if (player.getLocalLocation().distanceTo(groundPoint) > MAX_EGG_DISTANCE)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Polygon poly = Perspective.getCanvasTilePoly(client, groundPoint);
|
||||
|
||||
if (poly == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int quantity = eggMap.get(worldPoint);
|
||||
String quantityText = "x" + quantity;
|
||||
Point textPoint = Perspective.getCanvasTextLocation(client, graphics, groundPoint, quantityText, OFFSET_Z);
|
||||
graphics.setColor(color);
|
||||
graphics.setStroke(new BasicStroke(2));
|
||||
graphics.drawPolygon(poly);
|
||||
OverlayUtil.renderTextLocation(graphics, textPoint, quantityText, Color.WHITE);
|
||||
}
|
||||
|
||||
graphics.setStroke(originalStroke);
|
||||
}
|
||||
|
||||
private static int getBarWidth(int base, int current, int size)
|
||||
{
|
||||
final double ratio = (double) current / base;
|
||||
private static int getBarWidth(int base, int current, int size)
|
||||
{
|
||||
final double ratio = (double) current / base;
|
||||
|
||||
if (ratio >= 1)
|
||||
{
|
||||
return size;
|
||||
}
|
||||
if (ratio >= 1)
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
return (int) Math.round(ratio * size);
|
||||
}
|
||||
return (int) Math.round(ratio * size);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,26 +25,18 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.barbarianassault;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.Color;
|
||||
import java.awt.Font;
|
||||
import java.awt.Image;
|
||||
import java.util.HashMap;
|
||||
import java.util.*;
|
||||
import javax.inject.Inject;
|
||||
import lombok.AccessLevel;
|
||||
import lombok.Getter;
|
||||
import net.runelite.api.ChatMessageType;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.ItemID;
|
||||
import net.runelite.api.Player;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.Varbits;
|
||||
import net.runelite.api.*;
|
||||
import net.runelite.api.coords.WorldPoint;
|
||||
import net.runelite.api.events.ChatMessage;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.api.events.ItemDespawned;
|
||||
import net.runelite.api.events.ItemSpawned;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.events.*;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
@@ -57,18 +49,23 @@ 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.FontManager;
|
||||
import net.runelite.client.ui.overlay.OverlayManager;
|
||||
import net.runelite.client.util.ColorUtil;
|
||||
import net.runelite.client.util.ImageUtil;
|
||||
import net.runelite.client.util.Text;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
|
||||
|
||||
@PluginDescriptor(
|
||||
name = "Barbarian Assault",
|
||||
description = "Show a timer to the next call change and game/wave duration in chat.",
|
||||
tags = {"minigame", "overlay", "timer"}
|
||||
name = "Barbarian Assault",
|
||||
description = "Show a timer to the next call change and game/wave duration in chat.",
|
||||
tags = {"minigame", "overlay", "timer"}
|
||||
)
|
||||
|
||||
public class BarbarianAssaultPlugin extends Plugin {
|
||||
public class BarbarianAssaultPlugin extends Plugin
|
||||
{
|
||||
private static final int BA_WAVE_NUM_INDEX = 2;
|
||||
private static final String START_WAVE = "1";
|
||||
private static final String ENDGAME_REWARD_NEEDLE_TEXT = "<br>5";
|
||||
@@ -86,6 +83,17 @@ public class BarbarianAssaultPlugin extends Plugin {
|
||||
@Getter
|
||||
private int totalHpHealed = 0;
|
||||
|
||||
private boolean hasAnnounced;
|
||||
|
||||
private int[] pointsList;
|
||||
|
||||
String[] descriptions = {"Runners: ",
|
||||
"Hitpoints: ",
|
||||
"Wrong heal packs: ",
|
||||
"Eggs: ",
|
||||
"Failed attacks: ",
|
||||
"Honour Points: "};
|
||||
|
||||
private Font font;
|
||||
private Image clockImage;
|
||||
private int inGameBit = 0;
|
||||
@@ -120,12 +128,21 @@ public class BarbarianAssaultPlugin extends Plugin {
|
||||
private BarbarianAssaultOverlay overlay;
|
||||
|
||||
@Provides
|
||||
BarbarianAssaultConfig provideConfig(ConfigManager configManager) {
|
||||
BarbarianAssaultConfig provideConfig(ConfigManager configManager)
|
||||
{
|
||||
return configManager.getConfig(BarbarianAssaultConfig.class);
|
||||
}
|
||||
|
||||
private static final ImmutableList<WidgetInfo> WIDGETS = ImmutableList.of(
|
||||
WidgetInfo.BA_RUNNERS_PASSED,
|
||||
WidgetInfo.BA_HITPOINTS_REPLENISHED,
|
||||
WidgetInfo.BA_WRONG_POISON_PACKS,
|
||||
WidgetInfo.BA_EGGS_COLLECTED,
|
||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS,
|
||||
WidgetInfo.BA_HONOUR_POINTS_REWARD
|
||||
);
|
||||
@Override
|
||||
protected void startUp() throws Exception {
|
||||
protected void startUp() throws Exception
|
||||
{
|
||||
overlayManager.add(overlay);
|
||||
font = FontManager.getRunescapeFont()
|
||||
.deriveFont(Font.BOLD, 24);
|
||||
@@ -136,10 +153,12 @@ public class BarbarianAssaultPlugin extends Plugin {
|
||||
greenEggs = new HashMap<>();
|
||||
blueEggs = new HashMap<>();
|
||||
yellowEggs = new HashMap<>();
|
||||
pointsList = new int[6];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void shutDown() throws Exception {
|
||||
protected void shutDown() throws Exception
|
||||
{
|
||||
overlayManager.remove(overlay);
|
||||
gameTime = null;
|
||||
currentWave = START_WAVE;
|
||||
@@ -151,75 +170,102 @@ public class BarbarianAssaultPlugin extends Plugin {
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event) {
|
||||
if (event.getGroupId() == WidgetID.BA_REWARD_GROUP_ID) {
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
if (event.getGroupId() == WidgetID.BA_REWARD_GROUP_ID)
|
||||
{
|
||||
Widget rewardWidget = client.getWidget(WidgetInfo.BA_REWARD_TEXT);
|
||||
String amt,type,totalMsg,total;
|
||||
amt=type=totalMsg=total="";
|
||||
if (config.waveTimes() && rewardWidget != null && rewardWidget.getText().contains(ENDGAME_REWARD_NEEDLE_TEXT) && gameTime != null) {
|
||||
if (config.showHpCount() && HpHealed > 0) {
|
||||
totalMsg = "; Total Healed: ";
|
||||
total = ""+totalHpHealed;
|
||||
if (HpHealed > 504)
|
||||
{
|
||||
total = ""+504;
|
||||
}
|
||||
}
|
||||
else if (config.showEggCount() && collectedEggCount > 0) {
|
||||
collectedEggCount -= wrongEggs; //true positive egg count
|
||||
if (collectedEggCount > 60)
|
||||
{
|
||||
collectedEggCount = 60;
|
||||
}
|
||||
collectedEggCount -= wrongEggs; //true positive - negative egg count\
|
||||
totalMsg = "; Total Collected: ";
|
||||
total = "" + totalCollectedEggCount;
|
||||
|
||||
}
|
||||
announceTime("Game finished, duration: ", gameTime.getTime(false),type, amt, totalMsg, total);
|
||||
if (rewardWidget != null && rewardWidget.getText().contains(ENDGAME_REWARD_NEEDLE_TEXT) && gameTime != null)
|
||||
{
|
||||
if (config.waveTimes())
|
||||
announceTime("Game finished, duration: ", gameTime.getTime(false));
|
||||
if (config.showTotalRewards())
|
||||
announceSomething("Game Summary: " + "Total Runners: " + pointsList[0]
|
||||
+ "; Total Hp Replenished: " + pointsList[1]
|
||||
+ "; Total Wrong Heal Packs: " + pointsList[2]
|
||||
+ "; Total Eggs: " + pointsList[3]
|
||||
+ "; Total Failed attacks: " + pointsList[4]
|
||||
+ "; Total Honour Points: " + (80 + pointsList[5]));
|
||||
}
|
||||
Widget pointsWidget = client.getWidget(WidgetInfo.BA_RUNNERS_PASSED);
|
||||
if (!rewardWidget.getText().contains(ENDGAME_REWARD_NEEDLE_TEXT) && pointsWidget != null
|
||||
&& config.showSummaryOfPoints() && !hasAnnounced && client.getVar(Varbits.IN_GAME_BA) == 0)
|
||||
{
|
||||
announceSomething("Wave Points Summary: " + giveSummaryOfPoints());
|
||||
hasAnnounced = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
|
||||
public void onChatMessage(ChatMessage event)
|
||||
public void onChatMessage(ChatMessage chatMessage)
|
||||
{
|
||||
if (event.getType() == ChatMessageType.GAMEMESSAGE
|
||||
&& event.getMessage().startsWith("---- Wave:"))
|
||||
if (!chatMessage.getType().equals(ChatMessageType.GAMEMESSAGE))
|
||||
{
|
||||
String[] message = event.getMessage().split(" ");
|
||||
currentWave = message[BA_WAVE_NUM_INDEX];
|
||||
return;
|
||||
}
|
||||
int inGame = client.getVar(Varbits.IN_GAME_BA);
|
||||
if (inGameBit != inGame)
|
||||
return;
|
||||
final String message = chatMessage.getMessage().toLowerCase();
|
||||
final MessageNode messageNode = chatMessage.getMessageNode();
|
||||
final String nodeValue = Text.removeTags(messageNode.getValue());
|
||||
String recolored = null;
|
||||
if (chatMessage.getMessage().startsWith("---- Wave:"))
|
||||
{
|
||||
String[] tempMessage = chatMessage.getMessage().split(" ");
|
||||
currentWave = tempMessage[BA_WAVE_NUM_INDEX];
|
||||
collectedEggCount = 0;
|
||||
HpHealed = 0;
|
||||
|
||||
if (currentWave.equals(START_WAVE)) {
|
||||
positiveEggCount = 0;
|
||||
wrongEggs = 0;
|
||||
if (currentWave.equals(START_WAVE))
|
||||
{
|
||||
gameTime = new GameTimer();
|
||||
totalHpHealed = 0;
|
||||
totalCollectedEggCount = 0;
|
||||
} else if (gameTime != null) {
|
||||
pointsList = new int[]{0,0,0,0,0,0};
|
||||
}
|
||||
else if (gameTime != null)
|
||||
{
|
||||
gameTime.setWaveStartTime();
|
||||
}
|
||||
} else if (event.getType() == ChatMessageType.GAMEMESSAGE
|
||||
&& event.getMessage().contains("egg explode")) {
|
||||
wrongEggs --;
|
||||
} else if (event.getType() == ChatMessageType.GAMEMESSAGE
|
||||
&& event.getMessage().contains("healed")) {
|
||||
String message = event.getMessage();
|
||||
}
|
||||
if (chatMessage.getMessage().contains("exploded"))
|
||||
{
|
||||
wrongEggs++;
|
||||
positiveEggCount--;
|
||||
}
|
||||
if (chatMessage.getMessage().contains("You healed"))
|
||||
{
|
||||
String[] tokens = message.split(" ");
|
||||
if (Integer.parseInt(tokens[2]) > 0) {
|
||||
if (Integer.parseInt(tokens[2]) > 0)
|
||||
{
|
||||
int Hp = Integer.parseInt(tokens[2]);
|
||||
HpHealed += Hp;
|
||||
}
|
||||
}
|
||||
|
||||
if (message.contains("the wrong type of poisoned food to use"))
|
||||
{
|
||||
recolored = ColorUtil.wrapWithColorTag(nodeValue, config.wrongPoisonFoodTextColor());
|
||||
}
|
||||
if (recolored != null)
|
||||
{
|
||||
messageNode.setValue(recolored);
|
||||
chatMessageManager.update(messageNode);
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onGameTick(GameTick event) {
|
||||
if (client.getVar(Varbits.IN_GAME_BA) == 0 || client.getLocalPlayer() == null || overlay.getCurrentRound() != null) {
|
||||
public void onGameTick(GameTick event)
|
||||
{
|
||||
if (client.getVar(Varbits.IN_GAME_BA) == 0 || client.getLocalPlayer() == null || overlay.getCurrentRound() != null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
switch (client.getLocalPlayer().getPlayerComposition().getEquipmentId(KitType.CAPE)) {
|
||||
switch (client.getLocalPlayer().getPlayerComposition().getEquipmentId(KitType.CAPE))
|
||||
{
|
||||
case ItemID.ATTACKER_ICON:
|
||||
overlay.setCurrentRound(new Round(Role.ATTACKER));
|
||||
break;
|
||||
@@ -236,49 +282,35 @@ public class BarbarianAssaultPlugin extends Plugin {
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onVarbitChanged(VarbitChanged event) {
|
||||
public void onVarbitChanged(VarbitChanged event)
|
||||
{
|
||||
int inGame = client.getVar(Varbits.IN_GAME_BA);
|
||||
String amt,type,totalMsg,total;
|
||||
amt=type=totalMsg=total="";
|
||||
if (inGameBit != inGame) {
|
||||
if (inGameBit == 1) {
|
||||
|
||||
if (inGameBit != inGame)
|
||||
{
|
||||
if (inGameBit == 1)
|
||||
{
|
||||
overlay.setCurrentRound(null);
|
||||
|
||||
if (config.waveTimes() && gameTime != null) {
|
||||
totalCollectedEggCount += collectedEggCount;
|
||||
totalHpHealed += HpHealed;
|
||||
if (config.showHpCount() && HpHealed > 0) {
|
||||
amt = "" + HpHealed;
|
||||
type = "; Healed: ";
|
||||
totalMsg = "; Total Healed: ";
|
||||
total = ""+totalHpHealed;
|
||||
}
|
||||
else if (config.showEggCount() && collectedEggCount > 0) {
|
||||
amt = "" + collectedEggCount;
|
||||
type = "; Collected: ";
|
||||
totalMsg = "; Total Collected: ";
|
||||
total = ""+totalCollectedEggCount;
|
||||
}
|
||||
if (currentWave.equals("10"))
|
||||
{
|
||||
totalMsg=total="";
|
||||
}
|
||||
announceTime("Wave " + currentWave + " duration: ", gameTime.getTime(true), type, amt, totalMsg, total);
|
||||
if (config.waveTimes() && gameTime != null)
|
||||
{
|
||||
announceTime("Wave " + currentWave + " duration: ", gameTime.getTime(true));
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
hasAnnounced = false;
|
||||
}
|
||||
}
|
||||
|
||||
inGameBit = inGame;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onItemSpawned(ItemSpawned itemSpawned)
|
||||
{
|
||||
int itemId = itemSpawned.getItem().getId();
|
||||
WorldPoint worldPoint = itemSpawned.getTile().getWorldLocation();
|
||||
HashMap<WorldPoint, Integer> eggMap = getEggMap(itemId);
|
||||
|
||||
if (eggMap != null)
|
||||
{
|
||||
Integer existingQuantity = eggMap.putIfAbsent(worldPoint, 1);
|
||||
@@ -314,10 +346,96 @@ public class BarbarianAssaultPlugin extends Plugin {
|
||||
}
|
||||
if (isUnderPlayer(itemDespawned.getTile()))
|
||||
{
|
||||
collectedEggCount++;
|
||||
if (client.getLocalPlayer().getPlayerComposition().getEquipmentId(KitType.CAPE) == ItemID.COLLECTOR_ICON)
|
||||
{
|
||||
positiveEggCount++;
|
||||
if (positiveEggCount > 60)
|
||||
{
|
||||
positiveEggCount = 60;
|
||||
}
|
||||
collectedEggCount = positiveEggCount - wrongEggs; //true positive - negative egg count
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuEntryAdded(MenuEntryAdded event)
|
||||
{
|
||||
if (!config.highlightCollectorEggs())
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (overlay.getCurrentRound() == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (overlay.getCurrentRound().getRoundRole() != Role.COLLECTOR)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
String calledEgg = getCollectorHeardCall();
|
||||
String target = event.getTarget();
|
||||
String option = event.getOption();
|
||||
String targetClean = target.substring(target.indexOf('>') + 1);
|
||||
String optionClean = option.substring(option.indexOf('>') + 1);
|
||||
|
||||
if ("Take".equals(optionClean))
|
||||
{
|
||||
Color highlightColor = null;
|
||||
|
||||
if (calledEgg != null && calledEgg.startsWith(targetClean))
|
||||
{
|
||||
highlightColor = getEggColor(targetClean);
|
||||
}
|
||||
else if ("Yellow egg".equals(targetClean))
|
||||
{
|
||||
// Always show yellow egg
|
||||
highlightColor = Color.YELLOW;
|
||||
}
|
||||
|
||||
if (highlightColor != null)
|
||||
{
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
MenuEntry last = menuEntries[menuEntries.length - 1];
|
||||
last.setTarget(ColorUtil.prependColorTag(targetClean, highlightColor));
|
||||
client.setMenuEntries(menuEntries);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void announceSomething(String something)
|
||||
{
|
||||
final String chatMessage = new ChatMessageBuilder()
|
||||
.append(something)
|
||||
.build();
|
||||
chatMessageManager.queue(QueuedMessage.builder()
|
||||
.type(ChatMessageType.CONSOLE)
|
||||
.runeLiteFormattedMessage(chatMessage)
|
||||
.build());
|
||||
}
|
||||
|
||||
private String giveSummaryOfPoints()
|
||||
{
|
||||
StringBuilder message = new StringBuilder();
|
||||
for (int i = 0; i < WIDGETS.size(); i++)
|
||||
{
|
||||
Widget w = client.getWidget(WIDGETS.get(i));
|
||||
if (w != null && !w.getText().equals(""))
|
||||
{
|
||||
pointsList[i] += Integer.parseInt(w.getText());
|
||||
}
|
||||
else
|
||||
{
|
||||
log.info("widget null");
|
||||
}
|
||||
message.append(descriptions[i])
|
||||
.append(Integer.parseInt(w.getText()))
|
||||
.append("; ");
|
||||
}
|
||||
return message.toString();
|
||||
}
|
||||
|
||||
String getCollectorHeardCall()
|
||||
{
|
||||
Widget widget = client.getWidget(WidgetInfo.BA_COLL_HEARD_TEXT);
|
||||
@@ -331,6 +449,67 @@ public class BarbarianAssaultPlugin extends Plugin {
|
||||
return call;
|
||||
}
|
||||
|
||||
Map<WorldPoint, Integer> getCalledEggMap()
|
||||
{
|
||||
Map<WorldPoint, Integer> map;
|
||||
String calledEgg = getCollectorHeardCall();
|
||||
|
||||
if (calledEgg == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
switch (calledEgg)
|
||||
{
|
||||
case "Red eggs":
|
||||
map = redEggs;
|
||||
break;
|
||||
case "Green eggs":
|
||||
map = greenEggs;
|
||||
break;
|
||||
case "Blue eggs":
|
||||
map = blueEggs;
|
||||
break;
|
||||
default:
|
||||
map = null;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
static Color getEggColor(String str)
|
||||
{
|
||||
Color color;
|
||||
|
||||
if (str == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (str.startsWith("Red"))
|
||||
{
|
||||
color = Color.RED;
|
||||
}
|
||||
else if (str.startsWith("Green"))
|
||||
{
|
||||
color = Color.GREEN;
|
||||
}
|
||||
else if (str.startsWith("Blue"))
|
||||
{
|
||||
color = Color.CYAN;
|
||||
}
|
||||
else if (str.startsWith("Yellow"))
|
||||
{
|
||||
color = Color.YELLOW;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = null;
|
||||
}
|
||||
|
||||
return color;
|
||||
}
|
||||
|
||||
private HashMap<WorldPoint, Integer> getEggMap(int itemID)
|
||||
{
|
||||
switch (itemID)
|
||||
@@ -349,20 +528,13 @@ public class BarbarianAssaultPlugin extends Plugin {
|
||||
}
|
||||
|
||||
|
||||
private void announceTime(String preText, String time, String type, String amt, String totalMsg, String total) {
|
||||
private void announceTime(String preText, String time)
|
||||
{
|
||||
final String chatMessage = new ChatMessageBuilder()
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(preText)
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(time)
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(type)
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(amt)
|
||||
.append(ChatColorType.NORMAL)
|
||||
.append(totalMsg)
|
||||
.append(ChatColorType.HIGHLIGHT)
|
||||
.append(total)
|
||||
.build();
|
||||
|
||||
chatMessageManager.queue(QueuedMessage.builder()
|
||||
@@ -374,14 +546,15 @@ public class BarbarianAssaultPlugin extends Plugin {
|
||||
private boolean isEgg(int itemID)
|
||||
{
|
||||
if (itemID == ItemID.RED_EGG || itemID == ItemID.GREEN_EGG
|
||||
|| itemID == ItemID.BLUE_EGG || itemID == ItemID.YELLOW_EGG)
|
||||
|| itemID == ItemID.BLUE_EGG || itemID == ItemID.YELLOW_EGG)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean isUnderPlayer(Tile tile) {
|
||||
private boolean isUnderPlayer(Tile tile)
|
||||
{
|
||||
Player local = client.getLocalPlayer();
|
||||
if (local == null)
|
||||
{
|
||||
@@ -400,4 +573,4 @@ public class BarbarianAssaultPlugin extends Plugin {
|
||||
{
|
||||
return clockImage;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* Copyright (c) 2018, Cameron <https://github.com/noremac201>
|
||||
* Copyright (c) 2018, Jacob M <https://github.com/jacoblairm>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -120,4 +121,45 @@ public interface BAToolsConfig extends Config
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "prayerMetronome",
|
||||
name = "Prayer Metronome",
|
||||
description = "asd"
|
||||
)
|
||||
default boolean prayerMetronome()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "prayerMetronomeVolume",
|
||||
name = "Prayer Metronome Volume",
|
||||
description = "asd"
|
||||
)
|
||||
default int prayerMetronomeVolume()
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "attackStyles",
|
||||
name = "Attack Styles",
|
||||
description = "asd"
|
||||
)
|
||||
default boolean attackStyles()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@ConfigItem(
|
||||
keyName = "tagging",
|
||||
name = "Attack Tags",
|
||||
description = "asd"
|
||||
)
|
||||
default boolean tagging()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* Copyright (c) 2018, Woox <https://github.com/wooxsolo>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -69,57 +69,59 @@ public class BAToolsOverlay extends Overlay
|
||||
@Override
|
||||
public Dimension render(Graphics2D graphics)
|
||||
{
|
||||
if(!config.healerCodes())
|
||||
if(config.healerCodes())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
for (Healer healer : plugin.getHealers().values())
|
||||
{
|
||||
NPCComposition composition = healer.getNpc().getComposition();
|
||||
Color color = composition.getCombatLevel() > 1 ? YELLOW : ORANGE;
|
||||
if (composition.getConfigs() != null)
|
||||
{
|
||||
NPCComposition transformedComposition = composition.transform();
|
||||
if (transformedComposition == null)
|
||||
{
|
||||
color = GRAY;
|
||||
}
|
||||
else
|
||||
{
|
||||
composition = transformedComposition;
|
||||
}
|
||||
}
|
||||
int timeLeft = healer.getLastFoodTime() - (int) Duration.between(plugin.getWave_start(), Instant.now()).getSeconds();
|
||||
timeLeft = timeLeft < 1 ? 0 : timeLeft;
|
||||
|
||||
for (Healer healer : plugin.getHealers().values())
|
||||
{
|
||||
NPCComposition composition = healer.getNpc().getComposition();
|
||||
Color color = composition.getCombatLevel() > 1 ? YELLOW : ORANGE;
|
||||
if (composition.getConfigs() != null)
|
||||
{
|
||||
NPCComposition transformedComposition = composition.transform();
|
||||
if (transformedComposition == null)
|
||||
{
|
||||
color = GRAY;
|
||||
}
|
||||
else
|
||||
{
|
||||
composition = transformedComposition;
|
||||
}
|
||||
}
|
||||
int timeLeft = healer.getLastFoodTime() - (int)Duration.between(plugin.getWave_start(), Instant.now()).getSeconds();
|
||||
timeLeft = timeLeft < 1 ? 0 : timeLeft;
|
||||
|
||||
if(healer.getFoodRemaining() > 1)
|
||||
{
|
||||
color = GREEN;
|
||||
}
|
||||
else if(healer.getFoodRemaining() == 1)
|
||||
{
|
||||
if(timeLeft > 0)
|
||||
{
|
||||
color = RED;
|
||||
}
|
||||
else
|
||||
if (healer.getFoodRemaining() > 1)
|
||||
{
|
||||
color = GREEN;
|
||||
}
|
||||
else if (healer.getFoodRemaining() == 1)
|
||||
{
|
||||
if (timeLeft > 0)
|
||||
{
|
||||
color = RED;
|
||||
}
|
||||
else
|
||||
{
|
||||
color = GREEN;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
String text = String.format("%d %d",
|
||||
healer.getFoodRemaining(),
|
||||
timeLeft);
|
||||
|
||||
|
||||
OverlayUtil.renderActorOverlay(graphics, healer.getNpc(), text, color);
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
String text = String.format("%d %d",
|
||||
healer.getFoodRemaining(),
|
||||
timeLeft);
|
||||
|
||||
|
||||
|
||||
OverlayUtil.renderActorOverlay(graphics, healer.getNpc(), text, color);
|
||||
if(!config.eggBoi())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* Copyright (c) 2018, Cameron <https://github.com/noremac201>
|
||||
* Copyright (c) 2018, Jacob M <https://github.com/jacoblairm>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@@ -24,7 +25,11 @@
|
||||
*/
|
||||
package net.runelite.client.plugins.batools;
|
||||
|
||||
import net.runelite.client.eventbus.EventBus;
|
||||
import net.runelite.api.Item;
|
||||
import net.runelite.api.Prayer;
|
||||
import net.runelite.api.SoundEffectID;
|
||||
import net.runelite.api.Tile;
|
||||
import net.runelite.api.kit.KitType;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import com.google.inject.Provides;
|
||||
import java.awt.event.KeyEvent;
|
||||
@@ -59,6 +64,7 @@ import net.runelite.api.events.NpcDespawned;
|
||||
import net.runelite.api.events.NpcSpawned;
|
||||
import net.runelite.api.events.VarbitChanged;
|
||||
import net.runelite.api.events.WidgetLoaded;
|
||||
import net.runelite.api.events.WidgetHiddenChanged;
|
||||
import net.runelite.api.widgets.Widget;
|
||||
import net.runelite.api.widgets.WidgetID;
|
||||
import net.runelite.api.widgets.WidgetInfo;
|
||||
@@ -69,7 +75,6 @@ import net.runelite.client.input.KeyListener;
|
||||
import net.runelite.client.input.KeyManager;
|
||||
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;
|
||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||
import net.runelite.client.util.Text;
|
||||
@@ -78,8 +83,7 @@ import net.runelite.client.util.Text;
|
||||
@PluginDescriptor(
|
||||
name = "BA Tools",
|
||||
description = "Custom tools for Barbarian Assault",
|
||||
tags = {"minigame", "overlay", "timer"},
|
||||
type = PluginType.PVM
|
||||
tags = {"minigame", "overlay", "timer"}
|
||||
)
|
||||
public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
@@ -160,6 +164,85 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
shiftDown = false;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetHiddenChanged(WidgetHiddenChanged event)
|
||||
{
|
||||
Widget weapon = client.getWidget(593, 1);
|
||||
|
||||
if(config.attackStyles()
|
||||
&& weapon!=null
|
||||
&& inGameBit == 1
|
||||
&& (weapon.getText().contains("Crystal halberd") || weapon.getText().contains("Dragon claws"))
|
||||
&& client.getWidget(WidgetInfo.BA_ATK_LISTEN_TEXT)!=null)
|
||||
{
|
||||
String style = client.getWidget(WidgetInfo.BA_ATK_LISTEN_TEXT).getText();
|
||||
|
||||
if(style.contains("Defensive"))
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(false);
|
||||
}
|
||||
else if(style.contains("Aggressive"))
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(false);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(true);
|
||||
}
|
||||
else if(style.contains("Controlled"))
|
||||
{
|
||||
if(weapon.getText().contains("Crystal halberd"))
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(false);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(false);
|
||||
}
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(true);
|
||||
}
|
||||
else if(style.contains("Accurate") && weapon.getText().contains("Dragon claws"))
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(false);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(true);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(false);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(false);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(false);
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(false);
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if(client.getWidget(WidgetInfo.COMBAT_STYLE_ONE)!=null)
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_ONE).setHidden(false);
|
||||
}
|
||||
if(client.getWidget(WidgetInfo.COMBAT_STYLE_TWO)!=null)
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_TWO).setHidden(false);
|
||||
}
|
||||
if(client.getWidget(WidgetInfo.COMBAT_STYLE_THREE)!=null)
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_THREE).setHidden(false);
|
||||
}
|
||||
if(client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR)!=null)
|
||||
{
|
||||
client.getWidget(WidgetInfo.COMBAT_STYLE_FOUR).setHidden(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onWidgetLoaded(WidgetLoaded event)
|
||||
{
|
||||
@@ -205,13 +288,20 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
addCounter();
|
||||
}
|
||||
//counter.setText(String.valueOf(tickNum));
|
||||
counter.setCount(tickNum);
|
||||
if (config.defTimer())
|
||||
{
|
||||
log.info("" + tickNum++);
|
||||
}
|
||||
}
|
||||
|
||||
if(config.prayerMetronome() && isAnyPrayerActive())
|
||||
{
|
||||
for(int i = 0; i < config.prayerMetronomeVolume(); i++)
|
||||
{
|
||||
client.playSoundEffect(SoundEffectID.GE_INCREMENT_PLOP);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Widget getWidget()
|
||||
@@ -260,7 +350,7 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
@Subscribe
|
||||
public void onChatMessage(ChatMessage event)
|
||||
{
|
||||
if (event.getType() == ChatMessageType.CONSOLE
|
||||
if (event.getType() == ChatMessageType.GAMEMESSAGE
|
||||
&& event.getMessage().startsWith("---- Wave:"))
|
||||
{
|
||||
String[] message = event.getMessage().split(" ");
|
||||
@@ -383,7 +473,7 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
swap("quick-start", option, target, true);
|
||||
}
|
||||
|
||||
if (inGameBit == 1 && config.healerMenuOption() && event.getTarget().contains("Penance Healer"))
|
||||
if ((event.getTarget().contains("Penance Healer") || event.getTarget().contains("Penance Fighter") || event.getTarget().contains("Penance Ranger")))
|
||||
{
|
||||
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
@@ -421,12 +511,32 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
{
|
||||
correctEgg = entry;
|
||||
}
|
||||
else if (!entry.getOption().startsWith("Take"))
|
||||
{
|
||||
entries.add(entry);
|
||||
}
|
||||
}
|
||||
if (correctEgg != null)
|
||||
{
|
||||
entries.add(correctEgg);
|
||||
client.setMenuEntries(entries.toArray(new MenuEntry[entries.size()]));
|
||||
}
|
||||
client.setMenuEntries(entries.toArray(new MenuEntry[entries.size()]));
|
||||
}
|
||||
|
||||
if (client.getWidget(WidgetInfo.BA_ATK_LISTEN_TEXT) != null && inGameBit == 1 && config.attackStyles() && shiftDown)
|
||||
{
|
||||
MenuEntry[] menuEntries = client.getMenuEntries();
|
||||
MenuEntry correctEgg = null;
|
||||
entries.clear();
|
||||
|
||||
for (MenuEntry entry : menuEntries)
|
||||
{
|
||||
if (entry.getOption().contains("Walk here"))
|
||||
{
|
||||
entries.add(entry);
|
||||
}
|
||||
}
|
||||
client.setMenuEntries(entries.toArray(new MenuEntry[entries.size()]));
|
||||
}
|
||||
|
||||
if (client.getWidget(WidgetInfo.BA_HEAL_LISTEN_TEXT) != null && inGameBit == 1 && config.osHelp() && event.getTarget().equals("<col=ffff>Healer item machine") && shiftDown)
|
||||
@@ -455,30 +565,32 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
client.setMenuEntries(entries.toArray(new MenuEntry[entries.size()]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onMenuOptionClicked(MenuOptionClicked event)
|
||||
{
|
||||
if (!config.healerMenuOption() || !event.getMenuTarget().contains("Penance Healer") || client.getWidget(WidgetInfo.BA_HEAL_CALL_TEXT) == null)
|
||||
if(config.tagging() && (event.getMenuTarget().contains("Penance Ranger") || event.getMenuTarget().contains("Penance Fighter")))
|
||||
{
|
||||
return;
|
||||
String target = event.getMenuTarget();
|
||||
if (event.getMenuOption().contains("Attack"))
|
||||
{
|
||||
foodPressed.put(event.getId(), Instant.now());
|
||||
}
|
||||
log.info(target);
|
||||
}
|
||||
|
||||
String currentCall = client.getWidget(WidgetInfo.BA_HEAL_CALL_TEXT).getText();
|
||||
String target = event.getMenuTarget();
|
||||
|
||||
if ((currentCall.equals("Pois. Worms") && (target.contains("Poisoned worms") && target.contains("->") && target.contains("Penance Healer")))
|
||||
|| (currentCall.equals("Pois. Meat") && (target.contains("Poisoned meat") && target.contains("->") && target.contains("Penance Healer")))
|
||||
|| (currentCall.equals("Pois. Tofu") && (target.contains("Poisoned tofu") && target.contains("->") && target.contains("Penance Healer"))))
|
||||
if (config.healerMenuOption() && event.getMenuTarget().contains("Penance Healer"))
|
||||
{
|
||||
foodPressed.put(event.getId(), Instant.now());
|
||||
String target = event.getMenuTarget();
|
||||
if (target.contains("->"))
|
||||
{
|
||||
foodPressed.put(event.getId(), Instant.now());
|
||||
}
|
||||
}
|
||||
|
||||
if (target.contains("->") && target.contains("Penance Healer"))
|
||||
{
|
||||
foodPressed.put(event.getId(), Instant.now());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@@ -490,7 +602,6 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void addCounter()
|
||||
{
|
||||
if (!config.defTimer() || counter != null)
|
||||
@@ -641,4 +752,17 @@ public class BAToolsPlugin extends Plugin implements KeyListener
|
||||
shiftDown = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAnyPrayerActive()
|
||||
{
|
||||
for (Prayer pray : Prayer.values())//Check if any prayers are active
|
||||
{
|
||||
if (client.isPrayerActive(pray))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2018, https://runelitepl.us
|
||||
* Copyright (c) 2018, Cameron <https://github.com/noremac201>
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package net.runelite.client.plugins.tickcounter;
|
||||
|
||||
import net.runelite.client.config.Alpha;
|
||||
import net.runelite.client.config.Config;
|
||||
import net.runelite.client.config.ConfigGroup;
|
||||
import net.runelite.client.config.ConfigItem;
|
||||
@@ -18,6 +19,7 @@ public interface TickCounterConfig extends Config {
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "selfColor",
|
||||
name = "Your color",
|
||||
@@ -28,6 +30,7 @@ public interface TickCounterConfig extends Config {
|
||||
{
|
||||
return Color.green;
|
||||
}
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "totalColor",
|
||||
name = "Total color",
|
||||
@@ -38,6 +41,7 @@ public interface TickCounterConfig extends Config {
|
||||
{
|
||||
return Color.RED;
|
||||
}
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "otherColor",
|
||||
name = "Other players color",
|
||||
@@ -48,6 +52,7 @@ public interface TickCounterConfig extends Config {
|
||||
{
|
||||
return Color.white;
|
||||
}
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "bgColor",
|
||||
name = "Background color",
|
||||
@@ -58,6 +63,7 @@ public interface TickCounterConfig extends Config {
|
||||
{
|
||||
return new Color(70, 61, 50, 156);
|
||||
}
|
||||
@Alpha
|
||||
@ConfigItem(
|
||||
keyName = "titleColor",
|
||||
name = "Title color",
|
||||
|
||||
Reference in New Issue
Block a user