diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/BurnerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/BurnerOverlay.java new file mode 100644 index 0000000000..be1ad2344a --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poh/BurnerOverlay.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2018, Seth + * 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.poh; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.api.GameObject; +import net.runelite.api.Perspective; +import net.runelite.api.Point; +import static net.runelite.client.plugins.poh.PohPlugin.BURNER_LIT; +import static net.runelite.client.plugins.poh.PohPlugin.BURNER_UNLIT; +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.OverlayUtil; +import net.runelite.client.ui.overlay.components.TextComponent; + +public class BurnerOverlay extends Overlay +{ + private final Client client; + private final PohConfig config; + private final PohPlugin plugin; + private final TextComponent textComponent = new TextComponent(); + + @Inject + public BurnerOverlay(Client client, PohConfig config, PohPlugin plugin) + { + setPosition(OverlayPosition.DYNAMIC); + setLayer(OverlayLayer.ABOVE_SCENE); + this.client = client; + this.config = config; + this.plugin = plugin; + } + + @Override + public Dimension render(Graphics2D graphics, java.awt.Point parent) + { + if (!config.enabled() || !config.showBurner()) + { + return null; + } + + for (GameObject object : plugin.getPohObjects()) + { + if (BURNER_UNLIT.contains(object.getId())) + { + drawBurner(graphics, "Unlit", object, Color.RED, parent); + } + else if (BURNER_LIT.contains(object.getId())) + { + drawBurner(graphics, "Lit", object, Color.GREEN, parent); + } + } + return null; + } + + private void drawBurner(Graphics2D graphics, String text, GameObject gameObject, Color color, java.awt.Point parent) + { + Point canvasText = Perspective.getCanvasTextLocation(client, graphics, gameObject.getLocalLocation(), text, 200); + + if (canvasText == null) + { + return; + } + + textComponent.setText(text); + textComponent.setPosition(new java.awt.Point(canvasText.getX(), canvasText.getY())); + textComponent.setColor(color); + textComponent.render(graphics, parent); + + //render tile + OverlayUtil.renderPolygon(graphics, gameObject.getCanvasTilePoly(), color); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohConfig.java new file mode 100644 index 0000000000..f630c81b44 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohConfig.java @@ -0,0 +1,247 @@ +/* + * Copyright (c) 2018, Seth + * 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.poh; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup( + keyName = "poh", + name = "Poh", + description = "Configuration for the POH plugin" +) +public interface PohConfig extends Config +{ + @ConfigItem( + keyName = "enabled", + name = "Enabled", + description = "Configures whether or not the POH plugin is displayed" + ) + default boolean enabled() + { + return true; + } + + @ConfigItem( + keyName = "showVarrock", + name = "Show Varrock portal", + description = "Configures whether or not the Varrock portal is displayed" + ) + default boolean showVarrock() + { + return true; + } + + @ConfigItem( + keyName = "showFalador", + name = "Show Falador portal", + description = "Configures whether or not the Camelot portal is displayed" + ) + default boolean showFalador() + { + return true; + } + + @ConfigItem( + keyName = "showLumbridge", + name = "Show Lumbridge portal", + description = "Configures whether or not the Lumbridge portal is displayed" + ) + default boolean showLumbridge() + { + return true; + } + + @ConfigItem( + keyName = "showCamelot", + name = "Show Camelot portal", + description = "Configures whether or not the Camelot portal is displayed" + ) + default boolean showCamelot() + { + return true; + } + + @ConfigItem( + keyName = "showArdougne", + name = "Show Ardougne portal", + description = "Configures whether or not the Ardougne portal is displayed" + ) + default boolean showArdougne() + { + return true; + } + + @ConfigItem( + keyName = "showYanille", + name = "Show Yanille portal", + description = "Configures whether or not the Yanille portal is displayed" + ) + default boolean showYanille() + { + return true; + } + + @ConfigItem( + keyName = "showLunarIsle", + name = "Show Lunar isle portal", + description = "Configures whether or not the Lunar isle portal is displayed" + ) + default boolean showLunarIsle() + { + return true; + } + + @ConfigItem( + keyName = "showWaterBirth", + name = "Show Waterbirth portal", + description = "Configures whether or not the Waterbirth portal is displayed" + ) + default boolean showWaterBirth() + { + return true; + } + + @ConfigItem( + keyName = "showFishingGuild", + name = "Show Fishing guild portal", + description = "Configures whether or not the Fishing guild portal is displayed" + ) + default boolean showFishingGuild() + { + return true; + } + + @ConfigItem( + keyName = "showSenntisten", + name = "Show Senntisten portal", + description = "Configures whether or not the Senntisten portal is displayed" + ) + default boolean showSenntisten() + { + return true; + } + + @ConfigItem( + keyName = "showKharyll", + name = "Show Kharyll portal", + description = "Configures whether or not the Kharyll portal is displayed" + ) + default boolean showKharyll() + { + return true; + } + + @ConfigItem( + keyName = "showAnnakarl", + name = "Show Annakarl portal", + description = "Configures whether or not the Annakarl portal is displayed" + ) + default boolean showAnnakarl() + { + return true; + } + + @ConfigItem( + keyName = "showKourend", + name = "Show Kourend portal", + description = "Configures whether or not the Kourend portal is displayed" + ) + default boolean showKourend() + { + return true; + } + + @ConfigItem( + keyName = "showMarim", + name = "Show Marim portal", + description = "Configures whether or not the Marim portal is displayed" + ) + default boolean showMarim() + { + return true; + } + + @ConfigItem( + keyName = "showAltar", + name = "Show Altar", + description = "Configures whether or not the altar is displayed" + ) + default boolean showAltar() + { + return true; + } + + @ConfigItem( + keyName = "showGlory", + name = "Show Glory mount", + description = "Configures whether or not the mounted glory is displayed" + ) + default boolean showGlory() + { + return true; + } + + @ConfigItem( + keyName = "showPools", + name = "Show Pools", + description = "Configures whether or not the pools are displayed" + ) + default boolean showPools() + { + return true; + } + + @ConfigItem( + keyName = "showRepairStand", + name = "Show Repair stand", + description = "Configures whether or not the repair stand is displayed" + ) + default boolean showRepairStand() + { + return true; + } + + @ConfigItem( + keyName = "showExitPortal", + name = "Show Exit portal", + description = "Configures whether or not the exit portal is displayed" + ) + default boolean showExitPortal() + { + return true; + } + + @ConfigItem( + keyName = "showBurner", + name = "Show Unlit/Lit burner", + description = "Configures whether or not unlit/lit burners are displayed" + ) + default boolean showBurner() + { + return true; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java new file mode 100644 index 0000000000..0ef8d59c3e --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohIcons.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2018, Seth + * 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.poh; + +import java.awt.image.BufferedImage; +import java.io.IOException; +import java.io.InputStream; +import java.util.HashMap; +import java.util.Map; +import javax.imageio.ImageIO; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import static net.runelite.api.ObjectID.*; + +@Slf4j +public enum PohIcons +{ + EXITPORTAL("exitportal", PORTAL_4525), + VARROCK("varrock", VARROCK_PORTAL, VARROCK_PORTAL_13622, VARROCK_PORTAL_13629), + FALADOR("falador", FALADOR_PORTAL, FALADOR_PORTAL_13624, FALADOR_PORTAL_13631), + LUMBRIDGE("lumbridge", LUMBRIDGE_PORTAL, LUMBRIDGE_PORTAL_13623, LUMBRIDGE_PORTAL_13630), + ARDOUGNE("ardougne", ARDOUGNE_PORTAL, ARDOUGNE_PORTAL_13626, ARDOUGNE_PORTAL_13633), + YANILLE("yanille", YANILLE_PORTAL, YANILLE_PORTAL_13627, YANILLE_PORTAL_13634), + CAMELOT("camelot", CAMELOT_PORTAL, CAMELOT_PORTAL_13625, CAMELOT_PORTAL_13632), + LUNARISLE("lunarisle", LUNAR_ISLE_PORTAL, LUNAR_ISLE_PORTAL_29347, LUNAR_ISLE_PORTAL_29355), + WATERBIRTH("waterbirth", WATERBIRTH_ISLAND_PORTAL, WATERBIRTH_ISLAND_PORTAL_29350, WATERBIRTH_ISLAND_PORTAL_29358), + FISHINGGUILD("fishingguild", FISHING_GUILD_PORTAL, FISHING_GUILD_PORTAL_29351, FISHING_GUILD_PORTAL_29359), + SENNTISTEN("senntisten", SENNTISTEN_PORTAL, SENNTISTEN_PORTAL_29348, SENNTISTEN_PORTAL_29356), + KHARYLL("kharyll", KHARYRLL_PORTAL, KHARYRLL_PORTAL_29346, KHARYRLL_PORTAL_29354), + ANNAKARL("annakarl", ANNAKARL_PORTAL, ANNAKARL_PORTAL_29349, ANNAKARL_PORTAL_29357), + KOUREND("kourend", KOUREND_PORTAL, KOUREND_PORTAL_29353, KOUREND_PORTAL_29361), + MARIM("marim", MARIM_PORTAL, MARIM_PORTAL_29352, MARIM_PORTAL_29360), + ALTAR("altar", + ALTAR_13179, ALTAR_13180, ALTAR_13181, ALTAR_13182, ALTAR_13183, ALTAR_13184, ALTAR_13185, ALTAR_13186, + ALTAR_13187, ALTAR_13188, ALTAR_13189, ALTAR_13190, ALTAR_13191, ALTAR_13192, ALTAR_13193, ALTAR_13194, + ALTAR_13194, ALTAR_13196, ALTAR_13197, ALTAR_13198, ALTAR_13199 + ), + POOLS("pool", POOL_OF_RESTORATION, POOL_OF_REVITALISATION, POOL_OF_REJUVENATION, FANCY_REJUVENATION_POOL, ORNATE_REJUVENATION_POOL), + GLORY("glory", AMULET_OF_GLORY), + REPAIR("repair", ARMOUR_REPAIR_STAND); + + private static final Map minimapIcons = new HashMap<>(); + + @Getter + private final String imageResource; + @Getter + private final int[] Ids; + + private BufferedImage image; + + static + { + PohIcons[] icons = values(); + + for (PohIcons icon : icons) + { + for (Integer spotId : icon.getIds()) + { + minimapIcons.put(spotId, icon); + } + } + } + + PohIcons(String imageResource, int... ids) + { + this.imageResource = imageResource; + this.Ids = ids; + } + + public static PohIcons getIcon(int id) + { + return minimapIcons.get(id); + } + + public BufferedImage getImage() + { + if (image != null) + { + return image; + } + + InputStream in = PohIcons.class.getResourceAsStream(getImageResource() + ".png"); + try + { + image = ImageIO.read(in); + } + catch (IOException ex) + { + log.warn("unable to load image", ex); + } + + return image; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohOverlay.java new file mode 100644 index 0000000000..728b5dc6a4 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohOverlay.java @@ -0,0 +1,193 @@ +/* + * Copyright (c) 2018, Seth + * 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.poh; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.util.ArrayList; +import java.util.List; +import javax.inject.Inject; +import lombok.Getter; +import net.runelite.api.Client; +import net.runelite.api.GameObject; +import net.runelite.api.Perspective; +import net.runelite.api.Point; +import static net.runelite.client.plugins.poh.PohIcons.ALTAR; +import static net.runelite.client.plugins.poh.PohIcons.ANNAKARL; +import static net.runelite.client.plugins.poh.PohIcons.ARDOUGNE; +import static net.runelite.client.plugins.poh.PohIcons.CAMELOT; +import static net.runelite.client.plugins.poh.PohIcons.EXITPORTAL; +import static net.runelite.client.plugins.poh.PohIcons.FALADOR; +import static net.runelite.client.plugins.poh.PohIcons.FISHINGGUILD; +import static net.runelite.client.plugins.poh.PohIcons.GLORY; +import static net.runelite.client.plugins.poh.PohIcons.KHARYLL; +import static net.runelite.client.plugins.poh.PohIcons.KOUREND; +import static net.runelite.client.plugins.poh.PohIcons.LUMBRIDGE; +import static net.runelite.client.plugins.poh.PohIcons.LUNARISLE; +import static net.runelite.client.plugins.poh.PohIcons.MARIM; +import static net.runelite.client.plugins.poh.PohIcons.POOLS; +import static net.runelite.client.plugins.poh.PohIcons.REPAIR; +import static net.runelite.client.plugins.poh.PohIcons.SENNTISTEN; +import static net.runelite.client.plugins.poh.PohIcons.VARROCK; +import static net.runelite.client.plugins.poh.PohIcons.WATERBIRTH; +import static net.runelite.client.plugins.poh.PohIcons.YANILLE; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayLayer; +import net.runelite.client.ui.overlay.OverlayPosition; + +public class PohOverlay extends Overlay +{ + private static final int MAX_DISTANCE = 2350; + + @Getter + private final List iconList = new ArrayList<>(); + + private final Client client; + private final PohConfig config; + private final PohPlugin plugin; + + @Inject + public PohOverlay(Client client, PohConfig config, PohPlugin plugin) + { + setPosition(OverlayPosition.DYNAMIC); + setLayer(OverlayLayer.ABOVE_WIDGETS); + this.client = client; + this.config = config; + this.plugin = plugin; + } + + @Override + public Dimension render(Graphics2D graphics, java.awt.Point parent) + { + if (!config.enabled()) + { + return null; + } + + Point localLocation = client.getLocalPlayer().getLocalLocation(); + + for (GameObject object : plugin.getPohObjects()) + { + Point location = object.getLocalLocation(); + if (localLocation.distanceTo(location) <= MAX_DISTANCE) + { + PohIcons icon = PohIcons.getIcon(object.getId()); + + if (icon != null && iconList.contains(icon)) + { + net.runelite.api.Point minimapLoc = Perspective.getMiniMapImageLocation(client, object.getLocalLocation(), icon.getImage()); + + if (minimapLoc != null) + { + graphics.drawImage(icon.getImage(), minimapLoc.getX(), minimapLoc.getY(), null); + } + } + } + } + + return null; + } + + public void updateConfig() + { + iconList.clear(); + if (config.showLumbridge()) + { + iconList.add(LUMBRIDGE); + } + if (config.showFalador()) + { + iconList.add(FALADOR); + } + if (config.showVarrock()) + { + iconList.add(VARROCK); + } + if (config.showCamelot()) + { + iconList.add(CAMELOT); + } + if (config.showArdougne()) + { + iconList.add(ARDOUGNE); + } + if (config.showYanille()) + { + iconList.add(YANILLE); + } + if (config.showLunarIsle()) + { + iconList.add(LUNARISLE); + } + if (config.showWaterBirth()) + { + iconList.add(WATERBIRTH); + } + if (config.showFishingGuild()) + { + iconList.add(FISHINGGUILD); + } + if (config.showSenntisten()) + { + iconList.add(SENNTISTEN); + } + if (config.showKharyll()) + { + iconList.add(KHARYLL); + } + if (config.showAnnakarl()) + { + iconList.add(ANNAKARL); + } + if (config.showKourend()) + { + iconList.add(KOUREND); + } + if (config.showMarim()) + { + iconList.add(MARIM); + } + if (config.showAltar()) + { + iconList.add(ALTAR); + } + if (config.showGlory()) + { + iconList.add(GLORY); + } + if (config.showRepairStand()) + { + iconList.add(REPAIR); + } + if (config.showPools()) + { + iconList.add(POOLS); + } + if (config.showExitPortal()) + { + iconList.add(EXITPORTAL); + } + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohPlugin.java new file mode 100644 index 0000000000..890c26e7c3 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/poh/PohPlugin.java @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2018, Seth + * 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.poh; + +import com.google.common.collect.Sets; +import com.google.common.eventbus.Subscribe; +import com.google.inject.Binder; +import com.google.inject.Provides; +import java.util.Arrays; +import java.util.Collection; +import java.util.HashSet; +import java.util.Set; +import javax.inject.Inject; +import lombok.AccessLevel; +import lombok.Getter; +import net.runelite.api.GameObject; +import net.runelite.api.GameState; +import static net.runelite.api.ObjectID.INCENSE_BURNER; +import static net.runelite.api.ObjectID.INCENSE_BURNER_13209; +import static net.runelite.api.ObjectID.INCENSE_BURNER_13210; +import static net.runelite.api.ObjectID.INCENSE_BURNER_13211; +import static net.runelite.api.ObjectID.INCENSE_BURNER_13212; +import static net.runelite.api.ObjectID.INCENSE_BURNER_13213; +import net.runelite.api.events.ConfigChanged; +import net.runelite.api.events.GameObjectDespawned; +import net.runelite.api.events.GameObjectSpawned; +import net.runelite.api.events.GameStateChanged; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.ui.overlay.Overlay; + +@PluginDescriptor( + name = "Poh plugin" +) +public class PohPlugin extends Plugin +{ + static final Set BURNER_UNLIT = Sets.newHashSet(INCENSE_BURNER, INCENSE_BURNER_13210, INCENSE_BURNER_13212); + static final Set BURNER_LIT = Sets.newHashSet(INCENSE_BURNER_13209, INCENSE_BURNER_13211, INCENSE_BURNER_13213); + + @Getter(AccessLevel.PACKAGE) + private final Set pohObjects = new HashSet<>(); + + @Inject + private PohOverlay overlay; + + @Inject + private BurnerOverlay burnerOverlay; + + @Override + public void configure(Binder binder) + { + binder.bind(PohOverlay.class); + } + + @Provides + PohConfig getConfig(ConfigManager configManager) + { + return configManager.getConfig(PohConfig.class); + } + + @Override + public Collection getOverlays() + { + return Arrays.asList(overlay, burnerOverlay); + } + + @Override + protected void startUp() throws Exception + { + overlay.updateConfig(); + } + + @Subscribe + public void updateConfig(ConfigChanged event) + { + overlay.updateConfig(); + } + + @Subscribe + public void onGameObjectSpawned(GameObjectSpawned event) + { + GameObject gameObject = event.getGameObject(); + if (BURNER_LIT.contains(gameObject.getId()) || BURNER_UNLIT.contains(gameObject.getId()) || PohIcons.getIcon(gameObject.getId()) != null) + { + pohObjects.add(gameObject); + } + } + + @Subscribe + public void onGameObjectDespawned(GameObjectDespawned event) + { + GameObject gameObject = event.getGameObject(); + pohObjects.remove(gameObject); + } + + @Subscribe + public void onGameStateChanged(GameStateChanged event) + { + if (event.getGameState() == GameState.LOADING) + { + pohObjects.clear(); + } + } +} diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/altar.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/altar.png new file mode 100644 index 0000000000..fa583ed3e7 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/altar.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/annakarl.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/annakarl.png new file mode 100644 index 0000000000..29d47b56a6 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/annakarl.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/ardougne.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/ardougne.png new file mode 100644 index 0000000000..12f84eb817 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/ardougne.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/camelot.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/camelot.png new file mode 100644 index 0000000000..9b54f1747b Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/camelot.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/exitportal.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/exitportal.png new file mode 100644 index 0000000000..350fd4f239 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/exitportal.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/falador.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/falador.png new file mode 100644 index 0000000000..4d68d9e5f8 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/falador.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/fishingguild.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/fishingguild.png new file mode 100644 index 0000000000..411fbf47b8 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/fishingguild.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/glory.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/glory.png new file mode 100644 index 0000000000..4189c86a3b Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/glory.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kharyll.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kharyll.png new file mode 100644 index 0000000000..516dee8848 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kharyll.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kourend.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kourend.png new file mode 100644 index 0000000000..f261e59ebe Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/kourend.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lumbridge.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lumbridge.png new file mode 100644 index 0000000000..111fe1a802 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lumbridge.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lunarisle.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lunarisle.png new file mode 100644 index 0000000000..1845b6a17f Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/lunarisle.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/marim.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/marim.png new file mode 100644 index 0000000000..f3336931b7 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/marim.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/pool.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/pool.png new file mode 100644 index 0000000000..6b389f5732 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/pool.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/repair.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/repair.png new file mode 100644 index 0000000000..58d75529c4 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/repair.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/senntisten.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/senntisten.png new file mode 100644 index 0000000000..04b1339ad0 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/senntisten.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/varrock.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/varrock.png new file mode 100644 index 0000000000..803f403e42 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/varrock.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/waterbirth.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/waterbirth.png new file mode 100644 index 0000000000..e6984053e7 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/waterbirth.png differ diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/poh/yanille.png b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/yanille.png new file mode 100644 index 0000000000..30b9b27632 Binary files /dev/null and b/runelite-client/src/main/resources/net/runelite/client/plugins/poh/yanille.png differ