Merge pull request #548 from runelite-extended/more-inferno-stuff
More inferno stuff
This commit is contained in:
@@ -52,4 +52,15 @@ public interface InfernoConfig extends Config
|
|||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ConfigItem(
|
||||||
|
position = 2,
|
||||||
|
keyName = "Wave Display",
|
||||||
|
name = "Wave display",
|
||||||
|
description = "Shows monsters that will spawn on the selected wave(s)."
|
||||||
|
)
|
||||||
|
default InfernoWaveDisplayMode waveDisplay()
|
||||||
|
{
|
||||||
|
return InfernoWaveDisplayMode.BOTH;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,53 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
|
||||||
|
* 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.inferno;
|
||||||
|
|
||||||
|
import net.runelite.api.AnimationID;
|
||||||
|
import net.runelite.api.Prayer;
|
||||||
|
|
||||||
|
public enum InfernoJadAttack
|
||||||
|
{
|
||||||
|
MAGIC(AnimationID.JALTOK_JAD_MAGE_ATTACK, Prayer.PROTECT_FROM_MAGIC),
|
||||||
|
RANGE(AnimationID.JALTOK_JAD_RANGE_ATTACK, Prayer.PROTECT_FROM_MISSILES);
|
||||||
|
|
||||||
|
private final int animation;
|
||||||
|
private final Prayer prayer;
|
||||||
|
|
||||||
|
InfernoJadAttack(int animation, Prayer prayer)
|
||||||
|
{
|
||||||
|
this.animation = animation;
|
||||||
|
this.prayer = prayer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAnimation()
|
||||||
|
{
|
||||||
|
return animation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Prayer getPrayer()
|
||||||
|
{
|
||||||
|
return prayer;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,87 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2017, Devin French <https://github.com/devinfrench>
|
||||||
|
* 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.inferno;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
|
||||||
|
import net.runelite.api.Client;
|
||||||
|
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.ImageComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
|
||||||
|
public class InfernoJadOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150);
|
||||||
|
private final Client client;
|
||||||
|
private final InfernoPlugin plugin;
|
||||||
|
private final SpriteManager spriteManager;
|
||||||
|
private final PanelComponent imagePanelComponent = new PanelComponent();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private InfernoJadOverlay(Client client, InfernoPlugin plugin, SpriteManager spriteManager)
|
||||||
|
{
|
||||||
|
setPosition(OverlayPosition.BOTTOM_RIGHT);
|
||||||
|
setPriority(OverlayPriority.HIGH);
|
||||||
|
this.client = client;
|
||||||
|
this.plugin = plugin;
|
||||||
|
this.spriteManager = spriteManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
final InfernoJadAttack attack = plugin.getAttack();
|
||||||
|
|
||||||
|
if (attack == null)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
final BufferedImage prayerImage = getPrayerImage(attack);
|
||||||
|
|
||||||
|
imagePanelComponent.getChildren().clear();
|
||||||
|
imagePanelComponent.getChildren().add(new ImageComponent(prayerImage));
|
||||||
|
imagePanelComponent.setBackgroundColor(client.isPrayerActive(attack.getPrayer())
|
||||||
|
? ComponentConstants.STANDARD_BACKGROUND_COLOR
|
||||||
|
: NOT_ACTIVATED_BACKGROUND_COLOR);
|
||||||
|
|
||||||
|
return imagePanelComponent.render(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BufferedImage getPrayerImage(InfernoJadAttack attack)
|
||||||
|
{
|
||||||
|
final int prayerSpriteID = attack == InfernoJadAttack.MAGIC ? SpriteID.PRAYER_PROTECT_FROM_MAGIC : SpriteID.PRAYER_PROTECT_FROM_MISSILES;
|
||||||
|
return spriteManager.getSprite(prayerSpriteID, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -36,7 +36,6 @@ import net.runelite.api.Perspective;
|
|||||||
import net.runelite.api.Point;
|
import net.runelite.api.Point;
|
||||||
import net.runelite.api.coords.LocalPoint;
|
import net.runelite.api.coords.LocalPoint;
|
||||||
import net.runelite.client.ui.overlay.Overlay;
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
|
||||||
import net.runelite.client.ui.overlay.OverlayLayer;
|
import net.runelite.client.ui.overlay.OverlayLayer;
|
||||||
import net.runelite.client.ui.overlay.OverlayPosition;
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
import net.runelite.client.ui.overlay.components.PanelComponent;
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
|||||||
@@ -26,15 +26,25 @@ package net.runelite.client.plugins.inferno;
|
|||||||
|
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.regex.Matcher;
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
import javax.annotation.Nullable;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
import lombok.AccessLevel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import net.runelite.api.ChatMessageType;
|
||||||
import net.runelite.api.Client;
|
import net.runelite.api.Client;
|
||||||
|
import net.runelite.api.GameState;
|
||||||
import net.runelite.api.HeadIcon;
|
import net.runelite.api.HeadIcon;
|
||||||
import net.runelite.api.NPC;
|
import net.runelite.api.NPC;
|
||||||
import net.runelite.api.NpcID;
|
import net.runelite.api.NpcID;
|
||||||
|
import net.runelite.api.events.AnimationChanged;
|
||||||
|
import net.runelite.api.events.ChatMessage;
|
||||||
|
import net.runelite.api.events.GameStateChanged;
|
||||||
import net.runelite.api.events.GameTick;
|
import net.runelite.api.events.GameTick;
|
||||||
import net.runelite.api.events.NpcDespawned;
|
import net.runelite.api.events.NpcDespawned;
|
||||||
import net.runelite.api.events.NpcSpawned;
|
import net.runelite.api.events.NpcSpawned;
|
||||||
@@ -44,6 +54,7 @@ import net.runelite.client.plugins.Plugin;
|
|||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.plugins.PluginType;
|
import net.runelite.client.plugins.PluginType;
|
||||||
import net.runelite.client.ui.overlay.OverlayManager;
|
import net.runelite.client.ui.overlay.OverlayManager;
|
||||||
|
import org.apache.commons.lang3.ArrayUtils;
|
||||||
|
|
||||||
@PluginDescriptor(
|
@PluginDescriptor(
|
||||||
name = "Inferno",
|
name = "Inferno",
|
||||||
@@ -54,6 +65,11 @@ import net.runelite.client.ui.overlay.OverlayManager;
|
|||||||
public class InfernoPlugin extends Plugin
|
public class InfernoPlugin extends Plugin
|
||||||
{
|
{
|
||||||
|
|
||||||
|
private static final Pattern WAVE_PATTERN = Pattern.compile(".*Wave: (\\d+).*");
|
||||||
|
private static final int MAX_MONSTERS_OF_TYPE_PER_WAVE = 6;
|
||||||
|
private static final int INFERNO_REGION = 9043;
|
||||||
|
static final int MAX_WAVE = 69;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private Client client;
|
private Client client;
|
||||||
|
|
||||||
@@ -63,6 +79,12 @@ public class InfernoPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private InfernoOverlay infernoOverlay;
|
private InfernoOverlay infernoOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private InfernoWaveOverlay waveOverlay;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private InfernoJadOverlay jadOverlay;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
private InfernoInfobox infernoInfobox;
|
private InfernoInfobox infernoInfobox;
|
||||||
|
|
||||||
@@ -72,6 +94,12 @@ public class InfernoPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private InfernoConfig config;
|
private InfernoConfig config;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
static final List<EnumMap<InfernoWaveMonster, Integer>> WAVES = new ArrayList<>();
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private int currentWave = -1;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
private Map<NPC, InfernoNPC> monsters;
|
private Map<NPC, InfernoNPC> monsters;
|
||||||
|
|
||||||
@@ -84,6 +112,54 @@ public class InfernoPlugin extends Plugin
|
|||||||
@Getter
|
@Getter
|
||||||
private InfernoNPC[] priorityNPC;
|
private InfernoNPC[] priorityNPC;
|
||||||
|
|
||||||
|
|
||||||
|
@Getter(AccessLevel.PACKAGE)
|
||||||
|
@Nullable
|
||||||
|
private InfernoJadAttack attack;
|
||||||
|
|
||||||
|
private NPC jad;
|
||||||
|
|
||||||
|
|
||||||
|
static
|
||||||
|
{
|
||||||
|
final InfernoWaveMonster[] waveMonsters = InfernoWaveMonster.values();
|
||||||
|
|
||||||
|
// Add wave 1, future waves are derived from its contents
|
||||||
|
final EnumMap<InfernoWaveMonster, Integer> waveOne = new EnumMap<>(InfernoWaveMonster.class);
|
||||||
|
waveOne.put(waveMonsters[0], 1);
|
||||||
|
WAVES.add(waveOne);
|
||||||
|
|
||||||
|
for (int wave = 1; wave < MAX_WAVE; wave++)
|
||||||
|
{
|
||||||
|
final EnumMap<InfernoWaveMonster, Integer> prevWave = WAVES.get(wave - 1).clone();
|
||||||
|
int maxMonsterOrdinal = -1;
|
||||||
|
|
||||||
|
for (int i = 0; i < waveMonsters.length; i++)
|
||||||
|
{
|
||||||
|
final int ordinalMonsterQuantity = prevWave.getOrDefault(waveMonsters[i], 0);
|
||||||
|
|
||||||
|
if (ordinalMonsterQuantity == MAX_MONSTERS_OF_TYPE_PER_WAVE)
|
||||||
|
{
|
||||||
|
maxMonsterOrdinal = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxMonsterOrdinal >= 0)
|
||||||
|
{
|
||||||
|
prevWave.remove(waveMonsters[maxMonsterOrdinal]);
|
||||||
|
}
|
||||||
|
|
||||||
|
final int addedMonsterOrdinal = maxMonsterOrdinal >= 0 ? maxMonsterOrdinal + 1 : 0;
|
||||||
|
final InfernoWaveMonster addedMonster = waveMonsters[addedMonsterOrdinal];
|
||||||
|
final int addedMonsterQuantity = prevWave.getOrDefault(addedMonster, 0);
|
||||||
|
|
||||||
|
prevWave.put(addedMonster, addedMonsterQuantity + 1);
|
||||||
|
|
||||||
|
WAVES.add(prevWave);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
InfernoConfig provideConfig(ConfigManager configManager)
|
InfernoConfig provideConfig(ConfigManager configManager)
|
||||||
{
|
{
|
||||||
@@ -96,6 +172,8 @@ public class InfernoPlugin extends Plugin
|
|||||||
overlayManager.add(infernoOverlay);
|
overlayManager.add(infernoOverlay);
|
||||||
overlayManager.add(infernoInfobox);
|
overlayManager.add(infernoInfobox);
|
||||||
overlayManager.add(nibblerOverlay);
|
overlayManager.add(nibblerOverlay);
|
||||||
|
overlayManager.add(waveOverlay);
|
||||||
|
overlayManager.add(jadOverlay);
|
||||||
monsters = new HashMap<>();
|
monsters = new HashMap<>();
|
||||||
monsterCurrentAttackMap = new HashMap<>(6);
|
monsterCurrentAttackMap = new HashMap<>(6);
|
||||||
for (int i = 1; i <= 6; i++)
|
for (int i = 1; i <= 6; i++)
|
||||||
@@ -112,6 +190,10 @@ public class InfernoPlugin extends Plugin
|
|||||||
overlayManager.remove(infernoInfobox);
|
overlayManager.remove(infernoInfobox);
|
||||||
overlayManager.remove(infernoOverlay);
|
overlayManager.remove(infernoOverlay);
|
||||||
overlayManager.remove(nibblerOverlay);
|
overlayManager.remove(nibblerOverlay);
|
||||||
|
overlayManager.remove(waveOverlay);
|
||||||
|
overlayManager.remove(jadOverlay);
|
||||||
|
jad = null;
|
||||||
|
attack = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -129,6 +211,13 @@ public class InfernoPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
nibblers.add(npc);
|
nibblers.add(npc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
final int id = event.getNpc().getId();
|
||||||
|
|
||||||
|
if (id == NpcID.JALTOKJAD || id == NpcID.JALTOKJAD_7704)
|
||||||
|
{
|
||||||
|
jad = event.getNpc();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -147,6 +236,41 @@ public class InfernoPlugin extends Plugin
|
|||||||
{
|
{
|
||||||
nibblers.remove(npc);
|
nibblers.remove(npc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (jad == event.getNpc())
|
||||||
|
{
|
||||||
|
jad = null;
|
||||||
|
attack = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onGameStateChanged(GameStateChanged event)
|
||||||
|
{
|
||||||
|
if (event.getGameState() != GameState.LOGGED_IN)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!inInferno())
|
||||||
|
{
|
||||||
|
currentWave = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onChatMessage(ChatMessage event)
|
||||||
|
{
|
||||||
|
final Matcher waveMatcher = WAVE_PATTERN.matcher(event.getMessage());
|
||||||
|
|
||||||
|
if (event.getType() != ChatMessageType.GAMEMESSAGE
|
||||||
|
|| !inInferno()
|
||||||
|
|| !waveMatcher.matches())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
currentWave = Integer.parseInt(waveMatcher.group(1));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe
|
@Subscribe
|
||||||
@@ -216,6 +340,24 @@ public class InfernoPlugin extends Plugin
|
|||||||
calculatePriorityNPC();
|
calculatePriorityNPC();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Subscribe
|
||||||
|
public void onAnimationChanged(final AnimationChanged event)
|
||||||
|
{
|
||||||
|
if (event.getActor() != jad)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jad.getAnimation() == InfernoJadAttack.MAGIC.getAnimation())
|
||||||
|
{
|
||||||
|
attack = InfernoJadAttack.MAGIC;
|
||||||
|
}
|
||||||
|
else if (jad.getAnimation() == InfernoJadAttack.RANGE.getAnimation())
|
||||||
|
{
|
||||||
|
attack = InfernoJadAttack.RANGE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void calculatePriorityNPC()
|
private void calculatePriorityNPC()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < priorityNPC.length; i++)
|
for (int i = 0; i < priorityNPC.length; i++)
|
||||||
@@ -272,4 +414,14 @@ public class InfernoPlugin extends Plugin
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean inInferno()
|
||||||
|
{
|
||||||
|
return ArrayUtils.contains(client.getMapRegions(), INFERNO_REGION);
|
||||||
|
}
|
||||||
|
|
||||||
|
static String formatMonsterQuantity(final InfernoWaveMonster monster, final int quantity)
|
||||||
|
{
|
||||||
|
return String.format("%dx %s", quantity, monster);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Jordan Atwood <jordan.atwood423@gmail.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.inferno;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public enum InfernoWaveDisplayMode
|
||||||
|
{
|
||||||
|
CURRENT("Current wave"),
|
||||||
|
NEXT("Next wave"),
|
||||||
|
BOTH("Both");
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Jordan Atwood <jordan.atwood423@gmail.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.inferno;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
|
||||||
|
@AllArgsConstructor
|
||||||
|
enum InfernoWaveMonster
|
||||||
|
{
|
||||||
|
|
||||||
|
JAL_NIB("Jal-Nib", 32),
|
||||||
|
JAL_MEJRAH("Jal-MejRah", 85),
|
||||||
|
JAL_AK("Jal-Ak", 165),
|
||||||
|
JAL_IMKOT("Jal-ImKot", 240),
|
||||||
|
JAL_XIL("Jal-XIL", 370),
|
||||||
|
JAL_ZEK("Jal-Zek", 490),
|
||||||
|
JALTOK_JAD("JalTok-Jad", 900),
|
||||||
|
TZKAL_ZUK("TzKal-Zuk", 1400);
|
||||||
|
|
||||||
|
private final String name;
|
||||||
|
private final int level;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString()
|
||||||
|
{
|
||||||
|
return String.format("%s - Level %s", name, level);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2018, Jordan Atwood <jordan.atwood423@gmail.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.inferno;
|
||||||
|
|
||||||
|
import java.awt.Color;
|
||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Graphics2D;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import net.runelite.client.ui.ColorScheme;
|
||||||
|
import net.runelite.client.ui.overlay.Overlay;
|
||||||
|
import net.runelite.client.ui.overlay.OverlayPosition;
|
||||||
|
import net.runelite.client.ui.overlay.components.PanelComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.TitleComponent;
|
||||||
|
import net.runelite.client.ui.overlay.components.table.TableComponent;
|
||||||
|
|
||||||
|
class InfernoWaveOverlay extends Overlay
|
||||||
|
{
|
||||||
|
private static final Color HEADER_COLOR = ColorScheme.BRAND_ORANGE;
|
||||||
|
|
||||||
|
private final InfernoConfig config;
|
||||||
|
private final InfernoPlugin plugin;
|
||||||
|
|
||||||
|
private final PanelComponent panelComponent = new PanelComponent();
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private InfernoWaveOverlay(InfernoConfig config, InfernoPlugin plugin)
|
||||||
|
{
|
||||||
|
setPosition(OverlayPosition.TOP_RIGHT);
|
||||||
|
this.config = config;
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Dimension render(Graphics2D graphics)
|
||||||
|
{
|
||||||
|
if (!plugin.inInferno()
|
||||||
|
|| plugin.getCurrentWave() < 0)
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
panelComponent.getChildren().clear();
|
||||||
|
|
||||||
|
final int currentWave = plugin.getCurrentWave();
|
||||||
|
final int waveIndex = currentWave - 1;
|
||||||
|
|
||||||
|
if (config.waveDisplay() == InfernoWaveDisplayMode.CURRENT
|
||||||
|
|| config.waveDisplay() == InfernoWaveDisplayMode.BOTH)
|
||||||
|
{
|
||||||
|
final Map<InfernoWaveMonster, Integer> waveContents = InfernoPlugin.getWAVES().get(waveIndex);
|
||||||
|
|
||||||
|
addWaveInfo("Wave " + plugin.getCurrentWave(), waveContents);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((config.waveDisplay() == InfernoWaveDisplayMode.NEXT
|
||||||
|
|| config.waveDisplay() == InfernoWaveDisplayMode.BOTH)
|
||||||
|
&& currentWave != InfernoPlugin.MAX_WAVE)
|
||||||
|
{
|
||||||
|
final Map<InfernoWaveMonster, Integer> waveContents = InfernoPlugin.getWAVES().get(waveIndex + 1);
|
||||||
|
|
||||||
|
addWaveInfo("Next wave", waveContents);
|
||||||
|
}
|
||||||
|
|
||||||
|
return panelComponent.render(graphics);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void addWaveInfo(final String headerText, final Map<InfernoWaveMonster, Integer> waveContents)
|
||||||
|
{
|
||||||
|
panelComponent.getChildren().add(TitleComponent.builder()
|
||||||
|
.text(headerText)
|
||||||
|
.color(HEADER_COLOR)
|
||||||
|
.build());
|
||||||
|
|
||||||
|
TableComponent tableComponent = new TableComponent();
|
||||||
|
|
||||||
|
for (String line : buildWaveLines(waveContents))
|
||||||
|
{
|
||||||
|
tableComponent.addRow(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
panelComponent.getChildren().add(tableComponent);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Collection<String> buildWaveLines(final Map<InfernoWaveMonster, Integer> wave)
|
||||||
|
{
|
||||||
|
final List<Map.Entry<InfernoWaveMonster, Integer>> monsters = new ArrayList<>(wave.entrySet());
|
||||||
|
monsters.sort(Map.Entry.comparingByKey());
|
||||||
|
final List<String> outputLines = new ArrayList<>();
|
||||||
|
|
||||||
|
for (Map.Entry<InfernoWaveMonster, Integer> monsterEntry : monsters)
|
||||||
|
{
|
||||||
|
final InfernoWaveMonster monster = monsterEntry.getKey();
|
||||||
|
final int quantity = monsterEntry.getValue();
|
||||||
|
final String line = InfernoPlugin.formatMonsterQuantity(monster, quantity);
|
||||||
|
|
||||||
|
outputLines.add(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
return outputLines;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user