Gauntlet: various updates (#1246)

* Gauntlet: various updates

* Renamed config options.

* Added config option to turn off projectile overlay.

* added back the prayer infobox.

* added back counter display

* added back the option to display counters over the boss, in the info box, on both or never.

* update

* gauntlet: Unwrap if (can't be null)

* gauntlet: Access can be weaker

* ty 4 help ganom

ty 4 help ganom
This commit is contained in:
Kyleeld
2019-08-03 21:32:05 +01:00
committed by Ganom
parent f26154c4bc
commit 36050a2b3b
5 changed files with 414 additions and 115 deletions

View File

@@ -1,14 +1,34 @@
/*
* THIS SOFTWARE WRITTEN BY A KEYBOARD-WIELDING MONKEY BOI
* No rights reserved. Use, redistribute, and modify at your own discretion,
* and in accordance with Yagex and RuneLite guidelines.
* However, aforementioned monkey would prefer if you don't sell this plugin for profit.
* Good luck on your raids!
* Copyright (c) 2019, kThisIsCvpv <https://github.com/kThisIsCvpv>
* Copyright (c) 2019, ganom <https://github.com/Ganom>
* Copyright (c) 2019, kyle <https://github.com/Kyleeld>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.gauntlet;
import java.awt.Color;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@@ -19,6 +39,24 @@ import net.runelite.client.config.Stub;
public interface GauntletConfig extends Config
{
@Getter
@AllArgsConstructor
enum CounterDisplay
{
ONBOSS("On Boss"),
INFOBOX("Info Box"),
BOTH("Both"),
NONE("None");
private String name;
@Override
public String toString()
{
return getName();
}
}
@ConfigItem(
position = 0,
keyName = "resources",
@@ -33,13 +71,13 @@ public interface GauntletConfig extends Config
@ConfigItem(
position = 1,
keyName = "highlightResources",
name = "Highlight Resources",
description = "Highlights all the resources in each room with a color.",
name = "Highlight Resources (Outline)",
description = "Highlights all the resources in each room with an outline.",
parent = "resources"
)
default boolean highlightResources()
{
return true;
return false;
}
@ConfigItem(
@@ -59,7 +97,7 @@ public interface GauntletConfig extends Config
@ConfigItem(
position = 3,
keyName = "highlightResourcesIcons",
name = "Highlight Resources with an Icon",
name = "Highlight Resources (Icon)",
description = "Highlights all the icons in each room with an icon.",
parent = "resources",
hidden = true,
@@ -67,7 +105,7 @@ public interface GauntletConfig extends Config
)
default boolean highlightResourcesIcons()
{
return true;
return false;
}
@Range(
@@ -101,80 +139,80 @@ public interface GauntletConfig extends Config
@ConfigItem(
position = 6,
keyName = "countBossAttacks",
name = "Count Boss Attacks",
description = "Count the attacks until the boss switches their style.",
keyName = "countAttacks",
name = "Count Attacks Display",
description = "Count the attacks until the Hunllef switches their attack style and prayer.",
parent = "boss"
)
default boolean countBossAttacks()
default CounterDisplay countAttacks()
{
return true;
return CounterDisplay.NONE;
}
@ConfigItem(
position = 7,
keyName = "countPlayerAttacks",
name = "Count Player Attacks",
description = "Count the player attacks until the boss switches their prayer.",
parent = "boss"
)
default boolean countPlayerAttacks()
{
return true;
}
@ConfigItem(
position = 8,
keyName = "highlightWidget",
name = "Highlight Correct Prayer",
description = "Highlights correct prayer in your prayer book.",
name = "Highlight Prayer (Prayer Tab)",
description = "Highlights the correct prayer to use in your prayer book.",
parent = "boss"
)
default boolean highlightWidget()
{
return true;
return false;
}
@ConfigItem(
position = 8,
keyName = "highlightPrayerInfobox",
name = "Highlight Prayer (InfoBox)",
description = "Highlights the correct prayer to use in an Infobox.",
parent = "boss"
)
default boolean highlightPrayerInfobox()
{
return false;
}
@ConfigItem(
position = 9,
keyName = "flashOnWrongAttack",
name = "Flash on Wrong Attack",
name = "Flash screen on Wrong Attack",
description = "This will flash your screen if you attack with the wrong stlye.",
parent = "boss"
)
default boolean flashOnWrongAttack()
{
return true;
return false;
}
@ConfigItem(
position = 9,
position = 10,
keyName = "uniquePrayerAudio",
name = "Unique Prayer Audio",
name = "Prayer Audio Warning",
description = "Plays a unique sound whenever the boss is about to shut down your prayer.",
parent = "boss"
)
default boolean uniquePrayerAudio()
{
return true;
return false;
}
@ConfigItem(
position = 10,
position = 11,
keyName = "uniquePrayerVisual",
name = "Unique Prayer Visual",
name = "Prayer Attack (Icon)",
description = "Prayer attacks will have a unique overlay visual.",
parent = "boss"
)
default boolean uniquePrayerVisual()
{
return true;
return false;
}
@ConfigItem(
position = 11,
position = 12,
keyName = "uniqueAttackVisual",
name = "Unique Magic & Range Visuals",
name = "Magic & Range Attack (Icon)",
description = "Magic and Range attacks will have a unique overlay visual.",
parent = "boss"
)
@@ -184,22 +222,35 @@ public interface GauntletConfig extends Config
}
@ConfigItem(
position = 12,
position = 13,
keyName = "attackVisualOutline",
name = "Hunllefs' attacks (Outline)",
description = "Outline the Hunllefs' attacks.",
parent = "boss"
)
default boolean attackVisualOutline()
{
return false;
}
@ConfigItem(
position = 14,
keyName = "overlayBoss",
name = "Overlay the Boss (Color)",
description = "Overlay the boss with an color denoting it's current attack style.",
name = "Outline Hunllef (Color)",
description = "Overlay Hunllef while you are on the wrong prayer with an color denoting it's current attack style.",
parent = "boss"
)
default boolean overlayBoss()
{
return true;
return false;
}
@ConfigItem(
position = 13,
position = 15,
keyName = "overlayBossPrayer",
name = "Overlay the Boss (Icon)",
description = "Overlay the boss with an icon denoting it's current attack style.",
name = "Hunllef Overlay (Icons)",
description = "Overlay the Hunllef with an icon denoting it's current attack style.",
parent = "boss"
)
default boolean overlayBossPrayer()
@@ -208,7 +259,7 @@ public interface GauntletConfig extends Config
}
@ConfigItem(
position = 14,
position = 16,
keyName = "overlayTornadoes",
name = "Show Tornado Decay",
description = "Display the amount of ticks left until the tornadoes decay.",
@@ -216,7 +267,7 @@ public interface GauntletConfig extends Config
)
default boolean overlayTornadoes()
{
return true;
return false;
}
@Range(
@@ -224,9 +275,9 @@ public interface GauntletConfig extends Config
max = 50
)
@ConfigItem(
position = 15,
position = 17,
keyName = "projectileIconSize",
name = "Boss Projectile Icon Size",
name = "Hunllef Projectile Icon Size",
description = " change the size of Projectile icons.",
parent = "boss"
)
@@ -236,7 +287,7 @@ public interface GauntletConfig extends Config
}
@ConfigItem(
position = 16,
position = 18,
keyName = "timer",
name = "Timer",
description = ""
@@ -247,26 +298,26 @@ public interface GauntletConfig extends Config
}
@ConfigItem(
position = 17,
position = 19,
keyName = "displayTimerWidget",
name = "Show Custom Timer (Widget)",
name = "Show Gauntlet timer overlay",
description = "Display a timer widget that tracks your gauntlet progress.",
parent = "timer"
)
default boolean displayTimerWidget()
{
return true;
return false;
}
@ConfigItem(
position = 18,
position = 20,
keyName = "displayTimerChat",
name = "Show Custom Timer (Chat)",
name = "Show Gauntlet timer chat message",
description = "Display a chat message that tracks your gauntlet progress.",
parent = "timer"
)
default boolean displayTimerChat()
{
return true;
return false;
}
}

View File

@@ -0,0 +1,86 @@
/*
* Copyright (c) 2019, ganom <https://github.com/Ganom>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.gauntlet;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import javax.inject.Inject;
import javax.inject.Singleton;
import static net.runelite.client.plugins.gauntlet.GauntletConfig.CounterDisplay.NONE;
import static net.runelite.client.plugins.gauntlet.GauntletConfig.CounterDisplay.ONBOSS;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority;
import net.runelite.client.ui.overlay.components.PanelComponent;
import net.runelite.client.ui.overlay.components.TitleComponent;
import net.runelite.client.ui.overlay.components.table.TableAlignment;
import net.runelite.client.ui.overlay.components.table.TableComponent;
import net.runelite.client.util.ColorUtil;
@Singleton
public class GauntletCounter extends Overlay
{
private final GauntletPlugin plugin;
private final PanelComponent panelComponent = new PanelComponent();
@Inject
GauntletCounter(final GauntletPlugin plugin)
{
this.plugin = plugin;
setPosition(OverlayPosition.ABOVE_CHATBOX_RIGHT);
setPriority(OverlayPriority.HIGH);
}
@Override
public Dimension render(Graphics2D graphics)
{
panelComponent.getChildren().clear();
final Hunllef hunllef = plugin.getHunllef();
if (!plugin.fightingBoss() ||
hunllef == null ||
plugin.getCountAttacks() == NONE ||
plugin.getCountAttacks() == ONBOSS)
{
return null;
}
panelComponent.getChildren().add(TitleComponent.builder()
.text("Hunllef")
.color(Color.pink)
.build());
Color color = hunllef.getPlayerAttacks() == 1 ? Color.RED : Color.WHITE;
final String pHits = ColorUtil.prependColorTag(Integer.toString(hunllef.getPlayerAttacks()), color);
TableComponent tableComponent = new TableComponent();
tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT);
tableComponent.addRow("Hunllef Hits: ", Integer.toString(hunllef.getBossAttacks()));
tableComponent.addRow("Player Hits Left: ", pHits);
panelComponent.getChildren().add(tableComponent);
return panelComponent.render(graphics);
}
}

View File

@@ -0,0 +1,134 @@
/*
* Copyright (c) 2019, ganom <https://github.com/Ganom>
* Copyright (c) 2019, kyle <https://github.com/Kyleeld>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.gauntlet;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import javax.inject.Inject;
import net.runelite.api.Client;
import net.runelite.api.Prayer;
import net.runelite.api.SpriteID;
import net.runelite.client.game.SpriteManager;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority;
import net.runelite.client.ui.overlay.components.ComponentConstants;
import net.runelite.client.ui.overlay.components.InfoBoxComponent;
import net.runelite.client.ui.overlay.components.PanelComponent;
public class GauntletInfoBoxOverlay extends Overlay
{
private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150);
private final Client client;
private final GauntletPlugin plugin;
private final PanelComponent panelComponent = new PanelComponent();
private final SpriteManager spriteManager;
@Inject
GauntletInfoBoxOverlay(final Client client, final GauntletPlugin plugin, final SpriteManager spriteManager)
{
this.client = client;
this.plugin = plugin;
this.spriteManager = spriteManager;
setPosition(OverlayPosition.BOTTOM_RIGHT);
setPriority(OverlayPriority.HIGH);
}
@Override
public Dimension render(Graphics2D graphics)
{
panelComponent.getChildren().clear();
if (!plugin.isHighlightPrayerInfobox() || !plugin.fightingBoss() || plugin.getHunllef() == null)
{
return null;
}
final Hunllef hunllef = plugin.getHunllef();
final Hunllef.BossAttackPhase phase = hunllef.getCurrentPhase();
Prayer prayer = phase.getPrayer();
if (plugin.getHunllef() == null || !plugin.startedGauntlet())
{
return null;
}
if (prayer == null)
{
return null;
}
InfoBoxComponent prayComponent = new InfoBoxComponent();
BufferedImage prayImg = scaleImg(getPrayerImage(prayer));
prayComponent.setImage(prayImg);
prayComponent.setColor(Color.WHITE);
prayComponent.setBackgroundColor(client.isPrayerActive(prayer)
? ComponentConstants.STANDARD_BACKGROUND_COLOR
: NOT_ACTIVATED_BACKGROUND_COLOR);
prayComponent.setPreferredSize(new Dimension(40, 40));
panelComponent.getChildren().add(prayComponent);
panelComponent.setPreferredSize(new Dimension(40, 40));
panelComponent.setBorder(new Rectangle(0, 0, 0, 0));
return panelComponent.render(graphics);
}
private BufferedImage getPrayerImage(Prayer prayer)
{
switch (prayer)
{
case PROTECT_FROM_MAGIC:
return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MAGIC, 0);
case PROTECT_FROM_MELEE:
return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MELEE, 0);
case PROTECT_FROM_MISSILES:
return spriteManager.getSprite(SpriteID.PRAYER_PROTECT_FROM_MISSILES, 0);
}
return null;
}
private static BufferedImage scaleImg(final BufferedImage img)
{
if (img == null)
{
return null;
}
final double width = img.getWidth(null);
final double height = img.getHeight(null);
final double size = 36; // Limit size to 2 as that is minimum size not causing breakage
final double scalex = size / width;
final double scaley = size / height;
final double scale = Math.min(scalex, scaley);
final int newWidth = (int) (width * scale);
final int newHeight = (int) (height * scale);
final BufferedImage scaledImage = new BufferedImage(newWidth, newHeight, BufferedImage.TYPE_INT_ARGB);
final Graphics g = scaledImage.createGraphics();
g.drawImage(img, 0, 0, newWidth, newHeight, null);
g.dispose();
return scaledImage;
}
}

View File

@@ -1,6 +1,7 @@
/*
* Copyright (c) 2019, kThisIsCvpv <https://github.com/kThisIsCvpv>
* Copyright (c) 2019, ganom <https://github.com/Ganom>
* Copyright (c) 2019, kyle <https://github.com/Kyleeld>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,8 +47,11 @@ import net.runelite.api.coords.LocalPoint;
import net.runelite.api.model.Jarvis;
import net.runelite.api.model.Vertex;
import net.runelite.client.graphics.ModelOutlineRenderer;
import static net.runelite.client.plugins.gauntlet.GauntletConfig.CounterDisplay.BOTH;
import static net.runelite.client.plugins.gauntlet.GauntletConfig.CounterDisplay.ONBOSS;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayManager;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.OverlayPriority;
import net.runelite.client.ui.overlay.OverlayUtil;
@@ -55,18 +59,24 @@ import static net.runelite.client.util.ImageUtil.resizeImage;
public class GauntletOverlay extends Overlay
{
@Inject
private OverlayManager overlayManager;
@Inject
private GauntletCounter GauntletCounter;
private static final Color FLASH_COLOR = new Color(255, 0, 0, 70);
private static final int MAX_DISTANCE = 2400;
private final Client client;
private final GauntletPlugin plugin;
private final GauntletConfig config;
private final ModelOutlineRenderer outlineRenderer;
private int timeout;
@Inject
private GauntletOverlay(Client client, GauntletPlugin plugin, ModelOutlineRenderer outlineRenderer)
private GauntletOverlay(Client client, GauntletConfig config, GauntletPlugin plugin, ModelOutlineRenderer outlineRenderer)
{
this.client = client;
this.plugin = plugin;
this.config = config;
this.outlineRenderer = outlineRenderer;
setPosition(OverlayPosition.DYNAMIC);
@@ -115,10 +125,13 @@ public class GauntletOverlay extends Overlay
}
else
{
graphics.setColor(color);
graphics.draw(polygon);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 50));
graphics.fill(polygon);
if (plugin.isAttackVisualOutline())
{
graphics.setColor(color);
graphics.draw(polygon);
graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 50));
graphics.fill(polygon);
}
if (plugin.isUniqueAttackVisual())
{
Rectangle bounds = polygon.getBounds();
@@ -172,7 +185,7 @@ public class GauntletOverlay extends Overlay
final NPC boss = hunllef.getNpc();
final LocalPoint point = boss.getLocalLocation();
if (plugin.isFlash())
if (plugin.isFlash() && plugin.isFlashOnWrongAttack())
{
final Color flash = graphics.getColor();
graphics.setColor(FLASH_COLOR);
@@ -249,48 +262,46 @@ public class GauntletOverlay extends Overlay
}
}
// This section handles any text overlays.
String textOverlay = "";
// Handles the counter for the boss.
if (plugin.isCountBossAttacks())
if (plugin.getCountAttacks() == ONBOSS || plugin.getCountAttacks() == BOTH)
{
String textOverlay;
textOverlay = Integer.toString(hunllef.getBossAttacks());
}
// Handles the counter for the player.
if (plugin.isCountPlayerAttacks())
{
if (textOverlay.length() > 0)
{
textOverlay += " | ";
}
textOverlay += Integer.toString(hunllef.getPlayerAttacks());
}
// Handles drawing the text onto the boss.
if (textOverlay.length() > 0)
{
Point textLoc = Perspective.getCanvasTextLocation(client, graphics, point, textOverlay, boss.getLogicalHeight() / 2);
if (textLoc == null)
if (textOverlay.length() > 0)
{
return null;
Point textLoc = Perspective.getCanvasTextLocation(client, graphics, point, textOverlay, boss.getLogicalHeight() / 2);
if (textLoc == null)
{
return null;
}
textLoc = new Point(textLoc.getX(), textLoc.getY() + 35);
Font oldFont = graphics.getFont();
graphics.setFont(new Font("Arial", Font.BOLD, 20));
Point pointShadow = new Point(textLoc.getX() + 1, textLoc.getY() + 1);
OverlayUtil.renderTextLocation(graphics, pointShadow, textOverlay, Color.BLACK);
OverlayUtil.renderTextLocation(graphics, textLoc, textOverlay, phase.getColor());
graphics.setFont(oldFont);
}
textLoc = new Point(textLoc.getX(), textLoc.getY() + 35);
Font oldFont = graphics.getFont();
graphics.setFont(new Font("Arial", Font.BOLD, 20));
Point pointShadow = new Point(textLoc.getX() + 1, textLoc.getY() + 1);
OverlayUtil.renderTextLocation(graphics, pointShadow, textOverlay, Color.BLACK);
OverlayUtil.renderTextLocation(graphics, textLoc, textOverlay, phase.getColor());
graphics.setFont(oldFont);
}
}
if (plugin.getHunllef() == null)
{
overlayManager.remove(GauntletCounter);
}
}
else
{
@@ -320,14 +331,10 @@ public class GauntletOverlay extends Overlay
if (plugin.isHighlightResourcesIcons())
{
BufferedImage icon = resizeImage(object.getImage(), plugin.getResourceIconSize(), plugin.getResourceIconSize());
if (icon != null)
{
Rectangle bounds = polygon.getBounds();
int startX = (int) bounds.getCenterX() - (icon.getWidth() / 2);
int startY = (int) bounds.getCenterY() - (icon.getHeight() / 2);
graphics.drawImage(icon, startX, startY, null);
}
Rectangle bounds = polygon.getBounds();
int startX = (int) bounds.getCenterX() - (icon.getWidth() / 2);
int startY = (int) bounds.getCenterY() - (icon.getHeight() / 2);
graphics.drawImage(icon, startX, startY, null);
}
}
});

View File

@@ -1,6 +1,7 @@
/*
* Copyright (c) 2019, kThisIsCvpv <https://github.com/kThisIsCvpv>
* Copyright (c) 2019, ganom <https://github.com/Ganom>
* Copyright (c) 2019, kyle <https://github.com/Kyleeld>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,6 +33,7 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import javax.annotation.Nullable;
import javax.inject.Inject;
import lombok.AccessLevel;
import lombok.Getter;
@@ -117,6 +119,9 @@ public class GauntletPlugin extends Plugin
private GauntletOverlay overlay;
@Inject
@Getter(AccessLevel.NONE)
private GauntletInfoBoxOverlay infoboxoverlay;
@Inject
@Getter(AccessLevel.NONE)
private GauntletConfig config;
@Inject
@Getter(AccessLevel.NONE)
@@ -127,34 +132,40 @@ public class GauntletPlugin extends Plugin
@Inject
@Getter(AccessLevel.NONE)
private SkillIconManager skillIconManager;
@Inject
@Getter(AccessLevel.NONE)
private GauntletCounter GauntletCounter;
@Setter(AccessLevel.PACKAGE)
@Nullable
private Hunllef hunllef;
private final Set<Resources> resources = new HashSet<>();
private final Set<Missiles> projectiles = new HashSet<>();
private final Map<String, Integer> items = new HashMap<>();
private Set<Tornado> tornadoes = new HashSet<>();
private boolean attackVisualOutline;
private boolean completeStartup = false;
private boolean countBossAttacks;
private boolean countPlayerAttacks;
private boolean displayTimerChat;
private boolean displayTimerWidget;
@Setter(AccessLevel.PACKAGE)
private boolean flash;
private boolean flashOnWrongAttack;
private boolean highlightPrayerInfobox;
private boolean highlightResources;
private boolean highlightResourcesIcons;
private boolean highlightWidget;
private boolean overlayBoss;
private boolean overlayBossPrayer;
private boolean overlayTornadoes;
@Setter(AccessLevel.PACKAGE)
private boolean flash;
private boolean flashOnWrongAttack;
private Color highlightResourcesColor;
private boolean displayTimerWidget;
private boolean timerVisible = true;
private boolean uniqueAttackVisual;
private boolean uniquePrayerAudio;
private boolean uniquePrayerVisual;
private Color highlightResourcesColor;
private final Map<String, Integer> items = new HashMap<>();
private final Set<Missiles> projectiles = new HashSet<>();
private final Set<Resources> resources = new HashSet<>();
private GauntletConfig.CounterDisplay countAttacks;
private int resourceIconSize;
private Set<Tornado> tornadoes = new HashSet<>();
private int projectileIconSize;
@Provides
GauntletConfig getConfig(ConfigManager configManager)
{
@@ -166,13 +177,15 @@ public class GauntletPlugin extends Plugin
{
addSubscriptions();
updateConfig();
overlayManager.add(overlay);
overlayManager.add(infoboxoverlay);
overlayManager.add(GauntletCounter);
timerVisible = this.displayTimerWidget;
timer.resetStates();
if (timerVisible)
{
overlayManager.add(timer);
}
overlayManager.add(overlay);
if (client.getGameState() != GameState.STARTING && client.getGameState() != GameState.UNKNOWN)
{
completeStartup = false;
@@ -198,6 +211,8 @@ public class GauntletPlugin extends Plugin
timerVisible = false;
}
overlayManager.remove(overlay);
overlayManager.remove(infoboxoverlay);
overlayManager.remove(GauntletCounter);
resources.clear();
projectiles.clear();
tornadoes.clear();
@@ -220,6 +235,11 @@ public class GauntletPlugin extends Plugin
private void onAnimationChanged(AnimationChanged event)
{
if (hunllef == null)
{
return;
}
final Actor actor = event.getActor();
// This section handles the player counter.
@@ -437,8 +457,7 @@ public class GauntletPlugin extends Plugin
this.highlightWidget = config.highlightWidget();
this.resourceIconSize = config.resourceIconSize();
this.projectileIconSize = config.projectileIconSize();
this.countBossAttacks = config.countBossAttacks();
this.countPlayerAttacks = config.countPlayerAttacks();
this.countAttacks = config.countAttacks();
this.uniquePrayerAudio = config.uniquePrayerAudio();
this.uniquePrayerVisual = config.uniquePrayerVisual();
this.uniqueAttackVisual = config.uniqueAttackVisual();
@@ -447,5 +466,7 @@ public class GauntletPlugin extends Plugin
this.overlayTornadoes = config.overlayTornadoes();
this.displayTimerWidget = config.displayTimerWidget();
this.displayTimerChat = config.displayTimerChat();
this.attackVisualOutline = config.attackVisualOutline();
this.highlightPrayerInfobox = config.highlightPrayerInfobox();
}
}