Re-write lizardmanshaman plugin (#2175)

This commit is contained in:
dutta64
2020-01-02 03:26:27 -07:00
committed by Kyle
parent 4b7597019b
commit f93ed474b3
7 changed files with 376 additions and 272 deletions

View File

@@ -335,6 +335,7 @@ public final class AnimationID
// Lizardman shaman
public static final int LIZARDMAN_SHAMAN_SPAWN = 7157;
public static final int LIZARDMAN_SHAMAN_SPAWN_EXPLOSION = 7159;
// Combat counter
public static final int BARRAGE_ANIMATION = 1979;

View File

@@ -0,0 +1,139 @@
/*
* Copyright (c) 2018, https://openosrs.com Dutta64
* 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.lizardmanshaman;
import java.awt.Color;
import lombok.RequiredArgsConstructor;
import net.runelite.client.config.Alpha;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
import net.runelite.client.config.ConfigSection;
@ConfigGroup("lizardmanshaman")
public interface LizardmanShamanConfig extends Config
{
@RequiredArgsConstructor
enum SpawnOverlayConfig
{
EXPLOSION_ONLY("Explosion Only"),
ALWAYS("Always"),
DISABLED("Disabled");
private final String name;
@Override
public String toString()
{
return name;
}
}
@ConfigSection(
keyName = "features",
name = "Features",
description = "Enable or disable plugin features.",
position = 0
)
default boolean features()
{
return true;
}
@ConfigItem(
keyName = "spawnOverlay",
name = "Spawn Overlay",
description = "Show an overlay for Spawn's explosion tiles.",
section = "features",
position = 1
)
default SpawnOverlayConfig showSpawnOverlay()
{
return SpawnOverlayConfig.ALWAYS;
}
@ConfigSection(
keyName = "colors",
name = "Colors",
description = "Customize overlay colors.",
position = 1
)
default boolean colors()
{
return false;
}
@Alpha
@ConfigItem(
keyName = "explosionBorderColor",
name = "Explosion Border",
description = "Spawn explosion tiles overlay border.",
section = "colors",
position = 1
)
default Color explosionBorderColor()
{
return Color.RED;
}
@Alpha
@ConfigItem(
keyName = "explosionFillColor",
name = "Explosion Fill",
description = "Spawn explosion tiles overlay fill.",
section = "colors",
position = 2
)
default Color explosionFillColor()
{
return new Color(255, 0, 0, 20);
}
@Alpha
@ConfigItem(
keyName = "spawnWalkableBorderColor",
name = "Walkable Border",
description = "Spawn walkable tiles overlay border.",
section = "colors",
position = 3
)
default Color spawnWalkableBorderColor()
{
return Color.ORANGE;
}
@Alpha
@ConfigItem(
keyName = "spawnWalkableFillColor",
name = "Walkable Fill",
description = "Spawn walkable tiles overlay fill.",
section = "colors",
position = 4
)
default Color spawnWalkableFillColor()
{
return new Color(255, 165, 0, 20);
}
}

View File

@@ -0,0 +1,196 @@
/*
* Copyright (c) 2018, https://openosrs.com Dutta64
* 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.lizardmanshaman;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.Shape;
import java.awt.Stroke;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Actor;
import net.runelite.api.AnimationID;
import net.runelite.api.Client;
import net.runelite.api.NPC;
import net.runelite.api.Perspective;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.coords.WorldArea;
import static net.runelite.client.plugins.lizardmanshaman.LizardmanShamanConfig.SpawnOverlayConfig;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
@Slf4j
@Singleton
class LizardmanShamanOverlay extends Overlay
{
private final Client client;
private final LizardmanShamanPlugin plugin;
@Inject
private LizardmanShamanOverlay(final Client client, final LizardmanShamanPlugin plugin)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_SCENE);
this.client = client;
this.plugin = plugin;
}
@Override
public Dimension render(Graphics2D graphics)
{
if (!plugin.getSpawnOverlayConfig().equals(SpawnOverlayConfig.DISABLED))
{
renderValidMovement(graphics);
}
return null;
}
/**
* Adapted from net.runelite.client.plugins.devtools.SceneOverlay
*
* @param graphics
*/
private void renderValidMovement(Graphics2D graphics)
{
for (NPC npc : client.getNpcs())
{
if (!isSpawnNpc(npc))
{
continue;
}
for (int dx = -1; dx <= 1; dx++)
{
for (int dy = -1; dy <= 1; dy++)
{
if (dx == 0 && dy == 0)
{
continue;
}
renderTileIfValidForMovement(graphics, npc, dx, dy);
}
}
}
}
/**
* Adapted from net.runelite.client.plugins.devtools.SceneOverlay
*
* @param graphics
* @param actor
* @param dx
* @param dy
*/
private void renderTileIfValidForMovement(Graphics2D graphics, Actor actor, int dx, int dy)
{
WorldArea area = actor.getWorldArea();
if (area == null)
{
return;
}
if (area.canTravelInDirection(client, dx, dy))
{
LocalPoint lp = actor.getLocalLocation();
if (lp == null)
{
return;
}
lp = new LocalPoint(
lp.getX() + dx * Perspective.LOCAL_TILE_SIZE + dx * Perspective.LOCAL_TILE_SIZE * (area.getWidth() - 1) / 2,
lp.getY() + dy * Perspective.LOCAL_TILE_SIZE + dy * Perspective.LOCAL_TILE_SIZE * (area.getHeight() - 1) / 2);
Polygon poly = Perspective.getCanvasTilePoly(client, lp);
if (poly == null)
{
return;
}
if (isExplodingAnimation(actor))
{
renderPolygon(graphics, poly, 1, plugin.getExplosionBorderColor(), plugin.getExplosionFillColor());
}
else if (plugin.getSpawnOverlayConfig().equals(SpawnOverlayConfig.ALWAYS))
{
renderPolygon(graphics, poly, 1, plugin.getSpawnWalkableBorderColor(), plugin.getSpawnWalkableFillColor());
}
}
}
/**
* Adapted from net.runelite.client.ui.overlay.OverlayUtil
*
* @param graphics
* @param poly
* @param strokeWidth
* @param strokeColor
* @param fillColor
*/
private static void renderPolygon(Graphics2D graphics, Shape poly, int strokeWidth, Color strokeColor, Color fillColor)
{
graphics.setColor(strokeColor);
final Stroke originalStroke = graphics.getStroke();
graphics.setStroke(new BasicStroke(strokeWidth));
graphics.draw(poly);
graphics.setColor(fillColor);
graphics.fill(poly);
graphics.setStroke(originalStroke);
}
/**
* Returns true if the Actor's animation is exploding.
*
* @param actor an Actor object.
* @return true if the Actor is exploding, else returns false.
*/
private static boolean isExplodingAnimation(Actor actor)
{
return actor.getAnimation() == AnimationID.LIZARDMAN_SHAMAN_SPAWN_EXPLOSION;
}
/**
* Returns true if the NPC is a Lizardman Shaman Spawn.
*
* @param npc an NPC object.
* @return true if the NPC is a lizardman shaman spawn, else returns false.
*/
private static boolean isSpawnNpc(NPC npc)
{
final int NPC_ID_SPAWN = 6768;
return npc.getId() == NPC_ID_SPAWN;
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, https://openosrs.com
* Copyright (c) 2018, https://openosrs.com Dutta64
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -22,74 +22,72 @@
* (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.lizardmenshaman;
package net.runelite.client.plugins.lizardmanshaman;
import com.google.inject.Provides;
import java.util.HashMap;
import java.util.Map;
import java.awt.Color;
import java.util.Objects;
import javax.inject.Inject;
import javax.inject.Singleton;
import lombok.AccessLevel;
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import net.runelite.api.Actor;
import static net.runelite.api.AnimationID.LIZARDMAN_SHAMAN_SPAWN;
import net.runelite.api.coords.LocalPoint;
import net.runelite.api.events.AnimationChanged;
import net.runelite.api.events.ChatMessage;
import net.runelite.client.Notifier;
import net.runelite.client.config.ConfigManager;
import net.runelite.client.eventbus.Subscribe;
import net.runelite.client.events.ConfigChanged;
import net.runelite.client.plugins.Plugin;
import net.runelite.client.plugins.PluginDescriptor;
import net.runelite.client.plugins.PluginType;
import static net.runelite.client.plugins.lizardmanshaman.LizardmanShamanConfig.SpawnOverlayConfig;
import net.runelite.client.ui.overlay.OverlayManager;
@PluginDescriptor(
name = "Lizard Shamans",
description = "Configures timer for lizardmen shaman spawns.",
tags = {"shaman", "lizard", "lizardmen"},
name = "Lizardman Shamans",
description = "Display an overlay for spawn explosion tiles",
tags = {"lizardman", "shaman", "lizard"},
type = PluginType.PVM,
enabledByDefault = false
)
@Slf4j
@Singleton
public class LizardmenShamanPlugin extends Plugin
public class LizardmanShamanPlugin extends Plugin
{
private static final String SHAMAN = "Lizardman shaman";
private static final String MESSAGE = "A Lizardman shaman has summoned his spawn!";
private static final String CONFIG_GROUP_NAME = "lizardmanshaman";
@Getter(AccessLevel.PACKAGE)
private final Map<LocalPoint, LizardmenShamanSpawn> spawns = new HashMap<>();
private SpawnOverlayConfig spawnOverlayConfig;
@Getter(AccessLevel.PACKAGE)
private Color explosionBorderColor;
@Getter(AccessLevel.PACKAGE)
private Color explosionFillColor;
@Getter(AccessLevel.PACKAGE)
private Color spawnWalkableBorderColor;
@Getter(AccessLevel.PACKAGE)
private Color spawnWalkableFillColor;
@Inject
private OverlayManager overlayManager;
@Inject
private ShamanSpawnOverlay overlay;
private LizardmanShamanOverlay overlay;
@Inject
private LizardmenShamanConfig config;
@Inject
private Notifier notifier;
private boolean showTimer;
private boolean notifyOnSpawn;
private LizardmanShamanConfig config;
@Provides
LizardmenShamanConfig getConfig(ConfigManager configManager)
LizardmanShamanConfig getConfig(ConfigManager configManager)
{
return configManager.getConfig(LizardmenShamanConfig.class);
return configManager.getConfig(LizardmanShamanConfig.class);
}
@Override
protected void startUp()
{
this.showTimer = config.showTimer();
this.notifyOnSpawn = config.notifyOnSpawn();
initConfig();
overlayManager.add(overlay);
}
@@ -98,43 +96,25 @@ public class LizardmenShamanPlugin extends Plugin
protected void shutDown()
{
overlayManager.remove(overlay);
spawns.clear();
}
@Subscribe
private void onChatMessage(ChatMessage event)
{
if (this.notifyOnSpawn && /* event.getType() == ChatMessageType.GAMEMESSAGE && */event.getMessage().contains(MESSAGE))
// ChatMessageType should probably be SPAM <- should be tested first though
{
notifier.notify(MESSAGE);
}
}
@Subscribe
private void onAnimationChanged(AnimationChanged event)
{
Actor actor = event.getActor();
if (actor == null || actor.getName() == null)
{
return;
}
if (actor.getName().equals(SHAMAN) && actor.getAnimation() == LIZARDMAN_SHAMAN_SPAWN && this.showTimer)
{
spawns.put(event.getActor().getLocalLocation(), new LizardmenShamanSpawn(8.4, null));
}
}
@Subscribe
private void onConfigChanged(ConfigChanged event)
{
if (!event.getGroup().equals("shaman"))
if (Objects.equals(event.getGroup(), CONFIG_GROUP_NAME))
{
return;
initConfig();
}
}
this.showTimer = config.showTimer();
this.notifyOnSpawn = config.notifyOnSpawn();
private void initConfig()
{
this.spawnOverlayConfig = config.showSpawnOverlay();
this.explosionBorderColor = config.explosionBorderColor();
this.explosionFillColor = config.explosionFillColor();
this.spawnWalkableBorderColor = config.spawnWalkableBorderColor();
this.spawnWalkableFillColor = config.spawnWalkableFillColor();
}
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright (c) 2018, https://openosrs.com
* 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.lizardmenshaman;
import net.runelite.client.config.Config;
import net.runelite.client.config.ConfigGroup;
import net.runelite.client.config.ConfigItem;
@ConfigGroup("shaman")
public interface LizardmenShamanConfig extends Config
{
@ConfigItem(
position = 1,
keyName = "showTimer",
name = "Show timer",
description = "Display timer till for lizardman shaman spawns."
)
default boolean showTimer()
{
return true;
}
@ConfigItem(
position = 2,
keyName = "notifyOnSpawn",
name = "Notify on spawn",
description = "Notify user when lizardman summons spawns."
)
default boolean notifyOnSpawn()
{
return true;
}
}

View File

@@ -1,43 +0,0 @@
/*
* Copyright (c) 2018, https://openosrs.com
* 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.lizardmenshaman;
import java.time.Instant;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
import lombok.Setter;
@Getter(AccessLevel.PACKAGE)
@Setter(AccessLevel.PACKAGE)
@RequiredArgsConstructor
@AllArgsConstructor
class LizardmenShamanSpawn
{
private final Instant start = Instant.now();
private double countdownTimer;
private Instant end;
}

View File

@@ -1,114 +0,0 @@
/*
* Copyright (c) 2018, https://openosrs.com
* 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.lizardmenshaman;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics2D;
import java.time.Duration;
import java.time.Instant;
import javax.inject.Inject;
import javax.inject.Singleton;
import net.runelite.api.Client;
import net.runelite.api.Perspective;
import net.runelite.api.Point;
import net.runelite.client.ui.overlay.Overlay;
import net.runelite.client.ui.overlay.OverlayLayer;
import net.runelite.client.ui.overlay.OverlayPosition;
import net.runelite.client.ui.overlay.components.ProgressPieComponent;
@Singleton
class ShamanSpawnOverlay extends Overlay
{
private final Client client;
private final LizardmenShamanPlugin plugin;
@Inject
private ShamanSpawnOverlay(final Client client, final LizardmenShamanPlugin plugin)
{
setPosition(OverlayPosition.DYNAMIC);
setLayer(OverlayLayer.ABOVE_SCENE);
this.client = client;
this.plugin = plugin;
}
@Override
public Dimension render(Graphics2D graphics)
{
plugin.getSpawns().forEach((localPoint, spawn) ->
{
final Instant now = Instant.now();
final long startCountdown = Duration.between(spawn.getStart(), now).getSeconds();
final double certainSec = spawn.getCountdownTimer() - startCountdown;
if (certainSec <= 0 && spawn.getEnd() == null)
{
spawn.setEnd(Instant.now());
}
final ProgressPieComponent pieComponent = new ProgressPieComponent();
final Point loc = Perspective.localToCanvas(client, localPoint, client.getPlane());
if (loc == null || certainSec < 0)
{
return;
}
pieComponent.setPosition(loc);
pieComponent.setProgress(certainSec / spawn.getCountdownTimer());
if (certainSec > 4.8)
{
pieComponent.setFill(Color.GREEN);
pieComponent.setBorderColor(Color.GREEN);
pieComponent.render(graphics);
}
else if (certainSec > 3.6)
{
pieComponent.setFill(Color.YELLOW);
pieComponent.setBorderColor(Color.YELLOW);
pieComponent.render(graphics);
}
else if (certainSec > 2.4)
{
pieComponent.setFill(Color.ORANGE);
pieComponent.setBorderColor(Color.ORANGE);
pieComponent.render(graphics);
}
else if (certainSec > 1.2)
{
pieComponent.setFill(new Color(255, 140, 0));
pieComponent.setBorderColor(new Color(255, 140, 0));
pieComponent.render(graphics);
}
else
{
pieComponent.setFill(Color.RED);
pieComponent.setBorderColor(Color.RED);
pieComponent.render(graphics);
}
});
return null;
}
}