Refactor BA
This commit is contained in:
@@ -38,7 +38,10 @@ public interface BarbarianAssaultConfig extends Config
|
|||||||
description = "Show time to next call change",
|
description = "Show time to next call change",
|
||||||
position = 0
|
position = 0
|
||||||
)
|
)
|
||||||
default boolean showTimer() { return true; }
|
default boolean showTimer()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "waveTimes",
|
keyName = "waveTimes",
|
||||||
@@ -46,7 +49,10 @@ public interface BarbarianAssaultConfig extends Config
|
|||||||
description = "Displays wave and game duration",
|
description = "Displays wave and game duration",
|
||||||
position = 1
|
position = 1
|
||||||
)
|
)
|
||||||
default boolean waveTimes() { return true; }
|
default boolean waveTimes()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showEggCountMessage",
|
keyName = "showEggCountMessage",
|
||||||
@@ -54,7 +60,10 @@ public interface BarbarianAssaultConfig extends Config
|
|||||||
description = "Display egg count as collector after each wave",
|
description = "Display egg count as collector after each wave",
|
||||||
position = 2
|
position = 2
|
||||||
)
|
)
|
||||||
default boolean showEggCount() { return false; }
|
default boolean showEggCount()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showEggCountOverlay",
|
keyName = "showEggCountOverlay",
|
||||||
@@ -62,7 +71,10 @@ public interface BarbarianAssaultConfig extends Config
|
|||||||
description = "Display current egg count as collector",
|
description = "Display current egg count as collector",
|
||||||
position = 3
|
position = 3
|
||||||
)
|
)
|
||||||
default boolean showEggCountOverlay() { return false; }
|
default boolean showEggCountOverlay()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showHpCountMessage",
|
keyName = "showHpCountMessage",
|
||||||
@@ -70,7 +82,10 @@ public interface BarbarianAssaultConfig extends Config
|
|||||||
description = "Display healed count as healer after each wave",
|
description = "Display healed count as healer after each wave",
|
||||||
position = 4
|
position = 4
|
||||||
)
|
)
|
||||||
default boolean showHpCount() { return false; }
|
default boolean showHpCount()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showHpCountOverlay",
|
keyName = "showHpCountOverlay",
|
||||||
@@ -78,7 +93,10 @@ public interface BarbarianAssaultConfig extends Config
|
|||||||
description = "Display current healed count as healer",
|
description = "Display current healed count as healer",
|
||||||
position = 5
|
position = 5
|
||||||
)
|
)
|
||||||
default boolean showHpCountOverlay() { return false; }
|
default boolean showHpCountOverlay()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "highlightCollectorEggs",
|
keyName = "highlightCollectorEggs",
|
||||||
@@ -86,7 +104,10 @@ public interface BarbarianAssaultConfig extends Config
|
|||||||
description = "Highlight called egg colors",
|
description = "Highlight called egg colors",
|
||||||
position = 6
|
position = 6
|
||||||
)
|
)
|
||||||
default boolean highlightCollectorEggs() { return false; }
|
default boolean highlightCollectorEggs()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showTotalRewards",
|
keyName = "showTotalRewards",
|
||||||
@@ -94,7 +115,10 @@ public interface BarbarianAssaultConfig extends Config
|
|||||||
description = "Displays total eggs/healed hp and missed attacks/lost runners",
|
description = "Displays total eggs/healed hp and missed attacks/lost runners",
|
||||||
position = 7
|
position = 7
|
||||||
)
|
)
|
||||||
default boolean showTotalRewards(){ return false; };
|
default boolean showTotalRewards()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showSummaryOfPoints",
|
keyName = "showSummaryOfPoints",
|
||||||
@@ -102,7 +126,10 @@ public interface BarbarianAssaultConfig extends Config
|
|||||||
description = "Gives summary of advanced points breakdown in chat log",
|
description = "Gives summary of advanced points breakdown in chat log",
|
||||||
position = 8
|
position = 8
|
||||||
)
|
)
|
||||||
default boolean showSummaryOfPoints() { return false; };
|
default boolean showSummaryOfPoints()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "wrongPoisonFoodTextColor",
|
keyName = "wrongPoisonFoodTextColor",
|
||||||
@@ -110,7 +137,10 @@ public interface BarbarianAssaultConfig extends Config
|
|||||||
description = "Change healer wrong poison pack color",
|
description = "Change healer wrong poison pack color",
|
||||||
position = 9
|
position = 9
|
||||||
)
|
)
|
||||||
default Color wrongPoisonFoodTextColor() { return Color.BLACK;}
|
default Color wrongPoisonFoodTextColor()
|
||||||
|
{
|
||||||
|
return Color.BLACK;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "highlightItems",
|
keyName = "highlightItems",
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ import java.awt.Graphics2D;
|
|||||||
import java.awt.Polygon;
|
import java.awt.Polygon;
|
||||||
import java.awt.Rectangle;
|
import java.awt.Rectangle;
|
||||||
import java.awt.Stroke;
|
import java.awt.Stroke;
|
||||||
import java.util.Map;
|
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
@@ -124,13 +124,15 @@ class BarbarianAssaultOverlay extends Overlay
|
|||||||
graphics.drawImage(plugin.getClockImage(), spriteBounds.x, spriteBounds.y, null);
|
graphics.drawImage(plugin.getClockImage(), spriteBounds.x, spriteBounds.y, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == Role.COLLECTOR && config.highlightCollectorEggs()) {
|
if (role == Role.COLLECTOR && config.highlightCollectorEggs())
|
||||||
|
{
|
||||||
String heardCall = plugin.getCollectorHeardCall();
|
String heardCall = plugin.getCollectorHeardCall();
|
||||||
Color highlightColor = BarbarianAssaultPlugin.getEggColor(heardCall);
|
Color highlightColor = BarbarianAssaultPlugin.getEggColor(heardCall);
|
||||||
Map<WorldPoint, Integer> calledEggMap = plugin.getCalledEggMap();
|
Map<WorldPoint, Integer> calledEggMap = plugin.getCalledEggMap();
|
||||||
Map<WorldPoint, Integer> yellowEggMap = plugin.getYellowEggs();
|
Map<WorldPoint, Integer> yellowEggMap = plugin.getYellowEggs();
|
||||||
|
|
||||||
if (calledEggMap != null) {
|
if (calledEggMap != null)
|
||||||
|
{
|
||||||
renderEggLocations(graphics, calledEggMap, highlightColor);
|
renderEggLocations(graphics, calledEggMap, highlightColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -139,10 +141,12 @@ class BarbarianAssaultOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
Widget inventory = client.getWidget(WidgetInfo.INVENTORY);
|
Widget inventory = client.getWidget(WidgetInfo.INVENTORY);
|
||||||
|
|
||||||
if (config.highlightItems() && inventory != null && !inventory.isHidden() && ((role == Role.DEFENDER || role == Role.HEALER))) {
|
if (config.highlightItems() && inventory != null && !inventory.isHidden() && ((role == Role.DEFENDER || role == Role.HEALER)))
|
||||||
|
{
|
||||||
int listenItemId = plugin.getListenItemId(role.getListen());
|
int listenItemId = plugin.getListenItemId(role.getListen());
|
||||||
|
|
||||||
if (listenItemId != -1) {
|
if (listenItemId != -1)
|
||||||
|
{
|
||||||
Color color = config.highlightColor();
|
Color color = config.highlightColor();
|
||||||
BufferedImage highlight = ImageUtil.fillImage(itemManager.getImage(listenItemId), new Color(color.getRed(), color.getGreen(), color.getBlue(), 150));
|
BufferedImage highlight = ImageUtil.fillImage(itemManager.getImage(listenItemId), new Color(color.getRed(), color.getGreen(), color.getBlue(), 150));
|
||||||
|
|
||||||
|
|||||||
@@ -29,27 +29,35 @@ import com.google.inject.Provides;
|
|||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.Image;
|
import java.awt.Image;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
import lombok.AccessLevel;
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.runelite.api.*;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.coords.WorldPoint;
|
|
||||||
import net.runelite.api.events.*;
|
|
||||||
import net.runelite.api.kit.KitType;
|
|
||||||
import net.runelite.api.ChatMessageType;
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.EquipmentInventorySlot;
|
import net.runelite.api.EquipmentInventorySlot;
|
||||||
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.InventoryID;
|
import net.runelite.api.InventoryID;
|
||||||
import net.runelite.api.Item;
|
import net.runelite.api.Item;
|
||||||
import net.runelite.api.GameState;
|
|
||||||
import net.runelite.api.ItemID;
|
import net.runelite.api.ItemID;
|
||||||
|
import net.runelite.api.MenuEntry;
|
||||||
|
import net.runelite.api.MessageNode;
|
||||||
|
import net.runelite.api.Player;
|
||||||
|
import net.runelite.api.Tile;
|
||||||
import net.runelite.api.Varbits;
|
import net.runelite.api.Varbits;
|
||||||
|
import net.runelite.api.coords.WorldPoint;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.api.events.ItemContainerChanged;
|
import net.runelite.api.events.ItemContainerChanged;
|
||||||
|
import net.runelite.api.events.ItemDespawned;
|
||||||
|
import net.runelite.api.events.ItemSpawned;
|
||||||
|
import net.runelite.api.events.MenuEntryAdded;
|
||||||
import net.runelite.api.events.VarbitChanged;
|
import net.runelite.api.events.VarbitChanged;
|
||||||
import net.runelite.api.events.WidgetLoaded;
|
import net.runelite.api.events.WidgetLoaded;
|
||||||
import net.runelite.api.events.GameStateChanged;
|
import net.runelite.api.kit.KitType;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetID;
|
import net.runelite.api.widgets.WidgetID;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
@@ -67,7 +75,6 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
|||||||
import net.runelite.client.util.ColorUtil;
|
import net.runelite.client.util.ColorUtil;
|
||||||
import net.runelite.client.util.ImageUtil;
|
import net.runelite.client.util.ImageUtil;
|
||||||
import net.runelite.client.util.Text;
|
import net.runelite.client.util.Text;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
|
|
||||||
@@ -86,14 +93,19 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private int collectedEggCount = 0;
|
private int collectedEggCount = 0;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private int positiveEggCount = 0;
|
private int positiveEggCount = 0;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private int wrongEggs = 0;
|
private int wrongEggs = 0;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private int HpHealed = 0;
|
private int HpHealed = 0;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private int totalCollectedEggCount = 0;
|
private int totalCollectedEggCount = 0;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private int totalHpHealed = 0;
|
private int totalHpHealed = 0;
|
||||||
|
|
||||||
@@ -116,7 +128,6 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
@Getter(AccessLevel.PACKAGE)
|
@Getter(AccessLevel.PACKAGE)
|
||||||
private final HashMap<WorldPoint, Integer> yellowEggs = new HashMap<>();
|
private final HashMap<WorldPoint, Integer> yellowEggs = new HashMap<>();
|
||||||
|
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
@Getter
|
@Getter
|
||||||
private Client client;
|
private Client client;
|
||||||
@@ -133,39 +144,14 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private BarbarianAssaultOverlay overlay;
|
private BarbarianAssaultOverlay overlay;
|
||||||
|
|
||||||
private final ImmutableList<WidgetInfo> WIDGETS = ImmutableList.of(
|
|
||||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS,
|
|
||||||
WidgetInfo.BA_RUNNERS_PASSED,
|
|
||||||
WidgetInfo.BA_EGGS_COLLECTED,
|
|
||||||
WidgetInfo.BA_HITPOINTS_REPLENISHED,
|
|
||||||
WidgetInfo.BA_WRONG_POISON_PACKS,
|
|
||||||
WidgetInfo.BA_HONOUR_POINTS_REWARD
|
|
||||||
);
|
|
||||||
private final ImmutableList<WidgetInfo> POINTSWIDGETS = ImmutableList.of(
|
|
||||||
//base
|
|
||||||
WidgetInfo.BA_BASE_POINTS,
|
|
||||||
//att
|
|
||||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS_POINTS,
|
|
||||||
WidgetInfo.BA_RANGERS_KILLED,
|
|
||||||
WidgetInfo.BA_FIGHTERS_KILLED,
|
|
||||||
//def
|
|
||||||
WidgetInfo.BA_RUNNERS_PASSED_POINTS,
|
|
||||||
WidgetInfo.BA_RUNNERS_KILLED,
|
|
||||||
//coll
|
|
||||||
WidgetInfo.BA_EGGS_COLLECTED_POINTS,
|
|
||||||
//heal
|
|
||||||
WidgetInfo.BA_HEALERS_KILLED,
|
|
||||||
WidgetInfo.BA_HITPOINTS_REPLENISHED_POINTS,
|
|
||||||
WidgetInfo.BA_WRONG_POISON_PACKS_POINTS
|
|
||||||
);
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
BarbarianAssaultConfig provideConfig(ConfigManager configManager)
|
BarbarianAssaultConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
return configManager.getConfig(BarbarianAssaultConfig.class);
|
return configManager.getConfig(BarbarianAssaultConfig.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Game game;
|
private Game game;
|
||||||
private Wave wave;
|
|
||||||
@Override
|
@Override
|
||||||
protected void startUp() throws Exception
|
protected void startUp() throws Exception
|
||||||
{
|
{
|
||||||
@@ -202,12 +188,14 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
if (event.getGroupId() == WidgetID.BA_REWARD_GROUP_ID)
|
if (event.getGroupId() == WidgetID.BA_REWARD_GROUP_ID)
|
||||||
{
|
{
|
||||||
wave = new Wave(client);
|
Wave wave = new Wave(client);
|
||||||
Widget rewardWidget = client.getWidget(WidgetInfo.BA_REWARD_TEXT);
|
Widget rewardWidget = client.getWidget(WidgetInfo.BA_REWARD_TEXT);
|
||||||
if (rewardWidget != null && rewardWidget.getText().contains(ENDGAME_REWARD_NEEDLE_TEXT) && gameTime != null)
|
if (rewardWidget != null && rewardWidget.getText().contains(ENDGAME_REWARD_NEEDLE_TEXT) && gameTime != null)
|
||||||
{
|
{
|
||||||
if (config.waveTimes())
|
if (config.waveTimes())
|
||||||
|
{
|
||||||
announceTime("Game finished, duration: ", gameTime.getTime(false));
|
announceTime("Game finished, duration: ", gameTime.getTime(false));
|
||||||
|
}
|
||||||
if (config.showTotalRewards())
|
if (config.showTotalRewards())
|
||||||
{
|
{
|
||||||
announceSomething(game.getGameSummary());
|
announceSomething(game.getGameSummary());
|
||||||
@@ -255,7 +243,9 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
int inGame = client.getVar(Varbits.IN_GAME_BA);
|
int inGame = client.getVar(Varbits.IN_GAME_BA);
|
||||||
if (inGameBit != inGame)
|
if (inGameBit != inGame)
|
||||||
|
{
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
final String message = chatMessage.getMessage().toLowerCase();
|
final String message = chatMessage.getMessage().toLowerCase();
|
||||||
final MessageNode messageNode = chatMessage.getMessageNode();
|
final MessageNode messageNode = chatMessage.getMessageNode();
|
||||||
final String nodeValue = Text.removeTags(messageNode.getValue());
|
final String nodeValue = Text.removeTags(messageNode.getValue());
|
||||||
@@ -368,6 +358,7 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
|
|
||||||
inGameBit = inGame;
|
inGameBit = inGame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onItemSpawned(ItemSpawned itemSpawned)
|
public void onItemSpawned(ItemSpawned itemSpawned)
|
||||||
{
|
{
|
||||||
@@ -584,12 +575,8 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
|
|
||||||
private boolean isEgg(int itemID)
|
private boolean isEgg(int itemID)
|
||||||
{
|
{
|
||||||
if (itemID == ItemID.RED_EGG || itemID == ItemID.GREEN_EGG
|
return 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)
|
||||||
@@ -616,12 +603,12 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
return font;
|
return font;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Image getClockImage()
|
Image getClockImage()
|
||||||
{
|
{
|
||||||
return clockImage;
|
return clockImage;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getListenItemId(WidgetInfo listenInfo)
|
int getListenItemId(WidgetInfo listenInfo)
|
||||||
{
|
{
|
||||||
Widget listenWidget = client.getWidget(listenInfo);
|
Widget listenWidget = client.getWidget(listenInfo);
|
||||||
|
|
||||||
|
|||||||
@@ -24,16 +24,14 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.barbarianassault;
|
package net.runelite.client.plugins.barbarianassault;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.util.ArrayList;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.events.ChatMessage;
|
import net.runelite.api.events.ChatMessage;
|
||||||
import net.runelite.client.chat.ChatColorType;
|
|
||||||
import net.runelite.client.chat.ChatMessageBuilder;
|
import net.runelite.client.chat.ChatMessageBuilder;
|
||||||
import net.runelite.client.eventbus.Subscribe;
|
import net.runelite.client.eventbus.Subscribe;
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public class Game
|
public class Game
|
||||||
{
|
{
|
||||||
@@ -61,11 +59,13 @@ public class Game
|
|||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
Game(Client client, ArrayList<Wave> waves)
|
Game(Client client, ArrayList<Wave> waves)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.waves = waves;
|
this.waves = waves;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onChatMessage(ChatMessage chatMessage)
|
public void onChatMessage(ChatMessage chatMessage)
|
||||||
{
|
{
|
||||||
@@ -82,6 +82,7 @@ public class Game
|
|||||||
totalAmounts = new int[6];
|
totalAmounts = new int[6];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatMessageBuilder getGameSummary()
|
ChatMessageBuilder getGameSummary()
|
||||||
{
|
{
|
||||||
int[] amountsList;
|
int[] amountsList;
|
||||||
@@ -94,13 +95,16 @@ public class Game
|
|||||||
amountsList = w.getWaveAmounts();
|
amountsList = w.getWaveAmounts();
|
||||||
pointsList = w.getWavePoints();
|
pointsList = w.getWavePoints();
|
||||||
otherRolesPointsList = w.getOtherRolesPointsList();
|
otherRolesPointsList = w.getOtherRolesPointsList();
|
||||||
for (int j = 0; j < totalAmounts.length; j++) {
|
for (int j = 0; j < totalAmounts.length; j++)
|
||||||
|
{
|
||||||
totalAmounts[j] += amountsList[j];
|
totalAmounts[j] += amountsList[j];
|
||||||
}
|
}
|
||||||
for (int k = 0; k < totalPoints.length; k++) {
|
for (int k = 0; k < totalPoints.length; k++)
|
||||||
|
{
|
||||||
totalPoints[k] += pointsList[k];
|
totalPoints[k] += pointsList[k];
|
||||||
}
|
}
|
||||||
for (int z = 0; z < otherRolesPoints.length; z++) {
|
for (int z = 0; z < otherRolesPoints.length; z++)
|
||||||
|
{
|
||||||
otherRolesPoints[z] += otherRolesPointsList[z];
|
otherRolesPoints[z] += otherRolesPointsList[z];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +137,7 @@ public class Game
|
|||||||
}
|
}
|
||||||
message.append(System.getProperty("line.separator"));
|
message.append(System.getProperty("line.separator"));
|
||||||
message.append("All roles points this game: ");
|
message.append("All roles points this game: ");
|
||||||
for(int i = 0; i < otherPointsDescriptions.length; i++)
|
for (int i = 0; i < otherPointsDescriptions.length; i++)
|
||||||
{
|
{
|
||||||
message.append(otherPointsDescriptions[i]);
|
message.append(otherPointsDescriptions[i]);
|
||||||
message.append(String.valueOf(otherRolesPoints[i]));
|
message.append(String.valueOf(otherRolesPoints[i]));
|
||||||
|
|||||||
@@ -36,10 +36,13 @@ enum Role
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final WidgetInfo listen;
|
private final WidgetInfo listen;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final WidgetInfo call;
|
private final WidgetInfo call;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final WidgetInfo roleText;
|
private final WidgetInfo roleText;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final WidgetInfo roleSprite;
|
private final WidgetInfo roleSprite;
|
||||||
|
|
||||||
|
|||||||
@@ -34,17 +34,22 @@ import net.runelite.api.Constants;
|
|||||||
class Round
|
class Round
|
||||||
{
|
{
|
||||||
private final Instant roundStartTime;
|
private final Instant roundStartTime;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private final Role roundRole;
|
private final Role roundRole;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private boolean runnersKilled;
|
private boolean runnersKilled;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private boolean rangersKilled;
|
private boolean rangersKilled;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private boolean healersKilled;
|
private boolean healersKilled;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
private boolean fightersKilled;
|
private boolean fightersKilled;
|
||||||
@@ -56,12 +61,7 @@ class Round
|
|||||||
this.roundStartTime = Instant.now().plusMillis(2 * Constants.GAME_TICK_LENGTH);
|
this.roundStartTime = Instant.now().plusMillis(2 * Constants.GAME_TICK_LENGTH);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getRoundTime()
|
long getTimeToChange()
|
||||||
{
|
|
||||||
return Duration.between(roundStartTime, Instant.now()).getSeconds();
|
|
||||||
}
|
|
||||||
|
|
||||||
public long getTimeToChange()
|
|
||||||
{
|
{
|
||||||
return 30 + (Duration.between(Instant.now(), roundStartTime).getSeconds() % 30);
|
return 30 + (Duration.between(Instant.now(), roundStartTime).getSeconds() % 30);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,15 +25,12 @@
|
|||||||
package net.runelite.client.plugins.barbarianassault;
|
package net.runelite.client.plugins.barbarianassault;
|
||||||
|
|
||||||
import com.google.common.collect.ImmutableList;
|
import com.google.common.collect.ImmutableList;
|
||||||
|
import java.awt.Color;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
import net.runelite.api.widgets.Widget;
|
import net.runelite.api.widgets.Widget;
|
||||||
import net.runelite.api.widgets.WidgetInfo;
|
import net.runelite.api.widgets.WidgetInfo;
|
||||||
import net.runelite.client.chat.ChatMessageBuilder;
|
import net.runelite.client.chat.ChatMessageBuilder;
|
||||||
import net.runelite.client.chat.ChatMessageManager;
|
|
||||||
|
|
||||||
import javax.inject.Inject;
|
|
||||||
import java.awt.*;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
class Wave
|
class Wave
|
||||||
@@ -48,18 +45,18 @@ class Wave
|
|||||||
WidgetInfo.BA_HONOUR_POINTS_REWARD
|
WidgetInfo.BA_HONOUR_POINTS_REWARD
|
||||||
);
|
);
|
||||||
private final ImmutableList<WidgetInfo> POINTSWIDGETS = ImmutableList.of(
|
private final ImmutableList<WidgetInfo> POINTSWIDGETS = ImmutableList.of(
|
||||||
//base
|
//base
|
||||||
WidgetInfo.BA_BASE_POINTS,
|
WidgetInfo.BA_BASE_POINTS,
|
||||||
//att
|
//att
|
||||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS_POINTS,
|
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS_POINTS,
|
||||||
WidgetInfo.BA_RANGERS_KILLED,
|
WidgetInfo.BA_RANGERS_KILLED,
|
||||||
WidgetInfo.BA_FIGHTERS_KILLED,
|
WidgetInfo.BA_FIGHTERS_KILLED,
|
||||||
//def
|
//def
|
||||||
WidgetInfo.BA_RUNNERS_PASSED_POINTS,
|
WidgetInfo.BA_RUNNERS_PASSED_POINTS,
|
||||||
WidgetInfo.BA_RUNNERS_KILLED,
|
WidgetInfo.BA_RUNNERS_KILLED,
|
||||||
//coll
|
//coll
|
||||||
WidgetInfo.BA_EGGS_COLLECTED_POINTS,
|
WidgetInfo.BA_EGGS_COLLECTED_POINTS,
|
||||||
//heal
|
//heal
|
||||||
WidgetInfo.BA_HEALERS_KILLED,
|
WidgetInfo.BA_HEALERS_KILLED,
|
||||||
WidgetInfo.BA_HITPOINTS_REPLENISHED_POINTS,
|
WidgetInfo.BA_HITPOINTS_REPLENISHED_POINTS,
|
||||||
WidgetInfo.BA_WRONG_POISON_PACKS_POINTS
|
WidgetInfo.BA_WRONG_POISON_PACKS_POINTS
|
||||||
@@ -82,29 +79,23 @@ class Wave
|
|||||||
" C: ",
|
" C: ",
|
||||||
" H: "
|
" H: "
|
||||||
};
|
};
|
||||||
|
|
||||||
Wave(Client client)
|
Wave(Client client)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWaveAmounts(int[] amounts)
|
void setWaveAmounts(int[] amounts)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < amounts.length; i++)
|
System.arraycopy(amounts, 0, waveAmounts, 0, amounts.length);
|
||||||
{
|
|
||||||
waveAmounts[i] = amounts[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWavePoints(int[] points, int[] otherRolesPoints)
|
void setWavePoints(int[] points, int[] otherRolesPoints)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < points.length; i++)
|
System.arraycopy(points, 0, wavePoints, 0, points.length);
|
||||||
{
|
System.arraycopy(otherRolesPoints, 0, otherRolesPointsList, 0, otherRolesPoints.length);
|
||||||
wavePoints[i] = points[i];
|
|
||||||
}
|
|
||||||
for (int i = 0; i < otherRolesPoints.length; i++)
|
|
||||||
{
|
|
||||||
otherRolesPointsList[i] = otherRolesPoints[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWaveAmounts()
|
void setWaveAmounts()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < WIDGETS.size(); i++)
|
for (int i = 0; i < WIDGETS.size(); i++)
|
||||||
@@ -116,6 +107,7 @@ class Wave
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void setWavePoints()
|
void setWavePoints()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < POINTSWIDGETS.size(); i++)
|
for (int i = 0; i < POINTSWIDGETS.size(); i++)
|
||||||
@@ -142,7 +134,7 @@ class Wave
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
wavePoints[5] = 0;
|
wavePoints[5] = 0;
|
||||||
for (int i = 0; i < wavePoints.length-1; i++)
|
for (int i = 0; i < wavePoints.length - 1; i++)
|
||||||
{
|
{
|
||||||
wavePoints[5] += wavePoints[i];
|
wavePoints[5] += wavePoints[i];
|
||||||
}
|
}
|
||||||
@@ -179,11 +171,12 @@ class Wave
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatMessageBuilder getWaveSummary()
|
ChatMessageBuilder getWaveSummary()
|
||||||
{
|
{
|
||||||
ChatMessageBuilder message = new ChatMessageBuilder();
|
ChatMessageBuilder message = new ChatMessageBuilder();
|
||||||
message.append("Wave points:");
|
message.append("Wave points:");
|
||||||
for(int i = 0; i < descriptions.length; i++)
|
for (int i = 0; i < descriptions.length; i++)
|
||||||
{
|
{
|
||||||
if (i != 4)
|
if (i != 4)
|
||||||
{
|
{
|
||||||
@@ -207,7 +200,7 @@ class Wave
|
|||||||
}
|
}
|
||||||
message.append(System.getProperty("line.separator"));
|
message.append(System.getProperty("line.separator"));
|
||||||
message.append("All roles points this wave: ");
|
message.append("All roles points this wave: ");
|
||||||
for(int i = 0; i < otherPointsDescriptions.length; i++)
|
for (int i = 0; i < otherPointsDescriptions.length; i++)
|
||||||
{
|
{
|
||||||
message.append(otherPointsDescriptions[i]);
|
message.append(otherPointsDescriptions[i]);
|
||||||
message.append(String.valueOf(otherRolesPointsList[i]));
|
message.append(String.valueOf(otherRolesPointsList[i]));
|
||||||
|
|||||||
Reference in New Issue
Block a user