Merge pull request #628 from sethtroll/changebossimages
Change boss timers to use ItemID images instead of resource images
@@ -25,43 +25,39 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.bosstimer;
|
package net.runelite.client.plugins.bosstimer;
|
||||||
|
|
||||||
import java.awt.image.BufferedImage;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import net.runelite.api.ItemID;
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
enum Boss
|
enum Boss
|
||||||
{
|
{
|
||||||
GENERAL_GRAARDOR("General Graardor", 90, ChronoUnit.SECONDS, "bando"),
|
GENERAL_GRAARDOR("General Graardor", 90, ChronoUnit.SECONDS, ItemID.PET_GENERAL_GRAARDOR),
|
||||||
KRIL_TSUTSAROTH("K'ril Tsutsaroth", 90, ChronoUnit.SECONDS, "zammy"),
|
KRIL_TSUTSAROTH("K'ril Tsutsaroth", 90, ChronoUnit.SECONDS, ItemID.PET_KRIL_TSUTSAROTH),
|
||||||
KREEARRA("Kree'arra", 90, ChronoUnit.SECONDS, "arma"),
|
KREEARRA("Kree'arra", 90, ChronoUnit.SECONDS, ItemID.PET_KREEARRA),
|
||||||
COMMANDER_ZILYANA("Commander Zilyana", 90, ChronoUnit.SECONDS, "sara"),
|
COMMANDER_ZILYANA("Commander Zilyana", 90, ChronoUnit.SECONDS, ItemID.PET_ZILYANA),
|
||||||
CALLISTO("Callisto", 30, ChronoUnit.SECONDS, "callisto"),
|
CALLISTO("Callisto", 30, ChronoUnit.SECONDS, ItemID.CALLISTO_CUB),
|
||||||
CHAOS_FANATIC("Chaos fanatic", 30, ChronoUnit.SECONDS, "chaos_fanatic"),
|
CHAOS_ELEMENTAL("Chaos Elemental", 150, ChronoUnit.SECONDS, ItemID.PET_CHAOS_ELEMENTAL),
|
||||||
CRAZY_ARCHAEOLOGIST("Crazy archaeologist", 30, ChronoUnit.SECONDS, "crazy_arch"),
|
CHAOS_FANATIC("Chaos fanatic", 30, ChronoUnit.SECONDS, ItemID.ANCIENT_STAFF),
|
||||||
KING_BLACK_DRAGON("King Black Dragon", 10, ChronoUnit.SECONDS, "kbd"),
|
CRAZY_ARCHAEOLOGIST("Crazy archaeologist", 30, ChronoUnit.SECONDS, ItemID.FEDORA),
|
||||||
SCORPIA("Scorpia", 10, ChronoUnit.SECONDS, "scorpia"),
|
KING_BLACK_DRAGON("King Black Dragon", 10, ChronoUnit.SECONDS, ItemID.PRINCE_BLACK_DRAGON),
|
||||||
VENENATIS("Venenatis", 30, ChronoUnit.SECONDS, "venenatis"),
|
SCORPIA("Scorpia", 10, ChronoUnit.SECONDS, ItemID.SCORPIAS_OFFSPRING),
|
||||||
VETION("Vet'ion", 30, ChronoUnit.SECONDS, "vetion"),
|
VENENATIS("Venenatis", 30, ChronoUnit.SECONDS, ItemID.VENENATIS_SPIDERLING),
|
||||||
DAGANNOTH_PRIME("Dagannoth Prime", 90, ChronoUnit.SECONDS, "prime"),
|
VETION("Vet'ion", 30, ChronoUnit.SECONDS, ItemID.VETION_JR),
|
||||||
DAGANNOTH_REX("Dagannoth Rex", 90, ChronoUnit.SECONDS, "rex"),
|
DAGANNOTH_PRIME("Dagannoth Prime", 90, ChronoUnit.SECONDS, ItemID.PET_DAGANNOTH_PRIME),
|
||||||
DAGANNOTH_SUPREME("Dagannoth Supreme", 90, ChronoUnit.SECONDS, "supreme"),
|
DAGANNOTH_REX("Dagannoth Rex", 90, ChronoUnit.SECONDS, ItemID.PET_DAGANNOTH_REX),
|
||||||
CORPOREAL_BEAST("Corporeal Beast", 30, ChronoUnit.SECONDS, "corp"),
|
DAGANNOTH_SUPREME("Dagannoth Supreme", 90, ChronoUnit.SECONDS, ItemID.PET_DAGANNOTH_SUPREME),
|
||||||
GIANT_MOLE("Giant Mole", 10, ChronoUnit.SECONDS, "mole");
|
CORPOREAL_BEAST("Corporeal Beast", 30, ChronoUnit.SECONDS, ItemID.PET_DARK_CORE),
|
||||||
|
GIANT_MOLE("Giant Mole", 10, ChronoUnit.SECONDS, ItemID.BABY_MOLE);
|
||||||
|
|
||||||
private static final Map<String, Boss> bosses = new HashMap<>();
|
private static final Map<String, Boss> bosses = new HashMap<>();
|
||||||
|
|
||||||
private final String name;
|
private final String name;
|
||||||
private final Duration spawnTime;
|
private final Duration spawnTime;
|
||||||
private final String imageResource;
|
private final int itemSpriteId;
|
||||||
|
|
||||||
private BufferedImage image;
|
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
@@ -71,11 +67,11 @@ enum Boss
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boss(String name, long period, ChronoUnit unit, String imageResource)
|
private Boss(String name, long period, ChronoUnit unit, int itemSpriteId)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.spawnTime = Duration.of(period, unit);
|
this.spawnTime = Duration.of(period, unit);
|
||||||
this.imageResource = imageResource;
|
this.itemSpriteId = itemSpriteId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
@@ -88,24 +84,9 @@ enum Boss
|
|||||||
return spawnTime;
|
return spawnTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BufferedImage getImage()
|
public int getItemSpriteId()
|
||||||
{
|
{
|
||||||
if (image != null)
|
return itemSpriteId;
|
||||||
{
|
|
||||||
return image;
|
|
||||||
}
|
|
||||||
|
|
||||||
InputStream in = Boss.class.getResourceAsStream(imageResource + ".png");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
image = ImageIO.read(in);
|
|
||||||
}
|
|
||||||
catch (IOException ex)
|
|
||||||
{
|
|
||||||
log.warn("unable to load image", ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
return image;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Boss find(String name)
|
public static Boss find(String name)
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import javax.inject.Inject;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import net.runelite.api.Actor;
|
import net.runelite.api.Actor;
|
||||||
import net.runelite.api.events.ActorDeath;
|
import net.runelite.api.events.ActorDeath;
|
||||||
|
import net.runelite.client.game.ItemManager;
|
||||||
import net.runelite.client.plugins.Plugin;
|
import net.runelite.client.plugins.Plugin;
|
||||||
import net.runelite.client.plugins.PluginDescriptor;
|
import net.runelite.client.plugins.PluginDescriptor;
|
||||||
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
import net.runelite.client.ui.overlay.infobox.InfoBoxManager;
|
||||||
@@ -43,6 +44,9 @@ public class BossTimersPlugin extends Plugin
|
|||||||
@Inject
|
@Inject
|
||||||
private InfoBoxManager infoBoxManager;
|
private InfoBoxManager infoBoxManager;
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
private ItemManager itemManager;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void shutDown() throws Exception
|
protected void shutDown() throws Exception
|
||||||
{
|
{
|
||||||
@@ -65,7 +69,8 @@ public class BossTimersPlugin extends Plugin
|
|||||||
|
|
||||||
log.debug("Creating spawn timer for {} ({} seconds)", actor.getName(), boss.getSpawnTime());
|
log.debug("Creating spawn timer for {} ({} seconds)", actor.getName(), boss.getSpawnTime());
|
||||||
|
|
||||||
RespawnTimer timer = new RespawnTimer(boss);
|
RespawnTimer timer = new RespawnTimer(boss, itemManager.getImage(boss.getItemSpriteId()));
|
||||||
|
timer.setTooltip(boss.getName());
|
||||||
infoBoxManager.addInfoBox(timer);
|
infoBoxManager.addInfoBox(timer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
package net.runelite.client.plugins.bosstimer;
|
package net.runelite.client.plugins.bosstimer;
|
||||||
|
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import net.runelite.client.ui.overlay.infobox.Timer;
|
import net.runelite.client.ui.overlay.infobox.Timer;
|
||||||
|
|
||||||
@@ -31,9 +32,9 @@ class RespawnTimer extends Timer
|
|||||||
{
|
{
|
||||||
private final Boss boss;
|
private final Boss boss;
|
||||||
|
|
||||||
public RespawnTimer(Boss boss)
|
public RespawnTimer(Boss boss, BufferedImage bossImage)
|
||||||
{
|
{
|
||||||
super(boss.getSpawnTime().toMillis(), ChronoUnit.MILLIS, boss.getImage());
|
super(boss.getSpawnTime().toMillis(), ChronoUnit.MILLIS, bossImage);
|
||||||
this.boss = boss;
|
this.boss = boss;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 2.3 KiB |