Refactor BA
This commit is contained in:
@@ -38,85 +38,115 @@ 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",
|
||||||
name = "Show wave and game duration",
|
name = "Show wave and game duration",
|
||||||
description = "Displays wave and game duration",
|
description = "Displays wave and game duration",
|
||||||
position = 1
|
position = 1
|
||||||
)
|
|
||||||
default boolean waveTimes() { return true; }
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
keyName = "showEggCountMessage",
|
|
||||||
name = "Show count of eggs collected as collector.",
|
|
||||||
description = "Display egg count as collector after each wave",
|
|
||||||
position = 2
|
|
||||||
)
|
|
||||||
default boolean showEggCount() { return false; }
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
keyName = "showEggCountOverlay",
|
|
||||||
name = "Overlay of eggs counted",
|
|
||||||
description = "Display current egg count as collector",
|
|
||||||
position = 3
|
|
||||||
)
|
|
||||||
default boolean showEggCountOverlay() { return false; }
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
keyName = "showHpCountMessage",
|
|
||||||
name = "Show count of Hp healed as healer.",
|
|
||||||
description = "Display healed count as healer after each wave",
|
|
||||||
position = 4
|
|
||||||
)
|
|
||||||
default boolean showHpCount() { return false; }
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
keyName = "showHpCountOverlay",
|
|
||||||
name = "Overlay of Hp counted",
|
|
||||||
description = "Display current healed count as healer",
|
|
||||||
position = 5
|
|
||||||
)
|
)
|
||||||
default boolean showHpCountOverlay() { return false; }
|
default boolean waveTimes()
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "highlightCollectorEggs",
|
keyName = "showEggCountMessage",
|
||||||
name = "Highlight collector eggs",
|
name = "Show count of eggs collected as collector.",
|
||||||
description = "Highlight called egg colors",
|
description = "Display egg count as collector after each wave",
|
||||||
position = 6
|
position = 2
|
||||||
)
|
)
|
||||||
default boolean highlightCollectorEggs() { return false; }
|
default boolean showEggCount()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showTotalRewards",
|
keyName = "showEggCountOverlay",
|
||||||
name = "Summarize total reward points",
|
name = "Overlay of eggs counted",
|
||||||
description = "Displays total eggs/healed hp and missed attacks/lost runners",
|
description = "Display current egg count as collector",
|
||||||
position = 7
|
position = 3
|
||||||
)
|
)
|
||||||
default boolean showTotalRewards(){ return false; };
|
default boolean showEggCountOverlay()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "showSummaryOfPoints",
|
keyName = "showHpCountMessage",
|
||||||
name = "Display summary of advanced points",
|
name = "Show count of Hp healed as healer.",
|
||||||
description = "Gives summary of advanced points breakdown in chat log",
|
description = "Display healed count as healer after each wave",
|
||||||
position = 8
|
position = 4
|
||||||
)
|
|
||||||
default boolean showSummaryOfPoints() { return false; };
|
|
||||||
|
|
||||||
@ConfigItem(
|
|
||||||
keyName = "wrongPoisonFoodTextColor",
|
|
||||||
name = "Change healer wrong poison pack color",
|
|
||||||
description = "Change healer wrong poison pack color",
|
|
||||||
position = 9
|
|
||||||
)
|
)
|
||||||
default Color wrongPoisonFoodTextColor() { return Color.BLACK;}
|
default boolean showHpCount()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "highlightItems",
|
keyName = "showHpCountOverlay",
|
||||||
name = "Highlight called poison/bait",
|
name = "Overlay of Hp counted",
|
||||||
description = "Highlights the poison or bait that was called by your teammate",
|
description = "Display current healed count as healer",
|
||||||
position = 10
|
position = 5
|
||||||
|
)
|
||||||
|
default boolean showHpCountOverlay()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "highlightCollectorEggs",
|
||||||
|
name = "Highlight collector eggs",
|
||||||
|
description = "Highlight called egg colors",
|
||||||
|
position = 6
|
||||||
|
)
|
||||||
|
default boolean highlightCollectorEggs()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "showTotalRewards",
|
||||||
|
name = "Summarize total reward points",
|
||||||
|
description = "Displays total eggs/healed hp and missed attacks/lost runners",
|
||||||
|
position = 7
|
||||||
|
)
|
||||||
|
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 = 8
|
||||||
|
)
|
||||||
|
default boolean showSummaryOfPoints()
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "wrongPoisonFoodTextColor",
|
||||||
|
name = "Change healer wrong poison pack color",
|
||||||
|
description = "Change healer wrong poison pack color",
|
||||||
|
position = 9
|
||||||
|
)
|
||||||
|
default Color wrongPoisonFoodTextColor()
|
||||||
|
{
|
||||||
|
return Color.BLACK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
keyName = "highlightItems",
|
||||||
|
name = "Highlight called poison/bait",
|
||||||
|
description = "Highlights the poison or bait that was called by your teammate",
|
||||||
|
position = 10
|
||||||
)
|
)
|
||||||
default boolean highlightItems()
|
default boolean highlightItems()
|
||||||
{
|
{
|
||||||
@@ -124,10 +154,10 @@ public interface BarbarianAssaultConfig extends Config
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ConfigItem(
|
@ConfigItem(
|
||||||
keyName = "highlightColor",
|
keyName = "highlightColor",
|
||||||
name = "Highlight color",
|
name = "Highlight color",
|
||||||
description = "Configures the color to highlight the called poison/bait",
|
description = "Configures the color to highlight the called poison/bait",
|
||||||
position = 11
|
position = 11
|
||||||
)
|
)
|
||||||
default Color highlightColor()
|
default Color highlightColor()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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;
|
||||||
@@ -60,9 +60,9 @@ import net.runelite.client.util.ImageUtil;
|
|||||||
class BarbarianAssaultOverlay extends Overlay
|
class BarbarianAssaultOverlay extends Overlay
|
||||||
{
|
{
|
||||||
private static final int MAX_EGG_DISTANCE = 2500;
|
private static final int MAX_EGG_DISTANCE = 2500;
|
||||||
private final int HEALTH_BAR_HEIGHT = 20;
|
private final int HEALTH_BAR_HEIGHT = 20;
|
||||||
private final Color HEALTH_BAR_COLOR = new Color(225, 35, 0, 125);
|
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 Color BACKGROUND = new Color(0, 0, 0, 150);
|
||||||
private static final int OFFSET_Z = 20;
|
private static final int OFFSET_Z = 20;
|
||||||
|
|
||||||
private final Client client;
|
private final Client client;
|
||||||
@@ -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));
|
||||||
|
|
||||||
@@ -156,47 +160,47 @@ class BarbarianAssaultOverlay extends Overlay
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (role == Role.HEALER)
|
if (role == Role.HEALER)
|
||||||
{
|
{
|
||||||
for (HealerTeam teammate : HealerTeam.values())
|
for (HealerTeam teammate : HealerTeam.values())
|
||||||
{
|
{
|
||||||
Widget widget = client.getWidget(teammate.getTeammate());
|
Widget widget = client.getWidget(teammate.getTeammate());
|
||||||
if (widget == null)
|
if (widget == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
String[] teammateHealth = widget.getText().split(" / ");
|
String[] teammateHealth = widget.getText().split(" / ");
|
||||||
final int curHealth = Integer.parseInt(teammateHealth[0]);
|
final int curHealth = Integer.parseInt(teammateHealth[0]);
|
||||||
final int maxHealth = Integer.parseInt(teammateHealth[1]);
|
final int maxHealth = Integer.parseInt(teammateHealth[1]);
|
||||||
|
|
||||||
int width = teammate.getWidth();
|
int width = teammate.getWidth();
|
||||||
final int filledWidth = getBarWidth(maxHealth, curHealth, width);
|
final int filledWidth = getBarWidth(maxHealth, curHealth, width);
|
||||||
|
|
||||||
int offsetX = teammate.getOffset().getX();
|
int offsetX = teammate.getOffset().getX();
|
||||||
int offsetY = teammate.getOffset().getY();
|
int offsetY = teammate.getOffset().getY();
|
||||||
int x = widget.getCanvasLocation().getX() - offsetX;
|
int x = widget.getCanvasLocation().getX() - offsetX;
|
||||||
int y = widget.getCanvasLocation().getY() - offsetY;
|
int y = widget.getCanvasLocation().getY() - offsetY;
|
||||||
|
|
||||||
graphics.setColor(HEALTH_BAR_COLOR);
|
graphics.setColor(HEALTH_BAR_COLOR);
|
||||||
graphics.fillRect(x, y, filledWidth, HEALTH_BAR_HEIGHT);
|
graphics.fillRect(x, y, filledWidth, HEALTH_BAR_HEIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int getBarWidth(int base, int current, int size)
|
private static int getBarWidth(int base, int current, int size)
|
||||||
{
|
{
|
||||||
final double ratio = (double) current / base;
|
final double ratio = (double) current / base;
|
||||||
|
|
||||||
if (ratio >= 1)
|
if (ratio >= 1)
|
||||||
{
|
{
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int) Math.round(ratio * size);
|
return (int) Math.round(ratio * size);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void renderEggLocations(Graphics2D graphics, Map<WorldPoint, Integer> eggMap, Color color)
|
private void renderEggLocations(Graphics2D graphics, Map<WorldPoint, Integer> eggMap, Color color)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -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,16 +75,15 @@ 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
|
||||||
|
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Barbarian Assault+",
|
name = "Barbarian Assault+",
|
||||||
description = "Custom barbarian assault plugin, use along with BA Tools",
|
description = "Custom barbarian assault plugin, use along with BA Tools",
|
||||||
tags = {"minigame", "overlay", "timer"},
|
tags = {"minigame", "overlay", "timer"},
|
||||||
type = PluginType.PVM // don't remove this, added this because our barbarian assault plugin is big time modified
|
type = PluginType.PVM // don't remove this, added this because our barbarian assault plugin is big time modified
|
||||||
)
|
)
|
||||||
public class BarbarianAssaultPlugin extends Plugin
|
public class BarbarianAssaultPlugin extends Plugin
|
||||||
{
|
{
|
||||||
@@ -86,19 +93,24 @@ 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;
|
||||||
|
|
||||||
private boolean hasAnnounced;
|
private boolean hasAnnounced;
|
||||||
private Font font;
|
private Font font;
|
||||||
private final Image clockImage = ImageUtil.getResourceStreamFromClass(getClass(), "clock.png");
|
private final Image clockImage = ImageUtil.getResourceStreamFromClass(getClass(), "clock.png");
|
||||||
private int inGameBit = 0;
|
private int inGameBit = 0;
|
||||||
private String currentWave = START_WAVE;
|
private String currentWave = START_WAVE;
|
||||||
@@ -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,45 +144,20 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private BarbarianAssaultOverlay overlay;
|
private BarbarianAssaultOverlay overlay;
|
||||||
|
|
||||||
private final ImmutableList<WidgetInfo> WIDGETS = ImmutableList.of(
|
@Provides
|
||||||
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
|
|
||||||
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
|
||||||
{
|
{
|
||||||
overlayManager.add(overlay);
|
overlayManager.add(overlay);
|
||||||
font = FontManager.getRunescapeFont()
|
font = FontManager.getRunescapeFont()
|
||||||
.deriveFont(Font.BOLD, 24);
|
.deriveFont(Font.BOLD, 24);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -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());
|
||||||
@@ -215,7 +203,7 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
}
|
}
|
||||||
Widget pointsWidget = client.getWidget(WidgetInfo.BA_RUNNERS_PASSED);
|
Widget pointsWidget = client.getWidget(WidgetInfo.BA_RUNNERS_PASSED);
|
||||||
if (!rewardWidget.getText().contains(ENDGAME_REWARD_NEEDLE_TEXT) && pointsWidget != null
|
if (!rewardWidget.getText().contains(ENDGAME_REWARD_NEEDLE_TEXT) && pointsWidget != null
|
||||||
&& config.showSummaryOfPoints() && !hasAnnounced && client.getVar(Varbits.IN_GAME_BA) == 0)
|
&& config.showSummaryOfPoints() && !hasAnnounced && client.getVar(Varbits.IN_GAME_BA) == 0)
|
||||||
{
|
{
|
||||||
wave.setWaveAmounts();
|
wave.setWaveAmounts();
|
||||||
wave.setWavePoints();
|
wave.setWavePoints();
|
||||||
@@ -249,13 +237,15 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
hasAnnounced = true;
|
hasAnnounced = true;
|
||||||
}
|
}
|
||||||
if (!chatMessage.getType().equals(ChatMessageType.GAMEMESSAGE))
|
if (!chatMessage.getType().equals(ChatMessageType.GAMEMESSAGE))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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,13 +358,14 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
|
|
||||||
inGameBit = inGame;
|
inGameBit = inGame;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
public void onItemSpawned(ItemSpawned itemSpawned)
|
public void onItemSpawned(ItemSpawned itemSpawned)
|
||||||
{
|
{
|
||||||
int itemId = itemSpawned.getItem().getId();
|
int itemId = itemSpawned.getItem().getId();
|
||||||
WorldPoint worldPoint = itemSpawned.getTile().getWorldLocation();
|
WorldPoint worldPoint = itemSpawned.getTile().getWorldLocation();
|
||||||
HashMap<WorldPoint, Integer> eggMap = getEggMap(itemId);
|
HashMap<WorldPoint, Integer> eggMap = getEggMap(itemId);
|
||||||
if (eggMap != null)
|
if (eggMap != null)
|
||||||
{
|
{
|
||||||
Integer existingQuantity = eggMap.putIfAbsent(worldPoint, 1);
|
Integer existingQuantity = eggMap.putIfAbsent(worldPoint, 1);
|
||||||
if (existingQuantity != null)
|
if (existingQuantity != null)
|
||||||
@@ -470,9 +461,9 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
private void announceSomething(final ChatMessageBuilder chatMessage)
|
private void announceSomething(final ChatMessageBuilder chatMessage)
|
||||||
{
|
{
|
||||||
chatMessageManager.queue(QueuedMessage.builder()
|
chatMessageManager.queue(QueuedMessage.builder()
|
||||||
.type(ChatMessageType.CONSOLE)
|
.type(ChatMessageType.CONSOLE)
|
||||||
.runeLiteFormattedMessage(chatMessage.build())
|
.runeLiteFormattedMessage(chatMessage.build())
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
String getCollectorHeardCall()
|
String getCollectorHeardCall()
|
||||||
@@ -570,26 +561,22 @@ public class BarbarianAssaultPlugin extends Plugin
|
|||||||
private void announceTime(String preText, String time)
|
private void announceTime(String preText, String time)
|
||||||
{
|
{
|
||||||
final String chatMessage = new ChatMessageBuilder()
|
final String chatMessage = new ChatMessageBuilder()
|
||||||
.append(ChatColorType.NORMAL)
|
.append(ChatColorType.NORMAL)
|
||||||
.append(preText)
|
.append(preText)
|
||||||
.append(ChatColorType.HIGHLIGHT)
|
.append(ChatColorType.HIGHLIGHT)
|
||||||
.append(time)
|
.append(time)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
chatMessageManager.queue(QueuedMessage.builder()
|
chatMessageManager.queue(QueuedMessage.builder()
|
||||||
.type(ChatMessageType.CONSOLE)
|
.type(ChatMessageType.CONSOLE)
|
||||||
.runeLiteFormattedMessage(chatMessage)
|
.runeLiteFormattedMessage(chatMessage)
|
||||||
.build());
|
.build());
|
||||||
}
|
}
|
||||||
|
|
||||||
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,120 +24,124 @@
|
|||||||
*/
|
*/
|
||||||
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
|
||||||
{
|
{
|
||||||
private Client client;
|
private Client client;
|
||||||
private String currentWave;
|
private String currentWave;
|
||||||
private ArrayList<Wave> waves = new ArrayList<>();
|
private ArrayList<Wave> waves = new ArrayList<>();
|
||||||
private String[] totalDescriptions = {
|
private String[] totalDescriptions = {
|
||||||
"A: ",
|
"A: ",
|
||||||
"; D: ",
|
"; D: ",
|
||||||
"; C: ",
|
"; C: ",
|
||||||
"; Vial: ",
|
"; Vial: ",
|
||||||
"; H packs: ",
|
"; H packs: ",
|
||||||
"; Total: "};
|
"; Total: "};
|
||||||
private String[] otherPointsDescriptions = {
|
private String[] otherPointsDescriptions = {
|
||||||
" A: ",
|
" A: ",
|
||||||
"; D: ",
|
"; D: ",
|
||||||
"; C: ",
|
"; C: ",
|
||||||
"; H: "
|
"; H: "
|
||||||
};
|
};
|
||||||
private int[] totalPoints = new int[6];
|
private int[] totalPoints = new int[6];
|
||||||
private int[] totalAmounts = new int[6];
|
private int[] totalAmounts = new int[6];
|
||||||
private int[] otherRolesPoints = new int[4];
|
private int[] otherRolesPoints = new int[4];
|
||||||
|
|
||||||
Game(Client client)
|
Game(Client client)
|
||||||
{
|
{
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
Game(Client client, ArrayList<Wave> waves)
|
|
||||||
{
|
Game(Client client, ArrayList<Wave> waves)
|
||||||
this.client = client;
|
{
|
||||||
this.waves = waves;
|
this.client = client;
|
||||||
}
|
this.waves = waves;
|
||||||
@Subscribe
|
}
|
||||||
public void onChatMessage(ChatMessage chatMessage)
|
|
||||||
{
|
@Subscribe
|
||||||
if (chatMessage.getMessage().startsWith("---- Wave:"))
|
public void onChatMessage(ChatMessage chatMessage)
|
||||||
{
|
{
|
||||||
String[] tempMessage = chatMessage.getMessage().split(" ");
|
if (chatMessage.getMessage().startsWith("---- Wave:"))
|
||||||
currentWave = tempMessage[2];
|
{
|
||||||
String[] temp = currentWave.split(" ");
|
String[] tempMessage = chatMessage.getMessage().split(" ");
|
||||||
}
|
currentWave = tempMessage[2];
|
||||||
if (currentWave.equals("1"))
|
String[] temp = currentWave.split(" ");
|
||||||
{
|
}
|
||||||
waves = null;
|
if (currentWave.equals("1"))
|
||||||
totalPoints = new int[6];
|
{
|
||||||
totalAmounts = new int[6];
|
waves = null;
|
||||||
}
|
totalPoints = new int[6];
|
||||||
}
|
totalAmounts = new int[6];
|
||||||
ChatMessageBuilder getGameSummary()
|
}
|
||||||
{
|
}
|
||||||
int[] amountsList;
|
|
||||||
int[] pointsList;
|
ChatMessageBuilder getGameSummary()
|
||||||
int[] otherRolesPointsList;
|
{
|
||||||
ChatMessageBuilder message = new ChatMessageBuilder();
|
int[] amountsList;
|
||||||
message.append("Round points: ");
|
int[] pointsList;
|
||||||
for (Wave w : waves)
|
int[] otherRolesPointsList;
|
||||||
{
|
ChatMessageBuilder message = new ChatMessageBuilder();
|
||||||
amountsList = w.getWaveAmounts();
|
message.append("Round points: ");
|
||||||
pointsList = w.getWavePoints();
|
for (Wave w : waves)
|
||||||
otherRolesPointsList = w.getOtherRolesPointsList();
|
{
|
||||||
for (int j = 0; j < totalAmounts.length; j++) {
|
amountsList = w.getWaveAmounts();
|
||||||
totalAmounts[j] += amountsList[j];
|
pointsList = w.getWavePoints();
|
||||||
}
|
otherRolesPointsList = w.getOtherRolesPointsList();
|
||||||
for (int k = 0; k < totalPoints.length; k++) {
|
for (int j = 0; j < totalAmounts.length; j++)
|
||||||
totalPoints[k] += pointsList[k];
|
{
|
||||||
}
|
totalAmounts[j] += amountsList[j];
|
||||||
for (int z = 0; z < otherRolesPoints.length; z++) {
|
}
|
||||||
otherRolesPoints[z] += otherRolesPointsList[z];
|
for (int k = 0; k < totalPoints.length; k++)
|
||||||
}
|
{
|
||||||
}
|
totalPoints[k] += pointsList[k];
|
||||||
for (int i = 0; i < otherRolesPoints.length; i++)
|
}
|
||||||
{
|
for (int z = 0; z < otherRolesPoints.length; z++)
|
||||||
otherRolesPoints[i] += 80;
|
{
|
||||||
}
|
otherRolesPoints[z] += otherRolesPointsList[z];
|
||||||
totalAmounts[5] += 80;
|
}
|
||||||
for (int i = 0; i < totalDescriptions.length; i++)
|
}
|
||||||
{
|
for (int i = 0; i < otherRolesPoints.length; i++)
|
||||||
if (i != 4)
|
{
|
||||||
{
|
otherRolesPoints[i] += 80;
|
||||||
message.append(totalDescriptions[i]);
|
}
|
||||||
message.append(String.valueOf(totalAmounts[i]));
|
totalAmounts[5] += 80;
|
||||||
message.append("(");
|
for (int i = 0; i < totalDescriptions.length; i++)
|
||||||
if (totalPoints[i] < 0)
|
{
|
||||||
{
|
if (i != 4)
|
||||||
message.append(Color.RED, String.valueOf(totalPoints[i]));
|
{
|
||||||
}
|
message.append(totalDescriptions[i]);
|
||||||
else if (totalPoints[i] > 0)
|
message.append(String.valueOf(totalAmounts[i]));
|
||||||
{
|
message.append("(");
|
||||||
message.append(Color.BLUE, String.valueOf(totalPoints[i]));
|
if (totalPoints[i] < 0)
|
||||||
}
|
{
|
||||||
else
|
message.append(Color.RED, String.valueOf(totalPoints[i]));
|
||||||
{
|
}
|
||||||
message.append(String.valueOf(totalPoints[i]));
|
else if (totalPoints[i] > 0)
|
||||||
}
|
{
|
||||||
message.append(")");
|
message.append(Color.BLUE, String.valueOf(totalPoints[i]));
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
message.append(System.getProperty("line.separator"));
|
{
|
||||||
message.append("All roles points this game: ");
|
message.append(String.valueOf(totalPoints[i]));
|
||||||
for(int i = 0; i < otherPointsDescriptions.length; i++)
|
}
|
||||||
{
|
message.append(")");
|
||||||
message.append(otherPointsDescriptions[i]);
|
}
|
||||||
message.append(String.valueOf(otherRolesPoints[i]));
|
}
|
||||||
}
|
message.append(System.getProperty("line.separator"));
|
||||||
return message;
|
message.append("All roles points this game: ");
|
||||||
}
|
for (int i = 0; i < otherPointsDescriptions.length; i++)
|
||||||
|
{
|
||||||
|
message.append(otherPointsDescriptions[i]);
|
||||||
|
message.append(String.valueOf(otherRolesPoints[i]));
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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,193 +25,186 @@
|
|||||||
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
|
||||||
{
|
{
|
||||||
private Client client;
|
private Client client;
|
||||||
private final ImmutableList<WidgetInfo> WIDGETS = ImmutableList.of(
|
private final ImmutableList<WidgetInfo> WIDGETS = ImmutableList.of(
|
||||||
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS,
|
WidgetInfo.BA_FAILED_ATTACKER_ATTACKS,
|
||||||
WidgetInfo.BA_RUNNERS_PASSED,
|
WidgetInfo.BA_RUNNERS_PASSED,
|
||||||
WidgetInfo.BA_EGGS_COLLECTED,
|
WidgetInfo.BA_EGGS_COLLECTED,
|
||||||
WidgetInfo.BA_HITPOINTS_REPLENISHED,
|
WidgetInfo.BA_HITPOINTS_REPLENISHED,
|
||||||
WidgetInfo.BA_WRONG_POISON_PACKS,
|
WidgetInfo.BA_WRONG_POISON_PACKS,
|
||||||
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
|
||||||
);
|
);
|
||||||
private int[] waveAmounts = new int[6];
|
private int[] waveAmounts = new int[6];
|
||||||
private int[] allPointsList = new int[10];
|
private int[] allPointsList = new int[10];
|
||||||
private int[] wavePoints = new int[6];
|
private int[] wavePoints = new int[6];
|
||||||
private int[] otherRolesPointsList = new int[4];
|
private int[] otherRolesPointsList = new int[4];
|
||||||
private String[] descriptions = {
|
private String[] descriptions = {
|
||||||
" A: ",
|
" A: ",
|
||||||
"; D: ",
|
"; D: ",
|
||||||
"; C: ",
|
"; C: ",
|
||||||
"; Vial: ",
|
"; Vial: ",
|
||||||
"; H packs: ",
|
"; H packs: ",
|
||||||
"; Total: "};
|
"; Total: "};
|
||||||
|
|
||||||
private String[] otherPointsDescriptions = {
|
private String[] otherPointsDescriptions = {
|
||||||
" A: ",
|
" A: ",
|
||||||
" D: ",
|
" D: ",
|
||||||
" C: ",
|
" C: ",
|
||||||
" H: "
|
" H: "
|
||||||
};
|
};
|
||||||
Wave(Client client)
|
|
||||||
{
|
|
||||||
this.client = client;
|
|
||||||
}
|
|
||||||
void setWaveAmounts(int[] amounts)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < amounts.length; i++)
|
|
||||||
{
|
|
||||||
waveAmounts[i] = amounts[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void setWavePoints(int[] points, int[] otherRolesPoints)
|
Wave(Client client)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < points.length; i++)
|
this.client = client;
|
||||||
{
|
}
|
||||||
wavePoints[i] = points[i];
|
|
||||||
}
|
void setWaveAmounts(int[] amounts)
|
||||||
for (int i = 0; i < otherRolesPoints.length; i++)
|
{
|
||||||
{
|
System.arraycopy(amounts, 0, waveAmounts, 0, amounts.length);
|
||||||
otherRolesPointsList[i] = otherRolesPoints[i];
|
}
|
||||||
}
|
|
||||||
}
|
void setWavePoints(int[] points, int[] otherRolesPoints)
|
||||||
void setWaveAmounts()
|
{
|
||||||
{
|
System.arraycopy(points, 0, wavePoints, 0, points.length);
|
||||||
for (int i = 0; i < WIDGETS.size(); i++)
|
System.arraycopy(otherRolesPoints, 0, otherRolesPointsList, 0, otherRolesPoints.length);
|
||||||
{
|
}
|
||||||
Widget w = client.getWidget(WIDGETS.get(i));
|
|
||||||
if (w != null)
|
void setWaveAmounts()
|
||||||
{
|
{
|
||||||
waveAmounts[i] = Integer.parseInt(w.getText());
|
for (int i = 0; i < WIDGETS.size(); i++)
|
||||||
}
|
{
|
||||||
}
|
Widget w = client.getWidget(WIDGETS.get(i));
|
||||||
}
|
if (w != null)
|
||||||
void setWavePoints()
|
{
|
||||||
{
|
waveAmounts[i] = Integer.parseInt(w.getText());
|
||||||
for (int i = 0; i < POINTSWIDGETS.size(); i++)
|
}
|
||||||
{
|
}
|
||||||
Widget w = client.getWidget(POINTSWIDGETS.get(i));
|
}
|
||||||
allPointsList[i] = Integer.parseInt(w.getText());
|
|
||||||
switch (i)
|
void setWavePoints()
|
||||||
{
|
{
|
||||||
case 1:
|
for (int i = 0; i < POINTSWIDGETS.size(); i++)
|
||||||
wavePoints[0] += allPointsList[i];
|
{
|
||||||
break;
|
Widget w = client.getWidget(POINTSWIDGETS.get(i));
|
||||||
case 4:
|
allPointsList[i] = Integer.parseInt(w.getText());
|
||||||
wavePoints[1] += allPointsList[i];
|
switch (i)
|
||||||
break;
|
{
|
||||||
case 6:
|
case 1:
|
||||||
wavePoints[2] += allPointsList[i];
|
wavePoints[0] += allPointsList[i];
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 4:
|
||||||
case 9:
|
wavePoints[1] += allPointsList[i];
|
||||||
wavePoints[3] += allPointsList[i];
|
break;
|
||||||
break;
|
case 6:
|
||||||
default:
|
wavePoints[2] += allPointsList[i];
|
||||||
break;
|
break;
|
||||||
}
|
case 8:
|
||||||
}
|
case 9:
|
||||||
wavePoints[5] = 0;
|
wavePoints[3] += allPointsList[i];
|
||||||
for (int i = 0; i < wavePoints.length-1; i++)
|
break;
|
||||||
{
|
default:
|
||||||
wavePoints[5] += wavePoints[i];
|
break;
|
||||||
}
|
}
|
||||||
for (int i = 0; i < POINTSWIDGETS.size(); i++)
|
}
|
||||||
{
|
wavePoints[5] = 0;
|
||||||
Widget w = client.getWidget(POINTSWIDGETS.get(i));
|
for (int i = 0; i < wavePoints.length - 1; i++)
|
||||||
switch (i)
|
{
|
||||||
{
|
wavePoints[5] += wavePoints[i];
|
||||||
case 0:
|
}
|
||||||
otherRolesPointsList[0] += Integer.parseInt(w.getText());
|
for (int i = 0; i < POINTSWIDGETS.size(); i++)
|
||||||
otherRolesPointsList[1] += Integer.parseInt(w.getText());
|
{
|
||||||
otherRolesPointsList[2] += Integer.parseInt(w.getText());
|
Widget w = client.getWidget(POINTSWIDGETS.get(i));
|
||||||
otherRolesPointsList[3] += Integer.parseInt(w.getText());
|
switch (i)
|
||||||
break;
|
{
|
||||||
case 1:
|
case 0:
|
||||||
case 2:
|
otherRolesPointsList[0] += Integer.parseInt(w.getText());
|
||||||
case 3:
|
otherRolesPointsList[1] += Integer.parseInt(w.getText());
|
||||||
otherRolesPointsList[0] += Integer.parseInt(w.getText());
|
otherRolesPointsList[2] += Integer.parseInt(w.getText());
|
||||||
break;
|
otherRolesPointsList[3] += Integer.parseInt(w.getText());
|
||||||
case 4:
|
break;
|
||||||
case 5:
|
case 1:
|
||||||
otherRolesPointsList[1] += Integer.parseInt(w.getText());
|
case 2:
|
||||||
break;
|
case 3:
|
||||||
case 6:
|
otherRolesPointsList[0] += Integer.parseInt(w.getText());
|
||||||
otherRolesPointsList[2] += Integer.parseInt(w.getText());
|
break;
|
||||||
break;
|
case 4:
|
||||||
case 7:
|
case 5:
|
||||||
case 8:
|
otherRolesPointsList[1] += Integer.parseInt(w.getText());
|
||||||
case 9:
|
break;
|
||||||
otherRolesPointsList[3] += Integer.parseInt(w.getText());
|
case 6:
|
||||||
break;
|
otherRolesPointsList[2] += Integer.parseInt(w.getText());
|
||||||
default:
|
break;
|
||||||
break;
|
case 7:
|
||||||
}
|
case 8:
|
||||||
}
|
case 9:
|
||||||
}
|
otherRolesPointsList[3] += Integer.parseInt(w.getText());
|
||||||
ChatMessageBuilder getWaveSummary()
|
break;
|
||||||
{
|
default:
|
||||||
ChatMessageBuilder message = new ChatMessageBuilder();
|
break;
|
||||||
message.append("Wave points:");
|
}
|
||||||
for(int i = 0; i < descriptions.length; i++)
|
}
|
||||||
{
|
}
|
||||||
if (i != 4)
|
|
||||||
{
|
ChatMessageBuilder getWaveSummary()
|
||||||
message.append(descriptions[i]);
|
{
|
||||||
message.append(String.valueOf(waveAmounts[i]));
|
ChatMessageBuilder message = new ChatMessageBuilder();
|
||||||
message.append("(");
|
message.append("Wave points:");
|
||||||
if (wavePoints[i] < 0)
|
for (int i = 0; i < descriptions.length; i++)
|
||||||
{
|
{
|
||||||
message.append(Color.RED, String.valueOf(wavePoints[i]));
|
if (i != 4)
|
||||||
}
|
{
|
||||||
else if (wavePoints[i] > 0)
|
message.append(descriptions[i]);
|
||||||
{
|
message.append(String.valueOf(waveAmounts[i]));
|
||||||
message.append(Color.BLUE, String.valueOf(wavePoints[i]));
|
message.append("(");
|
||||||
}
|
if (wavePoints[i] < 0)
|
||||||
else
|
{
|
||||||
{
|
message.append(Color.RED, String.valueOf(wavePoints[i]));
|
||||||
message.append(String.valueOf(wavePoints[i]));
|
}
|
||||||
}
|
else if (wavePoints[i] > 0)
|
||||||
message.append(")");
|
{
|
||||||
}
|
message.append(Color.BLUE, String.valueOf(wavePoints[i]));
|
||||||
}
|
}
|
||||||
message.append(System.getProperty("line.separator"));
|
else
|
||||||
message.append("All roles points this wave: ");
|
{
|
||||||
for(int i = 0; i < otherPointsDescriptions.length; i++)
|
message.append(String.valueOf(wavePoints[i]));
|
||||||
{
|
}
|
||||||
message.append(otherPointsDescriptions[i]);
|
message.append(")");
|
||||||
message.append(String.valueOf(otherRolesPointsList[i]));
|
}
|
||||||
}
|
}
|
||||||
return message;
|
message.append(System.getProperty("line.separator"));
|
||||||
}
|
message.append("All roles points this wave: ");
|
||||||
|
for (int i = 0; i < otherPointsDescriptions.length; i++)
|
||||||
|
{
|
||||||
|
message.append(otherPointsDescriptions[i]);
|
||||||
|
message.append(String.valueOf(otherRolesPointsList[i]));
|
||||||
|
}
|
||||||
|
return message;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user