From 7370d3569bee24b20ba748eb24cf13755d86a29c Mon Sep 17 00:00:00 2001 From: Onvo Date: Sat, 23 Dec 2017 15:59:30 +0100 Subject: [PATCH] Add colors for impling types Resolves #250 --- .../plugins/implings/ImplingsConfig.java | 158 +++++++++++++++++- .../plugins/implings/ImplingsOverlay.java | 61 +++---- .../plugins/implings/ImplingsPlugin.java | 6 - 3 files changed, 189 insertions(+), 36 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java index cd664ae656..3a60eaf068 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsConfig.java @@ -24,6 +24,7 @@ */ package net.runelite.client.plugins.implings; +import java.awt.Color; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; @@ -41,6 +42,18 @@ public interface ImplingsConfig extends Config { @ConfigItem( + position = 0, + keyName = "enabled", + name = "Enabled", + description = "Configures whether or not the impling plugin is enabled" + ) + default boolean enabled() + { + return true; + } + + @ConfigItem( + position = 1, keyName = "showbaby", name = "Show Baby implings", description = "Configures whether or not Baby impling tags are displayed" @@ -51,6 +64,18 @@ public interface ImplingsConfig extends Config } @ConfigItem( + position = 2, + keyName = "babyColor", + name = "Baby impling color", + description = "Text color for Baby implings" + ) + default Color getBabyColor() + { + return new Color(177, 143, 179); + } + + @ConfigItem( + position = 3, keyName = "showyoung", name = "Show Young implings", description = "Configures whether or not Young impling tags are displayed" @@ -61,6 +86,18 @@ public interface ImplingsConfig extends Config } @ConfigItem( + position = 4, + keyName = "youngColor", + name = "Young impling color", + description = "Text color for Young implings" + ) + default Color getYoungColor() + { + return new Color(175, 164, 136); + } + + @ConfigItem( + position = 5, keyName = "showgourmet", name = "Show Gourmet implings", description = "Configures whether or not Gourmet impling tags are displayed" @@ -71,6 +108,18 @@ public interface ImplingsConfig extends Config } @ConfigItem( + position = 6, + keyName = "gourmetColor", + name = "Gourmet impling color", + description = "Text color for Gourmet implings" + ) + default Color getGourmetColor() + { + return new Color(169, 131, 98); + } + + @ConfigItem( + position = 7, keyName = "showearth", name = "Show Earth implings", description = "Configures whether or not Earth impling tags are displayed" @@ -81,6 +130,18 @@ public interface ImplingsConfig extends Config } @ConfigItem( + position = 8, + keyName = "earthColor", + name = "Earth impling color", + description = "Text color for Earth implings" + ) + default Color getEarthColor() + { + return new Color(62, 86, 64); + } + + @ConfigItem( + position = 9, keyName = "showessence", name = "Show Essence implings", description = "Configures whether or not Essence impling tags are displayed" @@ -91,6 +152,18 @@ public interface ImplingsConfig extends Config } @ConfigItem( + position = 10, + keyName = "essenceColor", + name = "Essence impling color", + description = "Text color for Essence implings" + ) + default Color getEssenceColor() + { + return new Color(32, 89, 90); + } + + @ConfigItem( + position = 11, keyName = "showeclectic", name = "Show Eclectic implings", description = "Configures whether or not Eclectic impling tags are displayed" @@ -101,6 +174,18 @@ public interface ImplingsConfig extends Config } @ConfigItem( + position = 12, + keyName = "eclecticColor", + name = "Eclectic impling color", + description = "Text color for Eclectic implings" + ) + default Color getEclecticColor() + { + return new Color(145, 155, 69); + } + + @ConfigItem( + position = 13, keyName = "shownature", name = "Show Nature implings", description = "Configures whether or not Nature impling tags are displayed" @@ -111,6 +196,18 @@ public interface ImplingsConfig extends Config } @ConfigItem( + position = 14, + keyName = "natureColor", + name = "Nature impling color", + description = "Text color for Nature implings" + ) + default Color getNatureColor() + { + return new Color(92, 138, 95); + } + + @ConfigItem( + position = 15, keyName = "showmagpie", name = "Show Magpie implings", description = "Configures whether or not Magpie impling tags are displayed" @@ -121,6 +218,18 @@ public interface ImplingsConfig extends Config } @ConfigItem( + position = 16, + keyName = "magpieColor", + name = "Ninja impling color", + description = "Text color for Magpie implings" + ) + default Color getMapgieColor() + { + return new Color(142, 142, 19); + } + + @ConfigItem( + position = 17, keyName = "showninja", name = "Show Ninja implings", description = "Configures whether or not Ninja impling tags are displayed" @@ -131,6 +240,18 @@ public interface ImplingsConfig extends Config } @ConfigItem( + position = 18, + keyName = "ninjaColor", + name = "Ninja impling color", + description = "Text color for Ninja implings" + ) + default Color getNinjaColor() + { + return new Color(71, 70, 75); + } + + @ConfigItem( + position = 19, keyName = "showdragon", name = "Show Dragon implings", description = "Configures whether or not Dragon impling tags are displayed" @@ -141,6 +262,18 @@ public interface ImplingsConfig extends Config } @ConfigItem( + position = 20, + keyName = "dragonColor", + name = "Dragon impling color", + description = "Text color for Dragon implings" + ) + default Color getDragonColor() + { + return new Color(210, 85, 75); + } + + @ConfigItem( + position = 21, keyName = "showlucky", name = "Show Lucky implings", description = "Configures whether or not Lucky impling tags are displayed" @@ -151,12 +284,35 @@ public interface ImplingsConfig extends Config } @ConfigItem( + position = 22, + keyName = "luckyColor", + name = "Lucky impling color", + description = "Text color for Lucky implings" + ) + default Color getLuckyColor() + { + return new Color(102, 7, 101); + } + + @ConfigItem( + position = 23, keyName = "showspawn", name = "Show Spawn locations", - description = "Configures whether or not spawn locations are displayed" + description = "Configures whether or not spawn locations are displayed in Puro Puro" ) default boolean showSpawn() { return false; } + + @ConfigItem( + position = 24, + keyName = "spawnColor", + name = "Impling spawn color", + description = "Text color for impling spawns in Puro Puro" + ) + default Color getSpawnColor() + { + return Color.WHITE; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsOverlay.java index ab8347bdc9..159a6dea1c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsOverlay.java @@ -30,9 +30,10 @@ import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; import java.awt.Polygon; -import java.util.LinkedList; -import java.util.List; +import java.util.HashMap; +import java.util.Map; import javax.inject.Inject; +import lombok.Getter; import net.runelite.api.Actor; import net.runelite.api.NPC; import net.runelite.api.NpcID; @@ -55,7 +56,9 @@ public class ImplingsOverlay extends Overlay private final QueryRunner queryRunner; private final ImplingsConfig config; - private final List ids = new LinkedList<>(); + + @Getter + private final Map ids = new HashMap<>(); @Inject public ImplingsOverlay(QueryRunner queryRunner, ImplingsConfig config) @@ -68,13 +71,13 @@ public class ImplingsOverlay extends Overlay @Override public Dimension render(Graphics2D graphics, java.awt.Point parent) { - NPCQuery implingQuery = new NPCQuery().idEquals(Ints.toArray(ids)); + NPCQuery implingQuery = new NPCQuery().idEquals(Ints.toArray(ids.keySet())); NPC[] implings = queryRunner.runQuery(implingQuery); for (NPC imp : implings) { //Spawns have the name "null", so they get changed to "Spawn" String text = imp.getName().equals("null") ? "Spawn" : imp.getName(); - drawImp(graphics, imp, text, Color.WHITE); + drawImp(graphics, imp, text, ids.get(imp.getId())); } return null; @@ -86,63 +89,63 @@ public class ImplingsOverlay extends Overlay ids.clear(); if (config.showBaby()) { - ids.add(NpcID.BABY_IMPLING); - ids.add(NpcID.BABY_IMPLING_1645); + ids.put(NpcID.BABY_IMPLING, config.getBabyColor()); + ids.put(NpcID.BABY_IMPLING_1645, config.getBabyColor()); } if (config.showYoung()) { - ids.add(NpcID.YOUNG_IMPLING); - ids.add(NpcID.YOUNG_IMPLING_1646); + ids.put(NpcID.YOUNG_IMPLING, config.getYoungColor()); + ids.put(NpcID.YOUNG_IMPLING_1646, config.getYoungColor()); } if (config.showGourmet()) { - ids.add(NpcID.GOURMET_IMPLING); - ids.add(NpcID.GOURMET_IMPLING_1647); + ids.put(NpcID.GOURMET_IMPLING, config.getGourmetColor()); + ids.put(NpcID.GOURMET_IMPLING_1647, config.getGourmetColor()); } if (config.showEarth()) { - ids.add(NpcID.EARTH_IMPLING); - ids.add(NpcID.EARTH_IMPLING_1648); + ids.put(NpcID.EARTH_IMPLING, config.getEarthColor()); + ids.put(NpcID.EARTH_IMPLING_1648, config.getEarthColor()); } if (config.showEssence()) { - ids.add(NpcID.ESSENCE_IMPLING); - ids.add(NpcID.ESSENCE_IMPLING_1649); + ids.put(NpcID.ESSENCE_IMPLING, config.getEssenceColor()); + ids.put(NpcID.ESSENCE_IMPLING_1649, config.getEssenceColor()); } if (config.showEclectic()) { - ids.add(NpcID.ECLECTIC_IMPLING); - ids.add(NpcID.ECLECTIC_IMPLING_1650); + ids.put(NpcID.ECLECTIC_IMPLING, config.getEclecticColor()); + ids.put(NpcID.ECLECTIC_IMPLING_1650, config.getEclecticColor()); } if (config.showNature()) { - ids.add(NpcID.NATURE_IMPLING); - ids.add(NpcID.NATURE_IMPLING_1651); + ids.put(NpcID.NATURE_IMPLING, config.getNatureColor()); + ids.put(NpcID.NATURE_IMPLING_1651, config.getNatureColor()); } if (config.showMagpie()) { - ids.add(NpcID.MAGPIE_IMPLING); - ids.add(NpcID.MAGPIE_IMPLING_1652); + ids.put(NpcID.MAGPIE_IMPLING, config.getMapgieColor()); + ids.put(NpcID.MAGPIE_IMPLING_1652, config.getMapgieColor()); } if (config.showNinja()) { - ids.add(NpcID.NINJA_IMPLING); - ids.add(NpcID.NINJA_IMPLING_1653); + ids.put(NpcID.NINJA_IMPLING, config.getNinjaColor()); + ids.put(NpcID.NINJA_IMPLING_1653, config.getNinjaColor()); } if (config.showDragon()) { - ids.add(NpcID.DRAGON_IMPLING); - ids.add(NpcID.DRAGON_IMPLING_1654); + ids.put(NpcID.DRAGON_IMPLING, config.getDragonColor()); + ids.put(NpcID.DRAGON_IMPLING_1654, config.getDragonColor()); } if (config.showLucky()) { - ids.add(NpcID.LUCKY_IMPLING); - ids.add(NpcID.LUCKY_IMPLING_7302); + ids.put(NpcID.LUCKY_IMPLING, config.getLuckyColor()); + ids.put(NpcID.LUCKY_IMPLING_7302, config.getLuckyColor()); } if (config.showSpawn()) { - ids.add(STATIC_SPAWN); - ids.add(DYNAMIC_SPAWN); + ids.put(STATIC_SPAWN, config.getSpawnColor()); + ids.put(DYNAMIC_SPAWN, config.getSpawnColor()); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsPlugin.java index a7bbed0a4f..7b376e10f0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/implings/ImplingsPlugin.java @@ -65,12 +65,6 @@ public class ImplingsPlugin extends Plugin overlay.updateConfig(); } - @Override - protected void shutDown() throws Exception - { - - } - @Override public Overlay getOverlay() {