From 1633c93aa1a51cb170023c9edb5f4b1fc41ac7b3 Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 16:44:54 -0700 Subject: [PATCH 001/117] Added hotkey setting in raidsconfig --- .../runelite/client/plugins/raids/RaidsConfig.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index 18dd050f81..048546f1da 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -27,6 +27,7 @@ package net.runelite.client.plugins.raids; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.Keybind; @ConfigGroup("raids") public interface RaidsConfig extends Config @@ -151,4 +152,16 @@ public interface RaidsConfig extends Config { return ""; } + + @ConfigItem( + keyName = "hotkey", + name = "Disable/Enable scout overlay hotkey", + description = "When you press this key the scout overlay will be hidden/displayed.", + position = 11 + ) + default Keybind hotkey() + { + return Keybind.NOT_SET; + } + } From 8cf4b06079b3952d0a46f3cbb55bc799f79aca68 Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 17:24:32 -0700 Subject: [PATCH 002/117] Added getter for scoutOverlayShown var in RaidsOverlay --- .../java/net/runelite/client/plugins/raids/RaidsOverlay.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java index 682cacab69..c5236662a4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java @@ -29,6 +29,7 @@ import java.awt.Dimension; import java.awt.Graphics2D; import javax.inject.Inject; import lombok.Setter; +import lombok.Getter; import net.runelite.client.plugins.raids.solver.Room; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayPosition; @@ -43,7 +44,7 @@ public class RaidsOverlay extends Overlay private RaidsConfig config; private final PanelComponent panelComponent = new PanelComponent(); - @Setter + @Getter @Setter private boolean scoutOverlayShown = false; @Inject From 942f0887c59b289cd433f5d97ed0688985d1386a Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 18:08:04 -0700 Subject: [PATCH 003/117] Cleaned up config and description --- .../client/plugins/raids/RaidsConfig.java | 35 +++++++++---------- 1 file changed, 17 insertions(+), 18 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index 048546f1da..380fefd320 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -87,8 +87,19 @@ public interface RaidsConfig extends Config return false; } + @ConfigItem( + keyName = "hotkey", + name = "Scout overlay hotkey", + description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid", + position = 5 + ) + default Keybind hotkey() + { + return Keybind.NOT_SET; + } + @ConfigItem( - position = 5, + position = 6, keyName = "whitelistedRooms", name = "Whitelisted rooms", description = "Display whitelisted rooms in green on the overlay. Separate with comma (full name)" @@ -99,7 +110,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 6, + position = 7, keyName = "blacklistedRooms", name = "Blacklisted rooms", description = "Display blacklisted rooms in red on the overlay. Separate with comma (full name)" @@ -110,7 +121,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 7, + position = 8, keyName = "enableRotationWhitelist", name = "Enable rotation whitelist", description = "Enable the rotation whitelist" @@ -121,7 +132,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 8, + position = 9, keyName = "whitelistedRotations", name = "Whitelisted rotations", description = "Warn when boss rotation doesn't match a whitelisted one. Add rotations like [tekton, muttadile, guardians]" @@ -132,7 +143,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 9, + position = 10, keyName = "enableLayoutWhitelist", name = "Enable layout whitelist", description = "Enable the layout whitelist" @@ -143,7 +154,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 10, + position = 11, keyName = "whitelistedLayouts", name = "Whitelisted layouts", description = "Warn when layout doesn't match a whitelisted one. Add layouts like CFSCPPCSCF separated with comma" @@ -152,16 +163,4 @@ public interface RaidsConfig extends Config { return ""; } - - @ConfigItem( - keyName = "hotkey", - name = "Disable/Enable scout overlay hotkey", - description = "When you press this key the scout overlay will be hidden/displayed.", - position = 11 - ) - default Keybind hotkey() - { - return Keybind.NOT_SET; - } - } From d18cabb9725e3ff3ba7cdfad0322887a14439b22 Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 18:14:05 -0700 Subject: [PATCH 004/117] Implemented hotkey functionality for disabling/enabling the scout overlay. --- .../client/plugins/raids/RaidsPlugin.java | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 1a96b63d8a..6724c644dc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -59,6 +59,7 @@ import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.QueuedMessage; import net.runelite.client.config.ConfigManager; import net.runelite.client.game.SpriteManager; +import net.runelite.client.input.KeyManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.raids.solver.Layout; @@ -66,6 +67,7 @@ import net.runelite.client.plugins.raids.solver.LayoutSolver; import net.runelite.client.plugins.raids.solver.RotationSolver; import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; +import net.runelite.client.util.HotkeyListener; import net.runelite.client.util.Text; @PluginDescriptor( @@ -109,6 +111,9 @@ public class RaidsPlugin extends Plugin @Inject private LayoutSolver layoutSolver; + @Inject + private KeyManager keyManager; + @Inject private SpriteManager spriteManager; @@ -130,6 +135,8 @@ public class RaidsPlugin extends Plugin @Getter private boolean inRaidChambers; + private boolean raidStarted; + private RaidsTimer timer; @Provides @@ -149,6 +156,7 @@ public class RaidsPlugin extends Plugin { overlayManager.add(overlay); overlayManager.add(pointsOverlay); + keyManager.registerKeyListener(hotkeyListener); updateLists(); checkRaidPresence(true); } @@ -159,7 +167,9 @@ public class RaidsPlugin extends Plugin overlayManager.remove(overlay); overlayManager.remove(pointsOverlay); infoBoxManager.removeInfoBox(timer); + keyManager.unregisterKeyListener(hotkeyListener); inRaidChambers = false; + raidStarted = false; raid = null; timer = null; } @@ -215,6 +225,7 @@ public class RaidsPlugin extends Plugin { timer = new RaidsTimer(spriteManager.getSprite(TAB_QUESTS_BROWN_RAIDING_PARTY, 0), this, Instant.now()); infoBoxManager.addInfoBox(timer); + raidStarted = true; } if (timer != null && message.contains(LEVEL_COMPLETE_MESSAGE)) @@ -309,6 +320,7 @@ public class RaidsPlugin extends Plugin if (client.getVar(VarPlayer.IN_RAID_PARTY) == -1 && (!inRaidChambers || !config.scoutOverlayInRaid())) { overlay.setScoutOverlayShown(false); + raidStarted = false; } } @@ -599,4 +611,24 @@ public class RaidsPlugin extends Plugin return room; } + + private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.hotkey()) + { + @Override + public void hotkeyPressed() + { + if(config.scoutOverlayInRaid() && raidStarted) + { + if(overlay.isScoutOverlayShown()) + { + overlay.setScoutOverlayShown(false); + } + else + { + overlay.setScoutOverlayShown(true); + } + } + } + }; + } From 41d1ee7c51cc1d44aa733467791c029a3acd0b9a Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 18:56:06 -0700 Subject: [PATCH 005/117] Test ci --- .../java/net/runelite/client/plugins/raids/RaidsConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index 380fefd320..39fcc1311e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -89,7 +89,7 @@ public interface RaidsConfig extends Config @ConfigItem( keyName = "hotkey", - name = "Scout overlay hotkey", + name = "Toggle scout overlay", description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid", position = 5 ) From eccab3b535263a6938c34de26682161fe53b64d3 Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 19:03:56 -0700 Subject: [PATCH 006/117] Checkstyle fix --- .../client/plugins/raids/RaidsConfig.java | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index 39fcc1311e..41eb01e893 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -87,16 +87,15 @@ public interface RaidsConfig extends Config return false; } - @ConfigItem( - keyName = "hotkey", - name = "Toggle scout overlay", - description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid", - position = 5 - ) - default Keybind hotkey() - { - return Keybind.NOT_SET; - } + @ConfigItem( + keyName = "hotkey", name = "Toggle scout overlay", + description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid", + position = 5 + ) + default Keybind hotkey() + { + return Keybind.NOT_SET; + } @ConfigItem( position = 6, From 578881a03a50940822fa0a423c4d7a6ef8bfe3dc Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 19:04:47 -0700 Subject: [PATCH 007/117] Checkstyle fix --- .../java/net/runelite/client/plugins/raids/RaidsPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 6724c644dc..2cc16a4ca0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -617,9 +617,9 @@ public class RaidsPlugin extends Plugin @Override public void hotkeyPressed() { - if(config.scoutOverlayInRaid() && raidStarted) + if (config.scoutOverlayInRaid() && raidStarted) { - if(overlay.isScoutOverlayShown()) + if (overlay.isScoutOverlayShown()) { overlay.setScoutOverlayShown(false); } From b2d7cbbe44cec5bdd6f6fba95123d105f951e128 Mon Sep 17 00:00:00 2001 From: MackBryan Date: Tue, 4 Sep 2018 19:13:23 -0700 Subject: [PATCH 008/117] Checkstyle fix --- .../java/net/runelite/client/plugins/raids/RaidsPlugin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 2cc16a4ca0..768f193db8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -135,7 +135,7 @@ public class RaidsPlugin extends Plugin @Getter private boolean inRaidChambers; - private boolean raidStarted; + private boolean raidStarted; private RaidsTimer timer; @@ -320,7 +320,7 @@ public class RaidsPlugin extends Plugin if (client.getVar(VarPlayer.IN_RAID_PARTY) == -1 && (!inRaidChambers || !config.scoutOverlayInRaid())) { overlay.setScoutOverlayShown(false); - raidStarted = false; + raidStarted = false; } } From 5ef2fef60bb78f18f821c901565dc3f09747e4ea Mon Sep 17 00:00:00 2001 From: TheStonedTurtle Date: Fri, 12 Apr 2019 06:41:27 -0700 Subject: [PATCH 009/117] Add npc stats to NPCManager & remove npc_health.json Also updates all plugins that relied on the old NPCManager method --- .../net/runelite/http/api/npc/NPCClient.java | 79 ++ .../net/runelite/http/api/npc/NPCStats.java | 75 ++ .../net/runelite/client/game/NPCManager.java | 84 +- .../opponentinfo/OpponentInfoOverlay.java | 2 +- .../plugins/slayer/TargetWeaknessOverlay.java | 4 +- .../plugins/xptracker/XpTrackerPlugin.java | 4 +- .../src/main/resources/npc_health.json | 1161 ----------------- 7 files changed, 224 insertions(+), 1185 deletions(-) create mode 100644 http-api/src/main/java/net/runelite/http/api/npc/NPCClient.java create mode 100644 http-api/src/main/java/net/runelite/http/api/npc/NPCStats.java delete mode 100644 runelite-client/src/main/resources/npc_health.json diff --git a/http-api/src/main/java/net/runelite/http/api/npc/NPCClient.java b/http-api/src/main/java/net/runelite/http/api/npc/NPCClient.java new file mode 100644 index 0000000000..f1104bb791 --- /dev/null +++ b/http-api/src/main/java/net/runelite/http/api/npc/NPCClient.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2019, TheStonedTurtle + * 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.http.api.npc; + +import com.google.gson.JsonParseException; +import com.google.gson.reflect.TypeToken; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.lang.reflect.Type; +import java.util.Map; +import net.runelite.http.api.RuneLiteAPI; +import okhttp3.HttpUrl; +import okhttp3.Request; +import okhttp3.Response; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class NPCClient +{ + private static final Logger logger = LoggerFactory.getLogger(NPCClient.class); + + public Map getStats() throws IOException + { + final HttpUrl.Builder urlBuilder = RuneLiteAPI.getStaticBase().newBuilder() + .addPathSegment("npc") + .addPathSegment("stats.min.json"); + + final HttpUrl url = urlBuilder.build(); + + logger.debug("Built URI: {}", url); + + final Request request = new Request.Builder() + .url(url) + .build(); + + try (final Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) + { + if (!response.isSuccessful()) + { + logger.warn("Error looking up npc stats: {}", response); + return null; + } + + InputStream in = response.body().byteStream(); + final Type typeToken = new TypeToken>() + { + }.getType(); + + return RuneLiteAPI.GSON.fromJson(new InputStreamReader(in), typeToken); + } + catch (JsonParseException ex) + { + throw new IOException(ex); + } + } +} diff --git a/http-api/src/main/java/net/runelite/http/api/npc/NPCStats.java b/http-api/src/main/java/net/runelite/http/api/npc/NPCStats.java new file mode 100644 index 0000000000..8ee5761a21 --- /dev/null +++ b/http-api/src/main/java/net/runelite/http/api/npc/NPCStats.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2019, TheStonedTurtle + * 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.http.api.npc; + +import lombok.Value; + +@Value +public class NPCStats +{ + private final String name; + + private final int hitpoints; + private final int combatLevel; + private final int slayerLevel; + + private final int attackLevel; + private final int strengthLevel; + private final int defenceLevel; + private final int rangeLevel; + private final int magicLevel; + + private final int stab; + private final int slash; + private final int crush; + private final int range; + private final int magic; + + private final int stabDef; + private final int slashDef; + private final int crushDef; + private final int rangeDef; + private final int magicDef; + + private final int bonusAttack; + private final int bonusStrength; + private final int bonusRangeStrength; + private final int bonusMagicDamage; + + private final boolean poisonImmune; + private final boolean venomImmune; + + /** + * Based off the formula found here: http://services.runescape.com/m=forum/c=PLuJ4cy6gtA/forums.ws?317,318,712,65587452,209,337584542#209 + * @return bonus XP modifier + */ + public double calculateXpModifier() + { + final double averageLevel = Math.floor((attackLevel + strengthLevel + defenceLevel + hitpoints) / 4); + final double averageDefBonus = Math.floor((stabDef + slashDef + crushDef) / 3); + + return (1 + Math.floor(averageLevel * (averageDefBonus + bonusStrength + bonusAttack) / 5120) / 40); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/game/NPCManager.java b/runelite-client/src/main/java/net/runelite/client/game/NPCManager.java index f34d2c13ee..9725057168 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/NPCManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/NPCManager.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2018, Adam + * Copyright (c) 2019, TheStonedTurtle * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -24,42 +25,89 @@ */ package net.runelite.client.game; -import com.google.gson.Gson; -import com.google.gson.reflect.TypeToken; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.lang.reflect.Type; +import com.google.common.collect.ImmutableMap; +import java.io.IOException; import java.util.Map; import javax.annotation.Nullable; import javax.inject.Inject; import javax.inject.Singleton; +import lombok.extern.slf4j.Slf4j; +import net.runelite.http.api.npc.NPCClient; +import net.runelite.http.api.npc.NPCStats; @Singleton +@Slf4j public class NPCManager { - private final Map healthMap; + private final NPCClient NPCClient = new NPCClient(); + private final ImmutableMap statsMap; @Inject private NPCManager() { - final Gson gson = new Gson(); - final Type typeToken = new TypeToken>() - { - }.getType(); + this.statsMap = getStatsMap(); + } - final InputStream healthFile = getClass().getResourceAsStream("/npc_health.json"); - healthMap = gson.fromJson(new InputStreamReader(healthFile), typeToken); + private ImmutableMap getStatsMap() + { + try + { + final Map stats = NPCClient.getStats(); + if (stats != null) + { + log.debug("Loaded {} npc stats", stats.size()); + return ImmutableMap.copyOf(stats); + } + } + catch (IOException e) + { + log.warn("error loading stats!", e); + } + + return ImmutableMap.of(); } /** - * Returns health for target NPC based on it's combat level and name - * @param name npc name - * @param combatLevel npc combat level - * @return health or null if HP is unknown + * Returns the {@link NPCStats} for target NPC id + * @param npcId NPC id + * @return the {@link NPCStats} or null if unknown */ @Nullable - public Integer getHealth(final String name, final int combatLevel) + public NPCStats getStats(final int npcId) { - return healthMap.get(name + "_" + combatLevel); + return statsMap.get(npcId); + } + + /** + * Returns health for target NPC ID + * @param npcId NPC id + * @return health or null if unknown + */ + @Nullable + public Integer getHealth(final int npcId) + { + final NPCStats s = statsMap.get(npcId); + if (s == null || s.getHitpoints() == -1) + { + return null; + } + + return s.getHitpoints(); + } + + /** + * Returns the exp modifier for target NPC ID based on its stats. + * @param npcId NPC id + * @return npcs exp modifier. Assumes default xp rate if npc stats are unknown (returns 1) + */ + public double getXpModifier(final int npcId) + { + final NPCStats s = statsMap.get(npcId); + if (s == null) + { + return 1; + } + + return s.calculateXpModifier(); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java index 63432efa20..df0007f9ff 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/opponentinfo/OpponentInfoOverlay.java @@ -114,7 +114,7 @@ class OpponentInfoOverlay extends Overlay lastMaxHealth = null; if (opponent instanceof NPC) { - lastMaxHealth = npcManager.getHealth(opponentName, opponent.getCombatLevel()); + lastMaxHealth = npcManager.getHealth(((NPC) opponent).getId()); } else if (opponent instanceof Player) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetWeaknessOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetWeaknessOverlay.java index ada3f3a727..8a036eff83 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetWeaknessOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/TargetWeaknessOverlay.java @@ -40,7 +40,6 @@ 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.util.Text; class TargetWeaknessOverlay extends Overlay { @@ -109,8 +108,7 @@ class TargetWeaknessOverlay extends Overlay final int healthScale = target.getHealth(); final int healthRatio = target.getHealthRatio(); - final String targetName = Text.removeTags(target.getName()); - final Integer maxHealth = npcManager.getHealth(targetName, target.getCombatLevel()); + final Integer maxHealth = npcManager.getHealth(target.getId()); if (healthRatio < 0 || healthScale <= 0 || maxHealth == null) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java index a8d65962a5..6d3facde0f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/xptracker/XpTrackerPlugin.java @@ -296,7 +296,7 @@ public class XpTrackerPlugin extends Plugin if (interacting instanceof NPC && COMBAT.contains(skill)) { final NPC npc = (NPC) interacting; - xpState.updateNpcExperience(skill, npc, npcManager.getHealth(npc.getName(), npc.getCombatLevel())); + xpState.updateNpcExperience(skill, npc, npcManager.getHealth(npc.getId())); } final XpUpdateResult updateResult = xpState.updateSkill(skill, currentXp, startGoalXp, endGoalXp); @@ -328,7 +328,7 @@ public class XpTrackerPlugin extends Plugin for (Skill skill : COMBAT) { - final XpUpdateResult updateResult = xpState.updateNpcKills(skill, npc, npcManager.getHealth(npc.getName(), npc.getCombatLevel())); + final XpUpdateResult updateResult = xpState.updateNpcKills(skill, npc, npcManager.getHealth(npc.getId())); final boolean updated = XpUpdateResult.UPDATED.equals(updateResult); xpPanel.updateSkillExperience(updated, xpPauseState.isPaused(skill), skill, xpState.getSkillSnapshot(skill)); } diff --git a/runelite-client/src/main/resources/npc_health.json b/runelite-client/src/main/resources/npc_health.json deleted file mode 100644 index 4944167e6f..0000000000 --- a/runelite-client/src/main/resources/npc_health.json +++ /dev/null @@ -1,1161 +0,0 @@ -{ - "Molanisk_51": 52, - "Aberrant spectre_96": 90, - "Nechryael_115": 105, - "Death spawn_46": 60, - "Zombie_13": 22, - "Zombie_18": 24, - "Zombie_24": 30, - "Summoned Zombie_13": 22, - "Skeleton_22": 29, - "Skeleton_21": 24, - "Skeleton_25": 17, - "Skeleton_45": 59, - "Skeleton Mage_16": 17, - "Ghost_19": 25, - "Soulless_18": 24, - "Death wing_83": 80, - "Rock Crab_13": 50, - "Hellhound_122": 116, - "Wolf_64": 69, - "White wolf_25": 35, - "White wolf_38": 44, - "Big Wolf_73": 74, - "Wolf_25": 34, - "Wild dog_63": 62, - "Guard dog_44": 49, - "Hobgoblin_54": 62, - "Troll_91": 120, - "Huge spider_81": 90, - "Ogre_53": 60, - "Baby red dragon_65": 65, - "Kalphite Soldier_85": 90, - "Steel dragon_246": 210, - "Dagannoth_135": 142, - "Tok-Xil_135": 60, - "Rocnar_97": 100, - "Jungle Wolf_64": 69, - "King Black Dragon_276": 240, - "Black demon_172": 157, - "Baby dragon_48": 50, - "Red dragon_152": 140, - "Black dragon_227": 190, - "Green dragon_79": 75, - "Blue dragon_111": 105, - "Bronze dragon_131": 122, - "Iron dragon_189": 165, - "Ghoul_42": 50, - "Dwarf_10": 16, - "Chaos dwarf_48": 61, - "Dwarf_20": 16, - "Dwarf_9": 16, - "Dwarf_11": 16, - "Gunthor the brave_29": 35, - "Jailer_47": 47, - "Black Heather_34": 37, - "Donny the lad_34": 37, - "Speedy Keith_34": 37, - "Salarin the twisted_70": 70, - "Corporeal Beast_785": 2000, - "Dark energy core_75": 25, - "Pheasant_3": 5, - "Cave crawler_23": 22, - "Kurask_106": 97, - "Gargoyle_111": 105, - "Banshee_23": 22, - "Abyssal demon_124": 150, - "Basilisk_61": 75, - "Cockatrice_37": 37, - "Rockslug_29": 27, - "Dust devil_93": 105, - "Turoth_86": 76, - "Turoth_89": 81, - "Turoth_87": 79, - "Turoth_85": 77, - "Turoth_83": 76, - "Turoth_88": 76, - "Pyrefiend_43": 45, - "Jelly_78": 75, - "Infernal Mage_66": 60, - "Crawling Hand_8": 16, - "Crawling Hand_7": 16, - "Crawling Hand_12": 19, - "Crawling Hand_11": 16, - "Lizard_42": 40, - "Desert Lizard_24": 25, - "Small Lizard_12": 15, - "Harpie Bug Swarm_46": 25, - "Skeletal Wyvern_140": 210, - "Killerwatt_55": 51, - "Zygomite_74": 65, - "Zygomite_86": 75, - "Wall beast_49": 105, - "Giant frog_99": 100, - "Big frog_24": 25, - "Cave slime_23": 25, - "Cave bug_6": 5, - "Cave bug_96": 93, - "Bloodveld_76": 120, - "Cave kraken_127": 125, - "Kraken_291": 255, - "Smoke devil_160": 185, - "Thermonuclear smoke devil_301": 240, - "Sorebones_57": 52, - "Zombie pirate_57": 52, - "Barrelchest_190": 134, - "Zombie swab_55": 50, - "Evil spirit_150": 90, - "Fever spider_49": 40, - "Tyras guard_110": 110, - "Arrg_113": 140, - "Ice wolf_96": 70, - "Ice wolf_132": 70, - "Ice Troll_124": 80, - "Ice Troll_123": 80, - "Ice Troll_120": 100, - "Ice Troll_121": 80, - "Goblin_5": 12, - "Giant skeleton_80": 70, - "Damis_103": 90, - "Damis_174": 200, - "Stranger_95": 80, - "Bandit_74": 65, - "Bandit_57": 50, - "Ice troll_124": 80, - "Ice troll_123": 80, - "Ice troll_120": 100, - "Ice troll_121": 80, - "Mummy_96": 86, - "Mummy_103": 91, - "Scarabs_92": 25, - "Bandit champion_70": 50, - "Baby Roc_75": 50, - "Giant Roc_172": 250, - "Me_79": 45, - "Suqah_111": 106, - "Scarab mage_93": 50, - "Locust rider_106": 90, - "Locust rider_98": 90, - "Giant scarab_191": 130, - "Scarab mage_66": 50, - "Locust rider_68": 90, - "Wormbrain_2": 5, - "Melzar the Mad_43": 44, - "Icelord_51": 60, - "Zogre_44": 71, - "Skogre_44": 71, - "Slash Bash_111": 100, - "Moss giant_84": 120, - "Agrith Naar_100": 100, - "Skeleton_13": 18, - "Rock_111": 140, - "Stick_104": 135, - "Pee Hat_91": 120, - "Kraka_91": 120, - "Thrower Troll_67": 95, - "Mountain troll_69": 90, - "Ghast_30": 45, - "Mummy_84": 68, - "Kalphite Worker_28": 40, - "Kalphite Guardian_141": 171, - "Kalphite Queen_333": 255, - "Dagannoth_74": 70, - "Dagannoth_92": 120, - "Dagannoth mother_100": 120, - "Sigmund_50": 70, - "Angry unicorn_45": 200, - "Angry giant rat_45": 200, - "Angry goblin_45": 200, - "Fear reaper_42": 25, - "Confusion beast_43": 64, - "Hopeless creature_40": 25, - "Tolna_46": 45, - "Sea Snake Young_90": 85, - "Sea Snake Hatchling_62": 50, - "Giant Sea Snake_149": 100, - "Mourner_11": 19, - "Mourner_24": 25, - "Man_4": 7, - "Woman_3": 7, - "Barrelchest (hard)_380": 255, - "Giant scarab (hard)_316": 255, - "Dessous (hard)_217": 255, - "Kamil (hard)_273": 255, - "Woman_4": 7, - "Damis (hard)_200": 198, - "Damis (hard)_272": 255, - "Mourner_18": 13, - "Woman_12": 7, - "Woman_14": 7, - "Paladin_59": 66, - "Mourner_12": 13, - "Ogre_63": 60, - "Tree spirit_101": 85, - "Alomone_13": 25, - "Clivet_13": 25, - "Hazeel Cultist_13": 25, - "Khazard Guard_23": 25, - "General Khazard_112": 171, - "Bouncer_137": 116, - "Khazard Ogre_63": 60, - "Khazard Scorpion_44": 40, - "Arzinian Avatar of Strength_125": 100, - "Arzinian Avatar of Strength_75": 70, - "Arzinian Avatar of Ranging_125": 100, - "Arzinian Avatar of Ranging_75": 70, - "Arzinian Avatar of Magic_125": 100, - "Arzinian Avatar of Magic_75": 70, - "Ram_2": 8, - "Vulture_31": 10, - "Experiment_51": 40, - "Experiment_25": 100, - "Loar Shadow_40": 38, - "Loar Shade_40": 38, - "Phrin Shadow_60": 56, - "Phrin Shade_60": 56, - "Riyl Shade_80": 76, - "Asyn Shadow_100": 90, - "Asyn Shade_100": 90, - "Fiyr Shadow_120": 110, - "Fiyr Shade_120": 110, - "Afflicted_37": 30, - "Afflicted_34": 28, - "Afflicted_32": 26, - "Afflicted_30": 24, - "Seagull_2": 6, - "Seagull_3": 10, - "Dwarf gang member_44": 40, - "Dwarf gang member_48": 25, - "Dwarf gang member_49": 25, - "Slagilith_92": 60, - "Fire elemental_35": 30, - "Earth elemental_35": 35, - "Air elemental_34": 30, - "Water elemental_34": 30, - "The Kendal_70": 50, - "Camp dweller_31": 30, - "Camp dweller_25": 25, - "Dwarf_7": 16, - "Black Guard_25": 30, - "Foreman_23": 20, - "Jungle Demon_195": 170, - "Pirate_23": 20, - "Thief_16": 17, - "Mugger_6": 8, - "Chompy bird_6": 10, - "Kebbit_13": 50, - "Skeleton hero_149": 124, - "Skeleton brute_132": 124, - "Skeleton warlord_132": 124, - "Skeleton heavy_132": 124, - "Skeleton thug_132": 124, - "Black knight_33": 42, - "Guard_20": 22, - "Guard_21": 22, - "Fire wizard_13": 25, - "Water wizard_13": 25, - "Earth wizard_13": 25, - "Air wizard_13": 25, - "Kolodion_112": 107, - "Battle mage_54": 120, - "Ahrim the Blighted_98": 100, - "Dharok the Wretched_115": 100, - "Guthan the Infested_115": 100, - "Karil the Tainted_98": 100, - "Torag the Corrupted_115": 100, - "Verac the Defiled_115": 100, - "Bloodworm_52": 45, - "Crypt rat_43": 35, - "Giant crypt rat_76": 70, - "Crypt spider_56": 60, - "Giant crypt spider_79": 80, - "Skeleton_77": 50, - "Splatter_22": 13, - "Splatter_33": 23, - "Splatter_44": 33, - "Splatter_54": 43, - "Splatter_65": 53, - "Shifter_38": 23, - "Shifter_57": 38, - "Shifter_76": 53, - "Shifter_90": 68, - "Shifter_104": 83, - "Ravager_36": 23, - "Ravager_53": 38, - "Ravager_71": 53, - "Ravager_89": 68, - "Ravager_106": 83, - "Spinner_36": 33, - "Spinner_55": 53, - "Spinner_74": 73, - "Spinner_92": 101, - "Spinner_88": 93, - "Torcher_33": 18, - "Torcher_49": 30, - "Torcher_66": 45, - "Torcher_79": 57, - "Torcher_92": 71, - "Defiler_33": 27, - "Defiler_50": 45, - "Defiler_66": 62, - "Defiler_67": 62, - "Defiler_80": 78, - "Defiler_97": 97, - "Brawler_51": 53, - "Brawler_76": 83, - "Brawler_101": 113, - "Brawler_129": 143, - "Double agent_65": 80, - "Double agent_108": 120, - "Scarab swarm_98": 25, - "Goat_23": 21, - "Billy Goat_33": 28, - "White Knight_36": 52, - "White Knight_38": 52, - "White Knight_39": 52, - "White Knight_42": 55, - "Gorak_145": 112, - "Duck_1": 3, - "Stag_15": 19, - "Rabbit_1": 5, - "Tree spirit_14": 50, - "Tree spirit_79": 86, - "Tree spirit_120": 120, - "Tree spirit_159": 170, - "Evil Chicken_159": 120, - "Baby dragon_83": 80, - "Ice troll runt_74": 60, - "Ice troll male_82": 80, - "Ice troll female_82": 80, - "Ice troll grunt_100": 80, - "Duckling_1": 3, - "Lesser demon_82": 81, - "Greater demon_92": 89, - "Zulrah_725": 500, - "Snakeling_90": 1, - "Chaos Elemental_305": 250, - "Dark wizard_23": 24, - "Dark wizard_22": 24, - "Dark wizard_11": 24, - "Oomlie bird_46": 40, - "Terrorbird_28": 34, - "Mounted terrorbird gnome_31": 36, - "Mounted terrorbird gnome_49": 36, - "Fire giant_86": 111, - "Ice giant_53": 70, - "Moss giant_42": 60, - "Jogre_53": 60, - "Cyclops_56": 75, - "Hill Giant_28": 35, - "Cyclops_106": 150, - "Giant frog_13": 23, - "Big frog_10": 18, - "Frog_5": 8, - "TzHaar-Hur_74": 80, - "TzHaar-Xil_133": 120, - "TzHaar-Ket_149": 140, - "Tz-Kih_22": 10, - "Tz-Kek_45": 20, - "Tok-Xil_90": 40, - "Commander Zilyana_596": 255, - "Starlight_149": 160, - "Growler_139": 146, - "Bree_146": 162, - "Saradomin priest_113": 89, - "Spiritual warrior_125": 110, - "Spiritual ranger_122": 106, - "Spiritual mage_120": 85, - "Knight of Saradomin_103": 135, - "Knight of Saradomin_101": 108, - "General Graardor_624": 255, - "Sergeant Strongstack_141": 128, - "Sergeant Steelwill_142": 127, - "Sergeant Grimspike_142": 146, - "Ogre_58": 70, - "Jogre_58": 70, - "Cyclops_81": 110, - "Ork_107": 110, - "Hobgoblin_47": 52, - "Spiritual ranger_115": 131, - "Spiritual warrior_134": 131, - "Spiritual mage_121": 75, - "Goblin_17": 18, - "Goblin_12": 15, - "Goblin_15": 16, - "Goblin_13": 16, - "Dagannoth_88": 85, - "Giant Rock Crab_137": 180, - "Bardur_94": 99, - "Dagannoth fledgeling_70": 100, - "Dagannoth Supreme_303": 255, - "Dagannoth Prime_303": 255, - "Dagannoth Rex_303": 255, - "Animated Bronze Armour_11": 10, - "Animated Iron Armour_23": 20, - "Animated Steel Armour_46": 40, - "Animated Black Armour_69": 60, - "Animated Mithril Armour_92": 80, - "Animated Adamant Armour_113": 99, - "Animated Rune Armour_138": 120, - "Cyclops_76": 100, - "Catablepon_49": 40, - "Catablepon_64": 70, - "Catablepon_68": 50, - "Giant spider_50": 50, - "Spider_24": 22, - "Scorpion_59": 55, - "Scorpion_37": 37, - "Minotaur_12": 10, - "Minotaur_19": 10, - "Minotaur_27": 22, - "Goblin_11": 7, - "Goblin_16": 22, - "Goblin_25": 26, - "Wolf_14": 15, - "Wolf_11": 10, - "Rat_1": 2, - "Flesh Crawler_28": 25, - "Flesh Crawler_35": 25, - "Flesh Crawler_41": 25, - "Giant rat_26": 25, - "Ankou_75": 60, - "Ankou_82": 65, - "Ankou_86": 70, - "Skeleton_68": 70, - "Skeleton_60": 70, - "Skeleton_85": 77, - "Ghost_77": 80, - "Ghost_76": 75, - "H.A.M. Guard_12": 15, - "H.A.M. Guard_18": 20, - "H.A.M. Guard_22": 30, - "Monk_5": 15, - "Abyssal leech_41": 10, - "Abyssal guardian_59": 55, - "Abyssal walker_81": 95, - "Mogre_60": 48, - "Werewolf_88": 98, - "Boris_24": 60, - "Imre_24": 60, - "Yuri_24": 60, - "Joseph_24": 60, - "Nikolai_24": 60, - "Eduard_24": 60, - "Lev_24": 60, - "Georgy_24": 60, - "Svetlana_24": 60, - "Irina_24": 60, - "Alexis_24": 60, - "Milla_24": 60, - "Galina_24": 60, - "Sofiya_24": 60, - "Ksenia_24": 60, - "Yadviga_24": 60, - "Nikita_24": 60, - "Vera_24": 60, - "Zoja_24": 60, - "Liliya_24": 60, - "Myre Blamish Snail_9": 8, - "Blood Blamish Snail_20": 13, - "Ochre Blamish Snail_10": 10, - "Bruise Blamish Snail_20": 12, - "Bark Blamish Snail_15": 22, - "Ochre Blamish Snail_15": 20, - "Chicken_1": 3, - "Rooster_3": 5, - "Cow_2": 8, - "Cow calf_2": 6, - "Bat_6": 8, - "Troll_69": 90, - "Giant bat_27": 32, - "Unicorn_15": 19, - "Grizzly bear_21": 27, - "Black bear_19": 25, - "Earth warrior_51": 54, - "Ice warrior_57": 59, - "Otherworldly being_64": 66, - "Magic axe_42": 45, - "Snake_5": 6, - "Black unicorn_27": 29, - "Shadow warrior_48": 67, - "Giant rat_3": 5, - "Giant rat_6": 10, - "Dark wizard_20": 24, - "Invrigar the Necromancer_20": 24, - "Dark wizard_7": 12, - "Black Knight_33": 42, - "Highwayman_5": 13, - "Chaos druid_13": 20, - "Pirate_26": 23, - "Thug_10": 18, - "Rogue_15": 17, - "Monk of Zamorak_22": 20, - "Monk of Zamorak_17": 10, - "Monk of Zamorak_45": 40, - "Tribesman_32": 40, - "Dark warrior_8": 17, - "Chaos druid warrior_37": 40, - "Necromancer_26": 40, - "Guard Bandit_22": 27, - "Waterfiend_115": 130, - "Brutal green dragon_227": 175, - "Mithril dragon_304": 255, - "Confused barbarian_132": 124, - "Lost barbarian_132": 124, - "Nail beast_69": 55, - "Nail beast_98": 65, - "Nail beast_141": 75, - "Zamorak wizard_65": 73, - "Saradomin wizard_108": 120, - "Big Snake_84": 120, - "Undead cow_2": 8, - "Undead chicken_1": 3, - "Giant lobster_32": 32, - "Tortured soul_59": 51, - "Man_2": 7, - "Woman_2": 7, - "Shadow spider_52": 55, - "Giant spider_2": 5, - "Giant spider_27": 33, - "Spider_1": 2, - "Jungle spider_44": 51, - "Deadly red spider_34": 35, - "Ice spider_61": 65, - "Poison spider_64": 64, - "Scorpion_14": 17, - "Poison Scorpion_20": 23, - "Pit Scorpion_28": 32, - "King Scorpion_32": 30, - "Goblin_2": 5, - "Hobgoblin_28": 29, - "Hobgoblin_42": 49, - "Barbarian_17": 25, - "Barbarian_10": 25, - "Barbarian_15": 25, - "Barbarian_9": 18, - "Farmer_7": 12, - "Wizard_9": 14, - "Druid_33": 30, - "Warrior woman_24": 20, - "Al-Kharid warrior_9": 19, - "Paladin_62": 66, - "Hero_69": 82, - "Forester_15": 17, - "Knight of Ardougne_46": 52, - "Tz-Kek_22": 10, - "Yt-MejKot_180": 80, - "Ket-Zek_360": 160, - "TzTok-Jad_702": 250, - "Yt-HurKot_108": 60, - "K'ril Tsutsaroth_650": 255, - "Tstanon Karlak_145": 142, - "Zakl'n Gritch_142": 150, - "Balfrug Kreeyath_151": 161, - "Hellhound_127": 116, - "Imp_7": 10, - "Werewolf_93": 92, - "Feral Vampyre_77": 60, - "Bloodveld_81": 134, - "Pyrefiend_48": 45, - "Icefiend_18": 20, - "Gorak_149": 128, - "Spiritual warrior_115": 100, - "Spiritual ranger_118": 120, - "Kree'arra_580": 255, - "Wingman Skree_143": 121, - "Flockleader Geerin_149": 132, - "Flight Kilisa_159": 159, - "Spiritual warrior_123": 98, - "Spiritual ranger_127": 89, - "Spiritual mage_122": 75, - "Aviansie_69": 70, - "Aviansie_79": 83, - "Aviansie_84": 86, - "Aviansie_83": 86, - "Aviansie_92": 95, - "Aviansie_97": 98, - "Aviansie_137": 124, - "Aviansie_148": 139, - "Aviansie_71": 63, - "Aviansie_73": 67, - "Aviansie_89": 69, - "Aviansie_94": 75, - "Aviansie_131": 115, - "Dagannoth spawn_42": 35, - "Dagannoth_90": 95, - "Snake_35": 25, - "Albino bat_52": 33, - "Giant mosquito_13": 15, - "Jungle horror_70": 45, - "Cave horror_80": 55, - "Leech_52": 45, - "Feral Vampyre_72": 50, - "Feral Vampyre_61": 40, - "Watchman_33": 22, - "Soldier_28": 22, - "Shipyard worker_11": 10, - "Drunken man_3": 7, - "Gardener_4": 8, - "Gardener_3": 7, - "Cuffs_3": 7, - "Narf_2": 7, - "Rusty_2": 7, - "Jeff_2": 7, - "Hengel_2": 7, - "Anja_2": 7, - "Chicken_3": 3, - "Earth Warrior Champion_102": 108, - "Giant Champion_56": 70, - "Ghoul Champion_85": 100, - "Goblin Champion_24": 32, - "Hobgoblin Champion_56": 58, - "Imp Champion_14": 40, - "Jogre Champion_107": 120, - "Lesser Demon Champion_162": 148, - "Skeleton Champion_40": 58, - "Zombies Champion_51": 60, - "Leon d'Cour_141": 123, - "Rabbit_2": 5, - "Grizzly bear_42": 35, - "Grizzly bear cub_33": 35, - "Dire Wolf_88": 85, - "Elf warrior_90": 105, - "Elf warrior_108": 105, - "Lucien_14": 17, - "Guardian of Armadyl_45": 49, - "Guardian of Armadyl_43": 49, - "Fire Warrior of Lesarkus_84": 59, - "Shadow Hound_63": 62, - "Fareed_167": 130, - "Kamil_154": 130, - "Dessous_139": 200, - "The Inadequacy_343": 180, - "The Everlasting_223": 230, - "The Untouchable_274": 90, - "The Illusive_108": 140, - "A Doubt_78": 50, - "Count Draynor_34": 35, - "Monk of Zamorak_30": 25, - "Bouncer_160": 116, - "Renegade Knight_37": 48, - "Thrantax the Mighty_92": 80, - "Sir Mordred_39": 38, - "Desert snake_5": 6, - "Menaphite Thug_55": 60, - "Tough Guy_75": 75, - "Frogeel_103": 90, - "Unicow_25": 24, - "Spidine_42": 35, - "Swordchick_46": 35, - "Jubster_87": 60, - "Newtroost_19": 18, - "Possessed pickaxe_50": 40, - "Skeletal miner_42": 39, - "Treus Dayth_95": 100, - "Ghost_29": 27, - "Rooster_2": 5, - "Einar_1": 1, - "Alrik_1": 1, - "Thorhild_1": 1, - "Rannveig_2": 1, - "Valgerd_2": 1, - "Broddi_2": 1, - "Ragnvald_2": 1, - "Vampyre Juvenile_45": 60, - "Vampyre Juvinate_54": 65, - "Feral Vampyre_64": 80, - "Vyrewatch_105": 90, - "Vyrewatch_110": 90, - "Vyrewatch_120": 105, - "Vyrewatch_125": 110, - "Vanstrom Klause_169": 155, - "Moss giant_48": 85, - "Jake_37": 50, - "Wilson_37": 50, - "Palmer_37": 50, - "Fox_19": 30, - "Bunny_2": 5, - "Bear Cub_15": 20, - "Unicorn Foal_12": 15, - "Black unicorn Foal_22": 25, - "The Draugen_69": 60, - "Freidir_48": 50, - "Borrokar_48": 50, - "Lanzig_48": 50, - "Jennella_48": 50, - "Market Guard_48": 50, - "Ungadulu_70": 65, - "Ungadulu_169": 150, - "Nezikchened_187": 150, - "San Tojalon_106": 120, - "Irvig Senay_100": 125, - "Ranalph Devere_92": 130, - "Zombie rat_3": 5, - "Witch's experiment_19": 21, - "Witch's experiment (second form)_30": 31, - "Witch's experiment (third form)_42": 41, - "Witch's experiment (fourth form)_53": 51, - "Shadow_73": 15, - "Dark beast_182": 220, - "Black Knight Titan_120": 142, - "Soldier_48": 50, - "Ocga_5": 10, - "Penda_5": 10, - "Fareed (hard)_299": 255, - "Troll general_113": 140, - "Troll spectator_71": 90, - "Dad_101": 120, - "Twig_71": 90, - "Berry_71": 90, - "Thrower troll_68": 95, - "Mountain troll_71": 90, - "King Roald_47": 60, - "Outlaw_32": 20, - "Crocodile_63": 62, - "Jackal_21": 27, - "Locust_18": 27, - "Plague frog_11": 10, - "Possessed Priest_91": 90, - "Monk_3": 5, - "Thief_14": 17, - "Head Thief_26": 37, - "Jail guard_26": 32, - "Sea troll_79": 100, - "Sea troll_65": 80, - "Sea troll_87": 80, - "Sea troll_101": 80, - "Sea Troll Queen_170": 200, - "Skeleton Mage_83": 80, - "Sir Lancelot_127": 115, - "Sir Kay_124": 110, - "Sir Gawain_122": 110, - "Sir Lucan_120": 105, - "Sir Palomedes_118": 100, - "Sir Tristram_115": 105, - "Sir Pelleas_112": 99, - "Sir Bedivere_110": 90, - "Ogre chieftain_81": 60, - "Gorad_68": 80, - "City guard_83": 80, - "Enclave guard_83": 80, - "Ogre shaman_113": 1, - "Tower guard_28": 22, - "Colonel Radick_38": 65, - "Vampyre Juvinate_75": 110, - "Vampyre Juvinate_50": 60, - "Gadderanks_35": 20, - "Skeleton fremennik_40": 25, - "Skeleton fremennik_50": 35, - "Skeleton fremennik_60": 40, - "Ulfric_100": 60, - "Brine rat_70": 50, - "Blessed spider_39": 32, - "Blessed giant rat_9": 30, - "Sir Jerro_62": 57, - "Sir Carl_62": 57, - "Sir Harry_62": 57, - "Kalrag_89": 78, - "Othainian_91": 87, - "Doomion_91": 90, - "Holthion_91": 87, - "Disciple of Iban_13": 20, - "Rowdy slave_10": 16, - "Mercenary Captain_47": 80, - "Desert Wolf_27": 34, - "Ugthanki_42": 45, - "Bedabin Nomad Fighter_56": 50, - "Mercenary_45": 60, - "Sir Leye_20": 20, - "Angry unicorn_47": 200, - "Angry giant rat_47": 200, - "Angry goblin_47": 200, - "Angry bear_47": 200, - "Fear reaper_55": 57, - "Confusion beast_63": 64, - "Hopeless creature_71": 71, - "Hopeless beast_71": 71, - "The Shaikahan_83": 100, - "Black golem_75": 80, - "White golem_75": 80, - "Grey golem_75": 80, - "Poltenip_21": 22, - "Radat_21": 22, - "Slug Prince_62": 70, - "Icefiend_13": 15, - "Crab_23": 19, - "Mudskipper_30": 20, - "Mudskipper_31": 20, - "Crab_21": 18, - "Jubbly bird_9": 21, - "Culinaromancer_75": 150, - "Agrith-Na-Na_146": 200, - "Flambeed_149": 210, - "Karamel_136": 250, - "Dessourt_121": 130, - "Gelatinnoth Mother_130": 240, - "Grip_22": 25, - "Ice Queen_111": 105, - "Pirate Guard_19": 25, - "Entrana firebird_2": 5, - "Black Knight_32": 42, - "Khazard trooper_19": 22, - "Khazard commander_48": 22, - "Gnome troop_1": 3, - "Chronozon_170": 60, - "Imp_2": 8, - "Imp_3": 8, - "Suit of armour_19": 29, - "Skeleton Hellhound_97": 55, - "Delrith_27": 71, - "Experiment No.2_109": 95, - "Mouse_95": 70, - "Glod_138": 160, - "Sigmund_64": 70, - "H.A.M. Archer_30": 35, - "H.A.M. Mage_30": 35, - "Weaponsmaster_23": 20, - "Jonny the beard_2": 8, - "Bird_11": 10, - "Bird_5": 5, - "Jungle spider_37": 51, - "Snake_24": 6, - "Padulah_149": 130, - "Monkey Guard_149": 130, - "Monkey Archer_86": 50, - "Monkey Guard_167": 130, - "Monkey Zombie_98": 60, - "Monkey Zombie_129": 90, - "Monkey Zombie_82": 60, - "Mourner_108": 105, - "Cave goblin miner_11": 10, - "Cave goblin guard_26": 26, - "Cave goblin guard_24": 26, - "Undead one_61": 47, - "Nazastarool_91": 70, - "Nazastarool_68": 70, - "Nazastarool_93": 80, - "Goblin guard_42": 43, - "Ghost_24": 20, - "Grave scorpion_12": 7, - "Poison spider_31": 64, - "Enormous Tentacle_112": 120, - "Angry barbarian spirit_166": 190, - "Enraged barbarian spirit_166": 190, - "Berserk barbarian spirit_166": 190, - "Ferocious barbarian spirit_166": 190, - "Swamp snake_80": 120, - "Swamp snake_109": 120, - "Swamp snake_139": 85, - "Ghast_79": 45, - "Ghast_109": 135, - "Ghast_139": 160, - "Giant snail_80": 125, - "Giant snail_109": 150, - "Giant snail_139": 160, - "Vampyre Juvinate_59": 50, - "Vampyre Juvinate_90": 100, - "Vampyre Juvinate_119": 150, - "Feral Vampyre_70": 75, - "Feral Vampyre_100": 135, - "Feral Vampyre_130": 185, - "Tentacle_99": 75, - "Head_140": 150, - "Tentacle_136": 75, - "Undead Lumberjack_30": 12, - "Undead Lumberjack_35": 12, - "Undead Lumberjack_40": 12, - "Undead Lumberjack_45": 13, - "Undead Lumberjack_50": 14, - "Undead Lumberjack_55": 12, - "Undead Lumberjack_60": 12, - "Undead Lumberjack_64": 12, - "Undead Lumberjack_70": 12, - "Penance Fighter_30": 28, - "Penance Fighter_32": 29, - "Penance Fighter_37": 32, - "Penance Fighter_42": 37, - "Penance Fighter_47": 38, - "Penance Fighter_56": 49, - "Penance Fighter_61": 50, - "Penance Fighter_68": 55, - "Penance Fighter_77": 56, - "Penance Ranger_21": 20, - "Penance Ranger_25": 29, - "Penance Ranger_32": 32, - "Penance Ranger_38": 34, - "Penance Ranger_43": 41, - "Penance Ranger_51": 50, - "Penance Ranger_57": 50, - "Penance Ranger_64": 55, - "Penance Ranger_72": 58, - "Penance Queen_209": 250, - "Queen spawn_63": 45, - "Giant Mole_230": 200, - "Yak_22": 50, - "Ice Troll King_122": 150, - "Ice troll grunt_102": 80, - "Tanglefoot_111": 102, - "Baby tanglefoot_45": 40, - "Cerberus_318": 600, - "Abyssal Sire_350": 400, - "Spawn_60": 15, - "Scion_100": 50, - "Sand Crab_15": 60, - "Wallasalki_98": 120, - "Rock lobster_127": 150, - "Spinolyp_76": 100, - "Gnome troop_3": 2, - "Black Guard_48": 40, - "Black Guard Berserker_66": 50, - "Tortoise_79": 100, - "Tortoise_92": 120, - "Gnome child_1": 2, - "Gnome guard_23": 31, - "Gnome woman_1": 2, - "Gnome Archer_5": 10, - "Gnome Driver_5": 10, - "Gnome Mage_5": 10, - "Bush snake_35": 25, - "Elvarg (hard)_214": 240, - "The Inadequacy (hard)_600": 255, - "The Untouchable (hard)_440": 180, - "Large mosquito_13": 3, - "Mosquito swarm_17": 9, - "Tanglefoot (hard)_199": 204, - "Chronozon (hard)_297": 120, - "Bouncer (hard)_244": 232, - "Ice Troll King (hard)_213": 255, - "Black demon (hard)_292": 157, - "Glod (hard)_276": 255, - "Treus Dayth (hard)_194": 240, - "Black Knight Titan (hard)_210": 255, - "Dagannoth mother (hard)_201": 240, - "Evil Chicken (hard)_286": 240, - "Culinaromancer (hard)_209": 255, - "Agrith-Na-Na (hard)_235": 255, - "Flambeed (hard)_238": 255, - "Karamel (hard)_186": 255, - "Dessourt (hard)_217": 255, - "Gelatinnoth Mother (hard)_201": 240, - "Nezikchened (hard)_295": 150, - "Tree spirit (hard)_199": 187, - "Jungle Demon (hard)_327": 255, - "The Kendal (hard)_210": 150, - "Giant Roc (hard)_257": 255, - "Slagilith (hard)_202": 150, - "Moss giant (hard)_182": 240, - "Skeleton Hellhound (hard)_198": 132, - "Agrith Naar (hard)_196": 209, - "King Roald (hard)_188": 150, - "Khazard warlord (hard)_192": 255, - "Dad (hard)_201": 240, - "Arrg (hard)_210": 255, - "Count Draynor (hard)_177": 210, - "Witch's experiment (hard)_47": 63, - "Witch's experiment (second form) (hard)_77": 93, - "Witch's experiment (third form) (hard)_90": 103, - "Witch's experiment (fourth form) (hard)_103": 113, - "Nazastarool (hard)_176": 154, - "Nazastarool (hard)_153": 180, - "Nazastarool (hard)_181": 176, - "Elvarg_83": 80, - "Khazard warlord_112": 170, - "Mosquito swarm_20": 15, - "Broodoo victim_60": 100, - "Animated steel armour_53": 50, - "Animated spade_50": 40, - "Terror dog_110": 87, - "Terror dog_100": 82, - "Tarn_69": 80, - "Mutant tarn_69": 80, - "Callisto_470": 255, - "Venenatis_464": 255, - "Gnome guard_1337": 31, - "Armadylian guard_97": 132, - "Bandosian guard_125": 130, - "Lava dragon_252": 230, - "Ent_101": 105, - "Runite Golem_178": 170, - "Rogue_135": 125, - "Mammoth_80": 130, - "Dark warrior_145": 137, - "Elder Chaos druid_129": 150, - "Vet'ion_454": 255, - "Vet'ion Reborn_454": 255, - "Skeleton Hellhound_214": 55, - "Greater Skeleton Hellhound_281": 190, - "Scorpia_225": 200, - "Scorpia's guardian_47": 70, - "Crazy archaeologist_204": 225, - "Chaos Fanatic_202": 225, - "Chaotic death spawn_215": 50, - "Rock Golem_120": 120, - "Rock Golem_159": 170, - "River troll_120": 120, - "River troll_159": 170, - "Lizardman shaman_150": 150, - "Maniacal monkey_48": 65, - "Kruk_149": 210, - "Gangster_45": 40, - "Gangster_50": 50, - "Gang boss_83": 80, - "Gang boss_76": 80, - "Soldier (tier 1)_39": 50, - "Soldier (tier 2)_48": 50, - "Soldier (tier 3)_58": 55, - "Soldier (tier 4)_70": 65, - "Soldier (tier 5)_99": 90, - "Lizardman_53": 60, - "Lizardman_62": 60, - "Lizardman brute_73": 60, - "Kourend guard_21": 22, - "Kourend head guard_84": 86, - "Tortured gorilla_142": 110, - "Glough_378": 575, - "Keef_178": 180, - "Kob_185": 200, - "Maniacal monkey_140": 65, - "Maniacal Monkey Archer_132": 60, - "Demonic gorilla_275": 380, - "Tortured gorilla_141": 210, - "Ent_86": 75, - "Black demon_184": 170, - "Black demon_178": 160, - "Greater demon_101": 120, - "Greater demon_100": 115, - "Greater demon_113": 130, - "Lesser demon_87": 87, - "Lesser demon_94": 98, - "Dust devil_110": 130, - "Fire giant_109": 150, - "Fire giant_104": 130, - "Bronze dragon_143": 122, - "Iron dragon_215": 195, - "Steel dragon_274": 250, - "Ankou_95": 60, - "King Sand Crab_107": 200, - "Twisted Banshee_89": 109, - "Brutal blue dragon_271": 245, - "Brutal red dragon_289": 285, - "Brutal black dragon_318": 315, - "Mutated Bloodveld_123": 170, - "Warped Jelly_112": 140, - "Greater Nechryael_200": 205, - "Deviant spectre_169": 190, - "Skotizo_321": 450, - "Reanimated demon spawn_87": 85, - "Dark Ankou_95": 60, - "Ancient Wizard_98": 80, - "Ancient Wizard_112": 80, - "Brassican Mage_140": 150, - "Double agent_141": 160, - "Crushing hand_45": 55, - "Chasm Crawler_68": 64, - "Screaming banshee_70": 61, - "Screaming twisted banshee_144": 220, - "Giant rockslug_86": 77, - "Cockathrice_89": 95, - "Flaming pyrelord_97": 126, - "Monstrous basilisk_135": 170, - "Malevolent Mage_162": 175, - "Insatiable Bloodveld_202": 380, - "Insatiable mutated Bloodveld_278": 410, - "Vitreous Jelly_206": 190, - "Vitreous warped Jelly_241": 220, - "Cave abomination_206": 130, - "Abhorrent spectre_253": 250, - "Repugnant spectre_335": 390, - "Choke devil_264": 300, - "King kurask_295": 420, - "Nuclear smoke devil_280": 240, - "Marble gargoyle_349": 270, - "Night beast_374": 550, - "Greater abyssal demon_342": 400, - "Nechryarch_300": 320, - "Obor_106": 120, - "Zamorak warrior_84": 45, - "Zamorak warrior_85": 45, - "Zamorak ranger_81": 50, - "Zamorak ranger_82": 50, - "Cave lizard_37": 20, - "Zamorak crafter_19": 25, - "Temple guardian_30": 45, - "TzHaar-Ket_221": 200, - "Jal-Nib_32": 10, - "Jal-MejRah_85": 25, - "Jal-Ak_165": 40, - "Jal-AkRek-Mej_70": 15, - "Jal-AkRek-Xil_70": 15, - "Jal-AkRek-Ket_70": 15, - "Jal-ImKot_240": 75, - "Jal-Xil_370": 130, - "Jal-Zek_490": 220, - "JalTok-Jad_900": 350, - "Yt-HurKot_141": 90, - "TzKal-Zuk_1400": 1200, - "Jal-MejJak_250": 80, - "Long-tailed Wyvern_152": 200, - "Taloned Wyvern_147": 200, - "Spitting Wyvern_139": 200, - "Ancient Wyvern_210": 300, - "Lobstrosity_68": 50, - "Ancient Zygomite_109": 150, - "Ammonite Crab_25": 100, - "Hoop Snake_19": 25, - "Tar Monster_132": 200, - "Deranged archaeologist_276": 200, - "Dusk_248": 450, - "Dawn_228": 450, - "Justiciar Zachariah_348": 320, - "Derwen_235": 320, - "Porazdir_235": 320, - "Black dragon_247": 250, - "Ankou_98": 100, - "Green dragon_88": 100, - "Greater demon_104": 120, - "Black demon_188": 200, - "Hellhound_136": 150, - "Ice giant_67": 100, - "Revenant imp_7": 10, - "Dusk_328": 450, - "Sand Snake (hard)_154": 180, - "Sand Snake_36": 60, - "Revenant goblin_15": 14, - "Revenant pyrefiend_52": 48, - "Revenant hobgoblin_60": 72, - "Revenant cyclops_82": 110, - "Revenant hellhound_90": 80, - "Revenant demon_98": 80, - "Revenant ork_105": 105, - "Revenant dark beast_120": 140, - "Revenant knight_126": 143, - "Revenant dragon_135": 155, - "Corsair Traitor (hard)_103": 160, - "Corsair Traitor_35": 55, - "Ithoi the Navigator_35": 55, - "Ogress Warrior_82": 82, - "Ogress Shaman_82": 82, - "Corrupt Lizardman (hard)_152": 150, - "Corrupt Lizardman_46": 50, - "Rune dragon_380": 330, - "Adamant dragon_338": 295, - "Robert the Strong_194": 280, - "Vorkath_392": 460, - "Vorkath_732": 750, - "Zombified Spawn_55": 8, - "Zombified Spawn_64": 38, - "Stone Guardian_124": 62, - "Galvek_608": 1200, - "Growthling_37": 10, - "Bryophyta_128": 115, - "Ranis Drakan_233": 400, - "Vyrewatch_87": 75, - "Abomination_149": 200, - "Swamp Crab_55": 75, - "Respiratory system_0": 50, - "Sulphur Lizard_50": 50, - "Wyrm_99": 130, - "Drake_192": 250, - "Hydra_194": 300, - "Alchemical Hydra_426": 1100 -} From 7f7e3641bab1f2adfeeaee4b72700fa41c808ef5 Mon Sep 17 00:00:00 2001 From: TheStonedTurtle Date: Fri, 12 Apr 2019 20:25:00 -0700 Subject: [PATCH 010/117] Add dragon, demon, and undead flag --- .../src/main/java/net/runelite/http/api/npc/NPCStats.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/http-api/src/main/java/net/runelite/http/api/npc/NPCStats.java b/http-api/src/main/java/net/runelite/http/api/npc/NPCStats.java index 8ee5761a21..132473cafb 100644 --- a/http-api/src/main/java/net/runelite/http/api/npc/NPCStats.java +++ b/http-api/src/main/java/net/runelite/http/api/npc/NPCStats.java @@ -61,6 +61,10 @@ public class NPCStats private final boolean poisonImmune; private final boolean venomImmune; + private final boolean dragon; + private final boolean demon; + private final boolean undead; + /** * Based off the formula found here: http://services.runescape.com/m=forum/c=PLuJ4cy6gtA/forums.ws?317,318,712,65587452,209,337584542#209 * @return bonus XP modifier From 3c59f3de4c23e17a8b0065f671e3799c8b93a613 Mon Sep 17 00:00:00 2001 From: TheStonedTurtle Date: Sat, 11 May 2019 10:32:07 -0700 Subject: [PATCH 011/117] ui: Add Table Component Co-Authored-By: Jordan --- .../components/table/TableAlignment.java | 32 ++ .../components/table/TableComponent.java | 433 ++++++++++++++++++ .../components/table/TableElement.java | 38 ++ .../ui/overlay/components/table/TableRow.java | 41 ++ .../components/table/TableComponentTest.java | 85 ++++ 5 files changed, 629 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableAlignment.java create mode 100644 runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableComponent.java create mode 100644 runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableElement.java create mode 100644 runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableRow.java create mode 100644 runelite-client/src/test/java/net/runelite/client/ui/overlay/components/table/TableComponentTest.java diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableAlignment.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableAlignment.java new file mode 100644 index 0000000000..d55080a3e0 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableAlignment.java @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2019, TheStonedTurtle +* 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.ui.overlay.components.table; + +public enum TableAlignment +{ + LEFT, + CENTER, + RIGHT +} diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableComponent.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableComponent.java new file mode 100644 index 0000000000..5dec2a7ac6 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableComponent.java @@ -0,0 +1,433 @@ +/* + * Copyright (c) 2018, Jordan Atwood + * Copyright (c) 2019, TheStonedTurtle + * 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.ui.overlay.components.table; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.Point; +import java.awt.Rectangle; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import javax.annotation.Nonnull; +import javax.annotation.Nullable; +import lombok.Getter; +import lombok.NonNull; +import lombok.Setter; +import net.runelite.client.ui.overlay.components.ComponentConstants; +import net.runelite.client.ui.overlay.components.LayoutableRenderableEntity; +import net.runelite.client.ui.overlay.components.TextComponent; + +@Setter +public class TableComponent implements LayoutableRenderableEntity +{ + private static final TableElement EMPTY_ELEMENT = TableElement.builder().build(); + + @Getter + private final List columns = new ArrayList<>(); + @Getter + private final List rows = new ArrayList<>(); + + @Getter + private final Rectangle bounds = new Rectangle(); + + private TableAlignment defaultAlignment = TableAlignment.LEFT; + private Color defaultColor = Color.WHITE; + private Dimension gutter = new Dimension(3, 0); + private Point preferredLocation = new Point(); + private Dimension preferredSize = new Dimension(ComponentConstants.STANDARD_WIDTH, 0); + + @Override + public Dimension render(final Graphics2D graphics) + { + final FontMetrics metrics = graphics.getFontMetrics(); + final TableRow colRow = TableRow.builder().elements(this.columns).build(); + final int[] columnWidths = getColumnWidths(metrics, colRow); + + graphics.translate(preferredLocation.x, preferredLocation.y); + + // Display the columns first + int height = displayRow(graphics, colRow, 0, columnWidths, metrics); + + for (TableRow row : this.rows) + { + height = displayRow(graphics, row, height, columnWidths, metrics); + } + + graphics.translate(-preferredLocation.x, -preferredLocation.y); + + final Dimension dimension = new Dimension(preferredSize.width, height); + bounds.setLocation(preferredLocation); + bounds.setSize(dimension); + + return dimension; + } + + private int displayRow(Graphics2D graphics, TableRow row, int height, int[] columnWidths, FontMetrics metrics) + { + int x = 0; + int startingRowHeight = height; + + final List elements = row.getElements(); + for (int i = 0; i < elements.size(); i++) + { + int y = startingRowHeight; + final TableElement cell = elements.get(i); + + final String content = cell.getContent(); + if (content == null) + { + continue; + } + + final String[] lines = lineBreakText(content, columnWidths[i], metrics); + final TableAlignment alignment = getCellAlignment(row, i); + final Color color = getCellColor(row, i); + + for (String line : lines) + { + final int alignmentOffset = getAlignedPosition(line, alignment, columnWidths[i], metrics); + final TextComponent leftLineComponent = new TextComponent(); + y += metrics.getHeight(); + + leftLineComponent.setPosition(new Point(x + alignmentOffset, y)); + leftLineComponent.setText(line); + leftLineComponent.setColor(color); + leftLineComponent.render(graphics); + } + height = Math.max(height, y); + x += columnWidths[i] + gutter.width; + } + + return height + gutter.height; + } + + /** + * Returns the width that each column should take up + * Based on https://stackoverflow.com/questions/22206825/algorithm-for-calculating-variable-column-widths-for-set-table-width + * @param metrics + * @return int[] of column width + */ + private int[] getColumnWidths(final FontMetrics metrics, final TableRow columnRow) + { + int numCols = columns.size(); + for (final TableRow r : rows) + { + numCols = Math.max(r.getElements().size(), numCols); + } + + int[] maxtextw = new int[numCols]; // max text width over all rows + int[] maxwordw = new int[numCols]; // max width of longest word + boolean[] flex = new boolean[numCols]; // is column flexible? + boolean[] wrap = new boolean[numCols]; // can column be wrapped? + int[] finalcolw = new int[numCols]; // final width of columns + + final List rows = new ArrayList<>(this.rows); + rows.add(columnRow); + + for (final TableRow r : rows) + { + final List elements = r.getElements(); + for (int col = 0; col < elements.size(); col++) + { + final TableElement ele = elements.get(col); + final String cell = ele.getContent(); + if (cell == null) + { + continue; + } + + final int cellWidth = getTextWidth(metrics, cell); + + maxtextw[col] = Math.max(maxtextw[col], cellWidth); + for (String word : cell.split(" ")) + { + maxwordw[col] = Math.max(maxwordw[col], getTextWidth(metrics, word)); + } + + if (maxtextw[col] == cellWidth) + { + wrap[col] = cell.contains(" "); + } + } + } + + int left = preferredSize.width - (numCols - 1) * gutter.width; + final double avg = left / numCols; + int nflex = 0; + + // Determine whether columns should be flexible and assign width of non-flexible cells + for (int col = 0; col < numCols; col++) + { + // This limit can be adjusted as needed + final double maxNonFlexLimit = 1.5 * avg; + + flex[col] = maxtextw[col] > maxNonFlexLimit; + if (flex[col]) + { + nflex++; + } + else + { + finalcolw[col] = maxtextw[col]; + left -= finalcolw[col]; + } + } + + // If there is not enough space, make columns that could be word-wrapped flexible too + if (left < nflex * avg) + { + for (int col = 0; col < numCols; col++) + { + if (!flex[col] && wrap[col]) + { + left += finalcolw[col]; + finalcolw[col] = 0; + flex[col] = true; + nflex++; + } + } + } + + // Calculate weights for flexible columns. The max width is capped at the table width to + // treat columns that have to be wrapped more or less equal + int tot = 0; + for (int col = 0; col < numCols; col++) + { + if (flex[col]) + { + maxtextw[col] = Math.min(maxtextw[col], preferredSize.width); + tot += maxtextw[col]; + } + } + + // Now assign the actual width for flexible columns. Make sure that it is at least as long + // as the longest word length + for (int col = 0; col < numCols; col++) + { + if (flex[col]) + { + finalcolw[col] = left * maxtextw[col] / tot; + finalcolw[col] = Math.max(finalcolw[col], maxwordw[col]); + left -= finalcolw[col]; + } + } + + // When the sum of column widths is less than the total space available, distribute the + // extra space equally across all columns + final int extraPerCol = left / numCols; + for (int col = 0; col < numCols; col++) + { + finalcolw[col] += extraPerCol; + left -= extraPerCol; + } + // Add any remainder to the right-most column + finalcolw[finalcolw.length - 1] += left; + + return finalcolw; + } + + private static int getTextWidth(final FontMetrics metrics, final String cell) + { + return metrics.stringWidth(TextComponent.textWithoutColTags(cell)); + } + + private static String[] lineBreakText(final String text, final int maxWidth, final FontMetrics metrics) + { + final String[] words = text.split(" "); + + if (words.length == 0) + { + return new String[0]; + } + + final StringBuilder wrapped = new StringBuilder(words[0]); + int spaceLeft = maxWidth - getTextWidth(metrics, wrapped.toString()); + + for (int i = 1; i < words.length; i++) + { + final String word = words[i]; + final int wordLen = getTextWidth(metrics, word); + final int spaceWidth = metrics.stringWidth(" "); + + if (wordLen + spaceWidth > spaceLeft) + { + wrapped.append("\n").append(word); + spaceLeft = maxWidth - wordLen; + } + else + { + wrapped.append(" ").append(word); + spaceLeft -= spaceWidth + wordLen; + } + } + + return wrapped.toString().split("\n"); + } + + private static int getAlignedPosition(final String str, final TableAlignment alignment, final int columnWidth, final FontMetrics metrics) + { + final int stringWidth = getTextWidth(metrics, str); + int offset = 0; + + switch (alignment) + { + case LEFT: + break; + case CENTER: + offset = (columnWidth / 2) - (stringWidth / 2); + break; + case RIGHT: + offset = columnWidth - stringWidth; + break; + } + return offset; + } + + /** + * Returns the color for the specified table element. + * Priority order: cell->row->column->default + * @param row TableRow element + * @param colIndex column index + */ + private Color getCellColor(final TableRow row, final int colIndex) + { + final List rowElements = row.getElements(); + final TableElement cell = colIndex < rowElements.size() ? rowElements.get(colIndex) : EMPTY_ELEMENT; + final TableElement column = colIndex < columns.size() ? columns.get(colIndex) : EMPTY_ELEMENT; + + return firstNonNull( + cell.getColor(), + row.getRowColor(), + column.getColor(), + defaultColor); + } + + /** + * Returns the alignment for the specified table element. + * Priority order: cell->row->column->default + * @param row TableRow element + * @param colIndex column index + */ + private TableAlignment getCellAlignment(final TableRow row, final int colIndex) + { + final List rowElements = row.getElements(); + final TableElement cell = colIndex < rowElements.size() ? rowElements.get(colIndex) : EMPTY_ELEMENT; + final TableElement column = colIndex < columns.size() ? columns.get(colIndex) : EMPTY_ELEMENT; + + return firstNonNull( + cell.getAlignment(), + row.getRowAlignment(), + column.getAlignment(), + defaultAlignment); + } + + @SafeVarargs + private static T firstNonNull(@Nullable T... elements) + { + if (elements == null || elements.length == 0) + { + return null; + } + + int i = 0; + T cur = elements[0]; + while (cur == null && i < elements.length) + { + cur = elements[i]; + i++; + } + + return cur; + } + + // Helper functions for cleaner overlay code + public void addRow(@Nonnull final String... cells) + { + final List elements = new ArrayList<>(); + for (final String cell : cells) + { + elements.add(TableElement.builder().content(cell).build()); + } + + final TableRow row = TableRow.builder().build(); + row.setElements(elements); + + this.rows.add(row); + } + + public void addRows(@Nonnull final String[]... rows) + { + for (String[] row : rows) + { + addRow(row); + } + } + + public void addRows(@NonNull final TableRow... rows) + { + this.rows.addAll(Arrays.asList(rows)); + } + + public void setRows(@Nonnull final String[]... elements) + { + this.rows.clear(); + addRows(elements); + } + + public void setRows(@Nonnull final TableRow... elements) + { + this.rows.clear(); + this.rows.addAll(Arrays.asList(elements)); + } + + public void addColumn(@Nonnull final String col) + { + this.columns.add(TableElement.builder().content(col).build()); + } + + public void addColumns(@NonNull final TableElement... columns) + { + this.columns.addAll(Arrays.asList(columns)); + } + + public void setColumns(@Nonnull final TableElement... elements) + { + this.columns.clear(); + this.columns.addAll(Arrays.asList(elements)); + } + + public void setColumns(@Nonnull final String... columns) + { + this.columns.clear(); + for (String col : columns) + { + addColumn(col); + } + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableElement.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableElement.java new file mode 100644 index 0000000000..8229f9533c --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableElement.java @@ -0,0 +1,38 @@ +/* + * Copyright (c) 2019, TheStonedTurtle + * 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.ui.overlay.components.table; + +import java.awt.Color; +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class TableElement +{ + TableAlignment alignment; + Color color; + String content; +} diff --git a/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableRow.java b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableRow.java new file mode 100644 index 0000000000..8879b08c5e --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/ui/overlay/components/table/TableRow.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019, TheStonedTurtle + * 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.ui.overlay.components.table; + +import java.awt.Color; +import java.util.ArrayList; +import java.util.List; +import lombok.Builder; +import lombok.Data; + +@Data +@Builder +public class TableRow +{ + Color rowColor; + TableAlignment rowAlignment; + @Builder.Default + List elements = new ArrayList<>(); +} diff --git a/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/table/TableComponentTest.java b/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/table/TableComponentTest.java new file mode 100644 index 0000000000..1c7e95d37a --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/ui/overlay/components/table/TableComponentTest.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2018, Jordan Atwood + * 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.ui.overlay.components.table; + +import java.awt.Color; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.util.List; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Matchers.eq; +import org.mockito.Mock; +import static org.mockito.Mockito.atLeastOnce; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.times; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import org.mockito.runners.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class TableComponentTest +{ + @Mock + private Graphics2D graphics; + + @Before + public void before() + { + when(graphics.getFontMetrics()).thenReturn(mock(FontMetrics.class)); + } + + @Test + public void testRender() + { + TableComponent tableComponent = new TableComponent(); + tableComponent.addRow("test"); + tableComponent.setDefaultAlignment(TableAlignment.CENTER); + tableComponent.setDefaultColor(Color.RED); + tableComponent.render(graphics); + verify(graphics, times(2)).drawString(eq("test"), anyInt(), anyInt()); + verify(graphics, atLeastOnce()).setColor(Color.RED); + } + + @Test + public void testColors() + { + TableComponent tableComponent = new TableComponent(); + tableComponent.addRow("test", "test", "test", "test", "test"); + tableComponent.setColumns("", "", ""); + List elements = tableComponent.getColumns(); + elements.get(0).setColor(Color.RED); + elements.get(1).setColor(Color.GREEN); + elements.get(2).setColor(Color.BLUE); + tableComponent.render(graphics); + verify(graphics, atLeastOnce()).setColor(Color.RED); + verify(graphics, atLeastOnce()).setColor(Color.GREEN); + verify(graphics, atLeastOnce()).setColor(Color.BLUE); + verify(graphics, atLeastOnce()).setColor(Color.YELLOW); + verify(graphics, atLeastOnce()).setColor(Color.WHITE); + } +} From 8e34edd4a09b803e821a3183fb417a4e8fbddbaa Mon Sep 17 00:00:00 2001 From: TheStonedTurtle Date: Wed, 17 Apr 2019 21:52:06 -0700 Subject: [PATCH 012/117] Add performance stats plugin --- .../plugins/performancestats/Performance.java | 108 +++++ .../PerformanceStatsConfig.java | 44 ++ .../PerformanceStatsOverlay.java | 109 +++++ .../PerformanceStatsPlugin.java | 384 ++++++++++++++++++ .../src/main/scripts/FakeXPDrops.hash | 1 + .../src/main/scripts/FakeXPDrops.rs2asm | 256 ++++++++++++ 6 files changed, 902 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/performancestats/Performance.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsConfig.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java create mode 100644 runelite-client/src/main/scripts/FakeXPDrops.hash create mode 100644 runelite-client/src/main/scripts/FakeXPDrops.rs2asm diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/Performance.java b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/Performance.java new file mode 100644 index 0000000000..2f7967f8f1 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/Performance.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2019, TheStonedTurtle + * 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.performancestats; + +import lombok.Getter; +import lombok.Setter; + +@Getter +class Performance +{ + private static final double TICK_LENGTH = 0.6; + + String username; + + double damageDealt = 0; + double highestHitDealt = 0; + + double damageTaken = 0; + double highestHitTaken = 0; + + int lastActivityTick = -1; + @Setter + double ticksSpent = 0; + + void addDamageDealt(double a, int currentTick) + { + damageDealt += a; + if (a > highestHitDealt) + { + highestHitDealt = a; + } + + this.lastActivityTick = currentTick; + } + + void addDamageTaken(double a, int currentTick) + { + damageTaken += a; + if (a > highestHitTaken) + { + highestHitTaken = a; + } + + this.lastActivityTick = currentTick; + } + + void incrementTicksSpent() + { + ticksSpent++; + } + + void reset() + { + damageDealt = 0; + highestHitDealt = 0; + damageTaken = 0; + highestHitTaken = 0; + lastActivityTick = -1; + ticksSpent = 0; + } + + double getSecondsSpent() + { + return Math.round(this.ticksSpent * TICK_LENGTH); + } + + double getDPS() + { + return Math.round( (this.damageDealt / this.getSecondsSpent()) * 100) / 100.00; + } + + String getHumanReadableSecondsSpent() + { + final double secondsSpent = getSecondsSpent(); + if (secondsSpent <= 60) + { + return String.format("%2.0f", secondsSpent) + "s"; + } + + final double s = secondsSpent % 3600 % 60; + final double m = Math.floor(secondsSpent % 3600 / 60); + final double h = Math.floor(secondsSpent / 3600); + + return h < 1 ? String.format("%2.0f:%02.0f", m, s) : String.format("%2.0f:%02.0f:%02.0f", h, m, s); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsConfig.java new file mode 100644 index 0000000000..1c6aea301d --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsConfig.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2019, TheStonedTurtle + * 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.performancestats; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("performancestats") +public interface PerformanceStatsConfig extends Config +{ + @ConfigItem( + position = 0, + keyName = "submitTimeout", + name = "Submit Timeout (seconds)", + description = "Submits after this many seconds of inactivity" + ) + default int submitTimeout() + { + return 30; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsOverlay.java new file mode 100644 index 0000000000..63e94e2fc0 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsOverlay.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2018, TheStonedTurtle + * 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.performancestats; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import javax.inject.Inject; +import net.runelite.api.MenuAction; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayMenuEntry; +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.PanelComponent; +import net.runelite.client.ui.overlay.components.table.TableAlignment; +import net.runelite.client.ui.overlay.components.table.TableComponent; + +public class PerformanceStatsOverlay extends Overlay +{ + private static final String TARGET = "Performance Stats"; + private static final String[] COLUMNS = { + "Player", "Dealt", "Taken", "DPS", "Elapsed" + }; + + private final PerformanceStatsPlugin tracker; + private final PanelComponent panelComponent = new PanelComponent(); + private final TableComponent tableComponent = new TableComponent(); + + @Inject + PerformanceStatsOverlay(PerformanceStatsPlugin tracker) + { + super(tracker); + setPosition(OverlayPosition.TOP_RIGHT); + setPriority(OverlayPriority.LOW); + this.tracker = tracker; + + getMenuEntries().add(new OverlayMenuEntry(MenuAction.RUNELITE_OVERLAY, "Pause", TARGET)); + getMenuEntries().add(new OverlayMenuEntry(MenuAction.RUNELITE_OVERLAY, "Reset", TARGET)); + getMenuEntries().add(new OverlayMenuEntry(MenuAction.RUNELITE_OVERLAY, "Submit", TARGET)); + + panelComponent.setPreferredSize(new Dimension(350, 0)); + panelComponent.setBackgroundColor(ComponentConstants.STANDARD_BACKGROUND_COLOR); + + tableComponent.setDefaultAlignment(TableAlignment.CENTER); + tableComponent.setColumns(COLUMNS); + + panelComponent.getChildren().add(tableComponent); + } + + @Override + public String getName() + { + return TARGET; + } + + @Override + public Dimension render(Graphics2D graphics) + { + if (!tracker.isEnabled()) + { + return null; + } + + final Performance performance = tracker.getPerformance(); + graphics.setColor(Color.WHITE); + + tableComponent.getRows().clear(); + + final String[] rowElements = createRowElements(performance); + tableComponent.addRow(rowElements); + + return panelComponent.render(graphics); + } + + private String[] createRowElements(Performance performance) + { + return new String[] + { + performance.getUsername(), + String.valueOf((int) Math.round(performance.getDamageDealt())) + " | " + String.valueOf((int) Math.round(performance.getHighestHitDealt())), + String.valueOf((int) Math.round(performance.getDamageTaken())) + " | " + String.valueOf((int) Math.round(performance.getHighestHitTaken())), + String.valueOf(performance.getDPS()), + performance.getHumanReadableSecondsSpent() + }; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java new file mode 100644 index 0000000000..37b70eb03d --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java @@ -0,0 +1,384 @@ +/* + * Copyright (c) 2018, TheStonedTurtle + * 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.performancestats; + +import com.google.inject.Provides; +import java.text.DecimalFormat; +import javax.inject.Inject; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Actor; +import net.runelite.api.ChatMessageType; +import net.runelite.api.Client; +import net.runelite.api.NPC; +import net.runelite.api.Skill; +import net.runelite.api.WorldType; +import net.runelite.api.events.ExperienceChanged; +import net.runelite.api.events.GameStateChanged; +import net.runelite.api.events.GameTick; +import net.runelite.api.events.HitsplatApplied; +import net.runelite.api.events.ScriptCallbackEvent; +import net.runelite.client.chat.ChatColorType; +import net.runelite.client.chat.ChatMessageBuilder; +import net.runelite.client.chat.ChatMessageManager; +import net.runelite.client.chat.QueuedMessage; +import net.runelite.client.config.ConfigManager; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.OverlayMenuClicked; +import net.runelite.client.game.NPCManager; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.ui.overlay.OverlayManager; + +@PluginDescriptor( + name = "Performance Stats", + description = "Displays your current performance stats", + tags = {"performance", "stats", "dps", "damage", "combat"}, + enabledByDefault = false +) +@Slf4j +public class PerformanceStatsPlugin extends Plugin +{ + // For every damage point dealt 1.33 experience is given to the player's hitpoints (base rate) + private static final double HITPOINT_RATIO = 1.33; + private static final double DMM_MULTIPLIER_RATIO = 10; + + private static final double GAME_TICK_SECONDS = 0.6; + private static final DecimalFormat numberFormat = new DecimalFormat("#,###"); + + @Inject + private Client client; + + @Inject + private ChatMessageManager chatMessageManager; + + @Inject + private PerformanceStatsConfig config; + + @Inject + private PerformanceStatsOverlay performanceTrackerOverlay; + + @Inject + private OverlayManager overlayManager; + + @Inject + private NPCManager npcManager; + + @Getter + private boolean enabled = false; + @Getter + private boolean paused = false; + @Getter + private final Performance performance = new Performance(); + + // Keep track of actor last tick as sometimes getInteracting can return null when hp xp event is triggered + // as the player clicked away at the perfect time + private Actor oldTarget; + private double hpExp; + private boolean hopping; + private int pausedTicks = 0; + + @Provides + PerformanceStatsConfig getConfig(ConfigManager configManager) + { + return configManager.getConfig(PerformanceStatsConfig.class); + } + + @Override + protected void startUp() + { + overlayManager.add(performanceTrackerOverlay); + } + + @Override + protected void shutDown() + { + overlayManager.remove(performanceTrackerOverlay); + disable(); + reset(); + } + + @Subscribe + public void onGameStateChanged(GameStateChanged event) + { + switch (event.getGameState()) + { + case LOGIN_SCREEN: + disable(); + break; + case HOPPING: + hopping = true; + break; + } + } + + @Subscribe + public void onHitsplatApplied(HitsplatApplied e) + { + if (isPaused()) + { + return; + } + + if (e.getActor().equals(client.getLocalPlayer())) + { + // Auto enables when hitsplat is applied to player + if (!isEnabled()) + { + enable(); + } + + performance.addDamageTaken(e.getHitsplat().getAmount(), client.getTickCount()); + } + } + + @Subscribe + public void onExperienceChanged(ExperienceChanged c) + { + if (isPaused() || hopping) + { + return; + } + + if (c.getSkill().equals(Skill.HITPOINTS)) + { + final double oldExp = hpExp; + hpExp = client.getSkillExperience(Skill.HITPOINTS); + + // Ignore initial login + if (client.getTickCount() < 2) + { + return; + } + + final double diff = hpExp - oldExp; + if (diff < 1) + { + return; + } + + // Auto enables when player receives hp exp + if (!isEnabled()) + { + enable(); + } + + final double damageDealt = calculateDamageDealt(diff); + performance.addDamageDealt(damageDealt, client.getTickCount()); + } + } + + @Subscribe + public void onScriptCallbackEvent(ScriptCallbackEvent e) + { + // Handles Fake XP drops (Ironman in PvP, DMM Cap, 200m xp, etc) + if (isPaused()) + { + return; + } + + if (!"fakeXpDrop".equals(e.getEventName())) + { + return; + } + + final int[] intStack = client.getIntStack(); + final int intStackSize = client.getIntStackSize(); + + final int skillId = intStack[intStackSize - 2]; + final Skill skill = Skill.values()[skillId]; + if (skill.equals(Skill.HITPOINTS)) + { + // Auto enables when player would have received hp exp + if (!isEnabled()) + { + enable(); + } + + final int exp = intStack[intStackSize - 1]; + performance.addDamageDealt(calculateDamageDealt(exp), client.getTickCount()); + } + } + + @Subscribe + public void onGameTick(GameTick t) + { + oldTarget = client.getLocalPlayer().getInteracting(); + + if (!isEnabled()) + { + return; + } + + if (isPaused()) + { + pausedTicks++; + return; + } + + performance.incrementTicksSpent(); + hopping = false; + + final int timeout = config.submitTimeout(); + if (timeout > 0) + { + final double tickTimeout = timeout / GAME_TICK_SECONDS; + final int activityDiff = (client.getTickCount() - pausedTicks) - performance.getLastActivityTick(); + if (activityDiff > tickTimeout) + { + // offset the tracker time to account for idle timeout + // Leave an additional tick to pad elapsed time + final double offset = tickTimeout - GAME_TICK_SECONDS; + performance.setTicksSpent(performance.getTicksSpent() - offset); + + submit(); + } + } + } + + @Subscribe + public void onOverlayMenuClicked(OverlayMenuClicked c) + { + if (!c.getOverlay().equals(performanceTrackerOverlay)) + { + return; + } + + switch (c.getEntry().getOption()) + { + case "Pause": + togglePaused(); + break; + case "Reset": + reset(); + break; + case "Submit": + submit(); + break; + } + } + + private void enable() + { + this.enabled = true; + hpExp = client.getSkillExperience(Skill.HITPOINTS); + } + + private void disable() + { + this.enabled = false; + } + + private void togglePaused() + { + this.paused = !this.paused; + } + + private void reset() + { + this.enabled = false; + this.paused = false; + + this.performance.reset(); + pausedTicks = 0; + } + + private void submit() + { + final String message = createPerformanceMessage(performance); + + chatMessageManager.queue(QueuedMessage.builder() + .type(ChatMessageType.GAMEMESSAGE) + .runeLiteFormattedMessage(message) + .build()); + + reset(); + } + + /** + * Calculates damage dealt based on HP xp gained accounting for multipliers such as DMM mode + * @param diff HP xp gained + * @return damage dealt + */ + private double calculateDamageDealt(double diff) + { + double damageDealt = diff / HITPOINT_RATIO; + // DeadMan mode has an XP modifier + if (client.getWorldType().contains(WorldType.DEADMAN)) + { + damageDealt = damageDealt / DMM_MULTIPLIER_RATIO; + } + + // Some NPCs have an XP modifier, account for it here. + Actor a = client.getLocalPlayer().getInteracting(); + if (!(a instanceof NPC)) + { + // If we are interacting with nothing we may have clicked away at the perfect time fall back to last tick + if (!(oldTarget instanceof NPC)) + { + log.warn("Couldn't find current or past target for experienced gain..."); + return damageDealt; + } + + a = oldTarget; + } + + final int npcId = ((NPC) a).getId(); + return damageDealt / npcManager.getXpModifier(npcId); + } + + private String createPerformanceMessage(final Performance p) + { + // Expected result: Damage Dealt: ## (Max: ##), Damage Taken: ## (Max: ##), Time Spent: ##:## (DPS: ##.##) + return new ChatMessageBuilder() + .append(ChatColorType.NORMAL) + .append("Damage dealt: ") + .append(ChatColorType.HIGHLIGHT) + .append(numberFormat.format(p.getDamageDealt())) + .append(ChatColorType.NORMAL) + .append(" (Max: ") + .append(ChatColorType.HIGHLIGHT) + .append(numberFormat.format(p.getHighestHitDealt())) + .append(ChatColorType.NORMAL) + .append("), Damage Taken: ") + .append(ChatColorType.HIGHLIGHT) + .append(numberFormat.format(p.getDamageTaken())) + .append(ChatColorType.NORMAL) + .append(" (Max: ") + .append(ChatColorType.HIGHLIGHT) + .append(numberFormat.format(p.getHighestHitTaken())) + .append(ChatColorType.NORMAL) + .append("), Time Spent: ") + .append(ChatColorType.HIGHLIGHT) + .append(p.getHumanReadableSecondsSpent()) + .append(ChatColorType.NORMAL) + .append(" (DPS: ") + .append(ChatColorType.HIGHLIGHT) + .append(String.valueOf(p.getDPS())) + .append(ChatColorType.NORMAL) + .append(")") + .build(); + } +} diff --git a/runelite-client/src/main/scripts/FakeXPDrops.hash b/runelite-client/src/main/scripts/FakeXPDrops.hash new file mode 100644 index 0000000000..cf5e37e931 --- /dev/null +++ b/runelite-client/src/main/scripts/FakeXPDrops.hash @@ -0,0 +1 @@ +32FBC48F8C6D8E62E02BCF09F444BA036F76133B6596396F0AB9E474687D9F3F \ No newline at end of file diff --git a/runelite-client/src/main/scripts/FakeXPDrops.rs2asm b/runelite-client/src/main/scripts/FakeXPDrops.rs2asm new file mode 100644 index 0000000000..0a61b8b13a --- /dev/null +++ b/runelite-client/src/main/scripts/FakeXPDrops.rs2asm @@ -0,0 +1,256 @@ +.id 2091 +.int_stack_count 2 +.string_stack_count 0 +.int_var_count 2 +.string_var_count 0 + iload 0 + iload 1 + sconst "fakeXpDrop" + runelite_callback ; + pop_int + pop_int + iconst 105 + iconst 83 + iconst 681 + get_varc_int 207 + coordx + enum + iload 0 + if_icmpeq LABEL9 + jump LABEL16 +LABEL9: + get_varc_int 207 + iconst 0 + iconst 0 + iload 1 + movecoord + set_varc_int 207 + jump LABEL216 +LABEL16: + iconst 105 + iconst 83 + iconst 681 + get_varc_int 208 + coordx + enum + iload 0 + if_icmpeq LABEL25 + jump LABEL32 +LABEL25: + get_varc_int 208 + iconst 0 + iconst 0 + iload 1 + movecoord + set_varc_int 208 + jump LABEL216 +LABEL32: + iconst 105 + iconst 83 + iconst 681 + get_varc_int 209 + coordx + enum + iload 0 + if_icmpeq LABEL41 + jump LABEL48 +LABEL41: + get_varc_int 209 + iconst 0 + iconst 0 + iload 1 + movecoord + set_varc_int 209 + jump LABEL216 +LABEL48: + iconst 105 + iconst 83 + iconst 681 + get_varc_int 210 + coordx + enum + iload 0 + if_icmpeq LABEL57 + jump LABEL64 +LABEL57: + get_varc_int 210 + iconst 0 + iconst 0 + iload 1 + movecoord + set_varc_int 210 + jump LABEL216 +LABEL64: + iconst 105 + iconst 83 + iconst 681 + get_varc_int 211 + coordx + enum + iload 0 + if_icmpeq LABEL73 + jump LABEL80 +LABEL73: + get_varc_int 211 + iconst 0 + iconst 0 + iload 1 + movecoord + set_varc_int 211 + jump LABEL216 +LABEL80: + iconst 105 + iconst 83 + iconst 681 + get_varc_int 212 + coordx + enum + iload 0 + if_icmpeq LABEL89 + jump LABEL96 +LABEL89: + get_varc_int 212 + iconst 0 + iconst 0 + iload 1 + movecoord + set_varc_int 212 + jump LABEL216 +LABEL96: + iconst 105 + iconst 83 + iconst 681 + get_varc_int 213 + coordx + enum + iload 0 + if_icmpeq LABEL105 + jump LABEL112 +LABEL105: + get_varc_int 213 + iconst 0 + iconst 0 + iload 1 + movecoord + set_varc_int 213 + jump LABEL216 +LABEL112: + get_varc_int 207 + iconst -1 + if_icmpeq LABEL116 + jump LABEL127 +LABEL116: + iconst 0 + iconst 83 + iconst 105 + iconst 81 + iload 0 + enum + iconst 0 + iload 1 + movecoord + set_varc_int 207 + jump LABEL216 +LABEL127: + get_varc_int 208 + iconst -1 + if_icmpeq LABEL131 + jump LABEL142 +LABEL131: + iconst 0 + iconst 83 + iconst 105 + iconst 81 + iload 0 + enum + iconst 0 + iload 1 + movecoord + set_varc_int 208 + jump LABEL216 +LABEL142: + get_varc_int 209 + iconst -1 + if_icmpeq LABEL146 + jump LABEL157 +LABEL146: + iconst 0 + iconst 83 + iconst 105 + iconst 81 + iload 0 + enum + iconst 0 + iload 1 + movecoord + set_varc_int 209 + jump LABEL216 +LABEL157: + get_varc_int 210 + iconst -1 + if_icmpeq LABEL161 + jump LABEL172 +LABEL161: + iconst 0 + iconst 83 + iconst 105 + iconst 81 + iload 0 + enum + iconst 0 + iload 1 + movecoord + set_varc_int 210 + jump LABEL216 +LABEL172: + get_varc_int 211 + iconst -1 + if_icmpeq LABEL176 + jump LABEL187 +LABEL176: + iconst 0 + iconst 83 + iconst 105 + iconst 81 + iload 0 + enum + iconst 0 + iload 1 + movecoord + set_varc_int 211 + jump LABEL216 +LABEL187: + get_varc_int 212 + iconst -1 + if_icmpeq LABEL191 + jump LABEL202 +LABEL191: + iconst 0 + iconst 83 + iconst 105 + iconst 81 + iload 0 + enum + iconst 0 + iload 1 + movecoord + set_varc_int 212 + jump LABEL216 +LABEL202: + get_varc_int 213 + iconst -1 + if_icmpeq LABEL206 + jump LABEL216 +LABEL206: + iconst 0 + iconst 83 + iconst 105 + iconst 81 + iload 0 + enum + iconst 0 + iload 1 + movecoord + set_varc_int 213 +LABEL216: + return From 3da6a2cd390b6d820a2fbf970efc88922d225c7d Mon Sep 17 00:00:00 2001 From: TheStonedTurtle Date: Wed, 17 Apr 2019 22:11:47 -0700 Subject: [PATCH 013/117] Add party support --- .../plugins/performancestats/Performance.java | 4 +- .../PerformanceStatsOverlay.java | 11 ++++ .../PerformanceStatsPlugin.java | 66 +++++++++++++++++++ 3 files changed, 80 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/Performance.java b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/Performance.java index 2f7967f8f1..cc81fa1bfb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/Performance.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/Performance.java @@ -26,12 +26,14 @@ package net.runelite.client.plugins.performancestats; import lombok.Getter; import lombok.Setter; +import net.runelite.http.api.ws.messages.party.PartyMemberMessage; @Getter -class Performance +class Performance extends PartyMemberMessage { private static final double TICK_LENGTH = 0.6; + @Setter String username; double damageDealt = 0; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsOverlay.java index 63e94e2fc0..c2d2961034 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsOverlay.java @@ -92,6 +92,17 @@ public class PerformanceStatsOverlay extends Overlay final String[] rowElements = createRowElements(performance); tableComponent.addRow(rowElements); + for (Performance p : tracker.getPartyDataMap().values()) + { + if (p.getMemberId().equals(performance.getMemberId())) + { + continue; + } + + final String[] eles = createRowElements(p); + tableComponent.addRow(eles); + } + return panelComponent.render(graphics); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java index 37b70eb03d..4eac3aa1ed 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java @@ -26,6 +26,10 @@ package net.runelite.client.plugins.performancestats; import com.google.inject.Provides; import java.text.DecimalFormat; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import java.util.UUID; import javax.inject.Inject; import lombok.Getter; import lombok.extern.slf4j.Slf4j; @@ -47,10 +51,17 @@ import net.runelite.client.chat.QueuedMessage; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.events.OverlayMenuClicked; +import net.runelite.client.events.PartyChanged; import net.runelite.client.game.NPCManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.client.util.Text; +import net.runelite.client.ws.PartyMember; +import net.runelite.client.ws.PartyService; +import net.runelite.client.ws.WSClient; +import net.runelite.http.api.ws.messages.party.UserPart; +import net.runelite.http.api.ws.messages.party.UserSync; @PluginDescriptor( name = "Performance Stats", @@ -86,6 +97,12 @@ public class PerformanceStatsPlugin extends Plugin @Inject private NPCManager npcManager; + @Inject + private PartyService partyService; + + @Inject + private WSClient wsClient; + @Getter private boolean enabled = false; @Getter @@ -100,6 +117,10 @@ public class PerformanceStatsPlugin extends Plugin private boolean hopping; private int pausedTicks = 0; + // Party System + @Getter + private final Map partyDataMap = Collections.synchronizedMap(new HashMap<>()); + @Provides PerformanceStatsConfig getConfig(ConfigManager configManager) { @@ -110,12 +131,14 @@ public class PerformanceStatsPlugin extends Plugin protected void startUp() { overlayManager.add(performanceTrackerOverlay); + wsClient.registerMessage(Performance.class); } @Override protected void shutDown() { overlayManager.remove(performanceTrackerOverlay); + wsClient.unregisterMessage(Performance.class); disable(); reset(); } @@ -256,6 +279,10 @@ public class PerformanceStatsPlugin extends Plugin submit(); } } + + final String name = client.getLocalPlayer().getName(); + performance.setUsername(Text.removeTags(name)); + sendPerformance(); } @Subscribe @@ -381,4 +408,43 @@ public class PerformanceStatsPlugin extends Plugin .append(")") .build(); } + + private void sendPerformance() + { + final PartyMember me = partyService.getLocalMember(); + if (me != null && me.getMemberId() != null) + { + performance.setMemberId(me.getMemberId()); + wsClient.send(performance); + } + } + + @Subscribe + public void onPerformance(final Performance performance) + { + partyDataMap.put(performance.getMemberId(), performance); + } + + @Subscribe + public void onUserSync(final UserSync event) + { + if (isEnabled()) + { + sendPerformance(); + } + } + + @Subscribe + public void onUserPart(final UserPart event) + { + partyDataMap.remove(event.getMemberId()); + } + + @Subscribe + public void onPartyChanged(final PartyChanged event) + { + // Reset party + partyDataMap.clear(); + } + } From faed3ec1bf7d03d572ad9d2f5e5c5bdc6f0f0b48 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 11 May 2019 14:22:24 -0400 Subject: [PATCH 014/117] dps --- .../client/plugins/dpscounter/Boss.java | 78 +++++++++ .../plugins/dpscounter/DpsCounterPlugin.java | 159 ++++++++++++++++++ .../client/plugins/dpscounter/DpsMember.java | 26 +++ .../client/plugins/dpscounter/DpsOverlay.java | 73 ++++++++ .../client/plugins/dpscounter/DpsUpdate.java | 13 ++ 5 files changed, 349 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsUpdate.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java new file mode 100644 index 0000000000..bfd4587e25 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2018, Raqes + * 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.dpscounter; + +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import lombok.Getter; +import lombok.ToString; +import net.runelite.api.NpcID; + +@Getter +@ToString +enum Boss +{ + ABYSSAL_SIRE(1.25f, NpcID.ABYSSAL_SIRE, NpcID.ABYSSAL_SIRE_5887, NpcID.ABYSSAL_SIRE_5888, NpcID.ABYSSAL_SIRE_5889, NpcID.ABYSSAL_SIRE_5890, NpcID.ABYSSAL_SIRE_5891, NpcID.ABYSSAL_SIRE_5908), + CALLISTO(1.225f, NpcID.CALLISTO, NpcID.CALLISTO_6609), + CERBERUS(1.15f, NpcID.CERBERUS, NpcID.CERBERUS_5863, NpcID.CERBERUS_5866), + CHAOS_ELEMENTAL(1.075f, NpcID.CHAOS_ELEMENTAL, NpcID.CHAOS_ELEMENTAL_6505), + CORPOREAL_BEAST(1.55f, NpcID.CORPOREAL_BEAST), + GENERAL_GRAARDOR(1.325f, NpcID.GENERAL_GRAARDOR, NpcID.GENERAL_GRAARDOR_6494), + GIANT_MOLE(1.075f, NpcID.GIANT_MOLE, NpcID.GIANT_MOLE_6499), + KALPHITE_QUEEN(1.05f, NpcID.KALPHITE_QUEEN, NpcID.KALPHITE_QUEEN_963, NpcID.KALPHITE_QUEEN_965, NpcID.KALPHITE_QUEEN_4303, NpcID.KALPHITE_QUEEN_4304, NpcID.KALPHITE_QUEEN_6500, NpcID.KALPHITE_QUEEN_6501), + KING_BLACK_DRAGON(1.075f, NpcID.KING_BLACK_DRAGON, NpcID.KING_BLACK_DRAGON_2642, NpcID.KING_BLACK_DRAGON_6502), + KRIL_TSUROTH(1.375f, NpcID.KRIL_TSUTSAROTH, NpcID.KRIL_TSUTSAROTH_6495), + VENETENATIS(1.4f, NpcID.VENENATIS, NpcID.VENENATIS_6610), + VETION(1.225f, NpcID.VETION, NpcID.VETION_REBORN); + + private final int[] ids; + private final float modifier; // Some NPCs have a modifier to the experience a player receives. + + Boss(float modifier, int... ids) + { + this.modifier = modifier; + this.ids = ids; + } + + private static final Map BOSS_MAP; + + static Boss findBoss(int id) + { + return BOSS_MAP.get(id); + } + + static + { + ImmutableMap.Builder builder = ImmutableMap.builder(); + for (Boss boss : values()) + { + for (int id : boss.ids) + { + builder.put(id, boss); + } + } + BOSS_MAP = builder.build(); + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java new file mode 100644 index 0000000000..af9eef5dba --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -0,0 +1,159 @@ +package net.runelite.client.plugins.dpscounter; + +import com.google.inject.Binder; +import com.google.inject.Inject; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; +import lombok.AccessLevel; +import lombok.Getter; +import net.runelite.api.Actor; +import net.runelite.api.Client; +import net.runelite.api.NPC; +import net.runelite.api.Player; +import net.runelite.api.Skill; +import net.runelite.api.events.ExperienceChanged; +import net.runelite.api.events.InteractingChanged; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.client.ws.PartyMember; +import net.runelite.client.ws.PartyService; +import net.runelite.client.ws.WSClient; + +@PluginDescriptor( + name = "DPS Counter", + description = "counts dps?" +// +) +public class DpsCounterPlugin extends Plugin +{ + private int lastXp = -1; + + @Inject + private Client client; + + @Inject + private OverlayManager overlayManager; + + @Inject + private PartyService partyService; + + @Inject + private WSClient wsClient; + + @Inject + private DpsOverlay dpsOverlay; + + private Boss boss; + private NPC npc; + @Getter(AccessLevel.PACKAGE) + private final Map members = new ConcurrentHashMap<>(); + + @Override + public void configure(Binder binder) + { + //super.configure(binder); + } + + @Override + protected void startUp() + { + overlayManager.add(dpsOverlay); + //super.startUp(); + } + + @Override + protected void shutDown() + { + overlayManager.remove(dpsOverlay); + boss = null; + //super.shutDown(); + } + + @Subscribe + public void onInteractingChanged(InteractingChanged interactingChanged) { + Actor source = interactingChanged.getSource(); + Actor target = interactingChanged.getTarget(); + + if (source != client.getLocalPlayer()) { + return; + } + + if (target instanceof NPC) { + int npcId = ((NPC) target).getId(); + Boss boss = Boss.findBoss(npcId); + if (boss != null) { + this.boss = boss; + npc = (NPC) target; + // boss = Boss.ABYSSAL_SIRE; + } + } + } + + @Subscribe + public void onExperienceChanged(ExperienceChanged experienceChanged) + { + if (experienceChanged.getSkill() != Skill.HITPOINTS) + { + return; + } + + final int xp = client.getSkillExperience(Skill.HITPOINTS); + if (boss == null || lastXp < 0 || xp < lastXp) + { + lastXp = xp; + return; + } + + final int delta = xp - lastXp; + final int hit = getHit(boss.getModifier(), delta); +// final int hit = getHit(1.0f, delta); + lastXp = xp; + + // Update local member + PartyMember localMember = partyService.getLocalMember(); + Player player = client.getLocalPlayer(); + // If not in a party, user local player name + final String name = localMember == null ? player.getName() : localMember.getName(); + DpsMember dpsMember = members.computeIfAbsent(name, n -> new DpsMember(name)); + dpsMember.addDamage(hit); +// System.out.println("HIT "+ hit); + + if (!partyService.getMembers().isEmpty()) + { + // Check the player is attacking the boss + if (npc != null && player.getInteracting() == npc) + { + final DpsUpdate specialCounterUpdate = new DpsUpdate(npc.getId(), hit); + specialCounterUpdate.setMemberId(partyService.getLocalMember().getMemberId()); + wsClient.send(specialCounterUpdate); + } + } + } + + @Subscribe + public void onDpsUpdate(DpsUpdate dpsUpdate) { + if (partyService.getLocalMember().getMemberId().equals(dpsUpdate.getMemberId())) + { + return; + } + + String name = partyService.getMemberById(dpsUpdate.getMemberId()).getName(); + if (name == null) + { + return; + } + + DpsMember dpsMember = members.computeIfAbsent(name, n -> new DpsMember(name)); + dpsMember.addDamage(dpsUpdate.getHit()); + + } + + private int getHit(float modifier, int deltaExperience) + { + float modifierBase = 1f / modifier; + float damageOutput = (deltaExperience * modifierBase) / 1.3333f; + return Math.round(damageOutput); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java new file mode 100644 index 0000000000..6b5693a37f --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java @@ -0,0 +1,26 @@ +package net.runelite.client.plugins.dpscounter; + +import java.time.Instant; +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@RequiredArgsConstructor +@Getter +class DpsMember +{ + private final String name; + private Instant start = Instant.now(); + private int damage; + + void addDamage(int amount) + { + damage += amount; + } + + int getDps() + { + int diff = (int) (Instant.now().toEpochMilli() - start.toEpochMilli()) / 1000; + if (diff == 0) return 0; + return damage / diff; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java new file mode 100644 index 0000000000..42254ab92e --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java @@ -0,0 +1,73 @@ +package net.runelite.client.plugins.dpscounter; + +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.util.Map; +import javax.inject.Inject; +import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.components.LineComponent; +import net.runelite.client.ui.overlay.components.PanelComponent; +import net.runelite.client.ui.overlay.components.TitleComponent; +import net.runelite.client.ws.PartyService; + +public class DpsOverlay extends Overlay +{ + private final DpsCounterPlugin dpsCounterPlugin; + private final PartyService partyService; + + private final PanelComponent panelComponent = new PanelComponent(); + + @Inject + DpsOverlay(DpsCounterPlugin dpsCounterPlugin, PartyService partyService) + { + super(dpsCounterPlugin); + this.dpsCounterPlugin = dpsCounterPlugin; + this.partyService = partyService; + //setPosition(OverlayPosition.TOP_LEFT); + } + + @Override + public Dimension render(Graphics2D graphics) + { + Map dpsMembers = dpsCounterPlugin.getMembers(); + + panelComponent.getChildren().clear(); + panelComponent.getChildren().add( + TitleComponent.builder() + .text("DPS") + //olor(HIGHLIGHT_COLOR) + .build()); + +// panelComponent.getChildren().add( +// LineComponent.builder() +// .left("Player") +// // .leftColor(HIGHLIGHT_COLOR) +// .right("DPS") +// // .rightColor(HIGHLIGHT_COLOR) +// .build()); + + for (DpsMember dpsMember : dpsMembers.values()) { + panelComponent.getChildren().add( + LineComponent.builder() + .left(dpsMember.getName()) + .right(Integer.toString(dpsMember.getDps())) + //.right(Integer.toString(playerSkillLevel) + "/" + Integer.toString(opponentSkillLevel)) + //.rightColor(comparisonStatColor(playerSkillLevel, opponentSkillLevel)) + .build()); + } + + //partyService.getMemberByName() +// for (PartyMember member : partyService.getMembers()) { +// DpsMember dpsMember = dpsMembers.get(member.getName()); +// if (dpsMember == null) continue; +// panelComponent.getChildren().add( +// LineComponent.builder() +// .left(member.getName()) +// .right(Integer.toString(dpsMember.getDps())) +// //.right(Integer.toString(playerSkillLevel) + "/" + Integer.toString(opponentSkillLevel)) +// //.rightColor(comparisonStatColor(playerSkillLevel, opponentSkillLevel)) +// .build()); +// } + return panelComponent.render(graphics); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsUpdate.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsUpdate.java new file mode 100644 index 0000000000..5aa02da373 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsUpdate.java @@ -0,0 +1,13 @@ +package net.runelite.client.plugins.dpscounter; + +import lombok.EqualsAndHashCode; +import lombok.Value; +import net.runelite.http.api.ws.messages.party.PartyMemberMessage; + +@Value +@EqualsAndHashCode(callSuper = true) +public class DpsUpdate extends PartyMemberMessage +{ + private int npcId; + private int hit; +} From a7ab6153f1f1197c48a3b05a27b15b8bd070f248 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 11 May 2019 14:51:50 -0400 Subject: [PATCH 015/117] register dps --- .../runelite/client/plugins/dpscounter/DpsCounterPlugin.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index af9eef5dba..893d31ebcd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -60,12 +60,14 @@ public class DpsCounterPlugin extends Plugin protected void startUp() { overlayManager.add(dpsOverlay); + wsClient.registerMessage(DpsUpdate.class); //super.startUp(); } @Override protected void shutDown() { + wsClient.unregisterMessage(DpsUpdate.class); overlayManager.remove(dpsOverlay); boss = null; //super.shutDown(); From 4a81250c992ac79019bd971c2265fd9e3aa7dcb0 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 11 May 2019 15:08:40 -0400 Subject: [PATCH 016/117] More float --- .../runelite/client/plugins/dpscounter/DpsCounterPlugin.java | 4 ++-- .../net/runelite/client/plugins/dpscounter/DpsMember.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index 893d31ebcd..0af71d34eb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -122,7 +122,7 @@ public class DpsCounterPlugin extends Plugin dpsMember.addDamage(hit); // System.out.println("HIT "+ hit); - if (!partyService.getMembers().isEmpty()) + if (hit > 0 && !partyService.getMembers().isEmpty()) { // Check the player is attacking the boss if (npc != null && player.getInteracting() == npc) @@ -147,7 +147,7 @@ public class DpsCounterPlugin extends Plugin return; } - DpsMember dpsMember = members.computeIfAbsent(name, n -> new DpsMember(name)); + DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new); dpsMember.addDamage(dpsUpdate.getHit()); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java index 6b5693a37f..1a68d06e51 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java @@ -21,6 +21,6 @@ class DpsMember { int diff = (int) (Instant.now().toEpochMilli() - start.toEpochMilli()) / 1000; if (diff == 0) return 0; - return damage / diff; + return (int) ((float) damage / (float) diff); } } From eb0aa94ddbc760a165b9cc5f9dd18e13888d22aa Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 11 May 2019 15:39:17 -0400 Subject: [PATCH 017/117] hmm --- .../plugins/dpscounter/DpsCounterPlugin.java | 63 ++++++++++++++----- .../client/plugins/dpscounter/DpsMember.java | 19 ++++-- .../client/plugins/dpscounter/DpsOverlay.java | 49 +++++++-------- 3 files changed, 84 insertions(+), 47 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index 0af71d34eb..71705f064e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -1,19 +1,24 @@ package net.runelite.client.plugins.dpscounter; -import com.google.inject.Binder; import com.google.inject.Inject; +import com.google.inject.Provides; import java.util.Map; import java.util.concurrent.ConcurrentHashMap; import lombok.AccessLevel; import lombok.Getter; +import lombok.extern.slf4j.Slf4j; import net.runelite.api.Actor; import net.runelite.api.Client; +import net.runelite.api.MenuAction; import net.runelite.api.NPC; import net.runelite.api.Player; import net.runelite.api.Skill; import net.runelite.api.events.ExperienceChanged; import net.runelite.api.events.InteractingChanged; +import net.runelite.api.events.NpcDespawned; +import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.events.OverlayMenuClicked; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.OverlayManager; @@ -24,8 +29,8 @@ import net.runelite.client.ws.WSClient; @PluginDescriptor( name = "DPS Counter", description = "counts dps?" -// ) +@Slf4j public class DpsCounterPlugin extends Plugin { private int lastXp = -1; @@ -50,10 +55,10 @@ public class DpsCounterPlugin extends Plugin @Getter(AccessLevel.PACKAGE) private final Map members = new ConcurrentHashMap<>(); - @Override - public void configure(Binder binder) + @Provides + DpsConfig provideConfig(ConfigManager configManager) { - //super.configure(binder); + return configManager.getConfig(DpsConfig.class); } @Override @@ -61,7 +66,6 @@ public class DpsCounterPlugin extends Plugin { overlayManager.add(dpsOverlay); wsClient.registerMessage(DpsUpdate.class); - //super.startUp(); } @Override @@ -70,25 +74,28 @@ public class DpsCounterPlugin extends Plugin wsClient.unregisterMessage(DpsUpdate.class); overlayManager.remove(dpsOverlay); boss = null; - //super.shutDown(); } @Subscribe - public void onInteractingChanged(InteractingChanged interactingChanged) { + public void onInteractingChanged(InteractingChanged interactingChanged) + { Actor source = interactingChanged.getSource(); Actor target = interactingChanged.getTarget(); - if (source != client.getLocalPlayer()) { + if (source != client.getLocalPlayer()) + { return; } - if (target instanceof NPC) { + if (target instanceof NPC) + { int npcId = ((NPC) target).getId(); Boss boss = Boss.findBoss(npcId); - if (boss != null) { + if (boss != null) + { this.boss = boss; npc = (NPC) target; - // boss = Boss.ABYSSAL_SIRE; + // boss = Boss.ABYSSAL_SIRE; } } } @@ -110,7 +117,6 @@ public class DpsCounterPlugin extends Plugin final int delta = xp - lastXp; final int hit = getHit(boss.getModifier(), delta); -// final int hit = getHit(1.0f, delta); lastXp = xp; // Update local member @@ -120,7 +126,6 @@ public class DpsCounterPlugin extends Plugin final String name = localMember == null ? player.getName() : localMember.getName(); DpsMember dpsMember = members.computeIfAbsent(name, n -> new DpsMember(name)); dpsMember.addDamage(hit); -// System.out.println("HIT "+ hit); if (hit > 0 && !partyService.getMembers().isEmpty()) { @@ -135,7 +140,8 @@ public class DpsCounterPlugin extends Plugin } @Subscribe - public void onDpsUpdate(DpsUpdate dpsUpdate) { + public void onDpsUpdate(DpsUpdate dpsUpdate) + { if (partyService.getLocalMember().getMemberId().equals(dpsUpdate.getMemberId())) { return; @@ -147,9 +153,36 @@ public class DpsCounterPlugin extends Plugin return; } + // Hmm - not attacking the same boss I am + if (npc == null || dpsUpdate.getNpcId() != npc.getId()) + { + return; + } + DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new); dpsMember.addDamage(dpsUpdate.getHit()); + } + @Subscribe + public void onOverlayMenuClicked(OverlayMenuClicked event) + { + if (event.getEntry().getMenuAction() == MenuAction.RUNELITE_OVERLAY && + event.getEntry().getTarget().equals("Reset") && + event.getEntry().getOption().equals("DPS counter")) + { + members.clear(); + } + } + + @Subscribe + public void onNpcDespawned(NpcDespawned npcDespawned) + { + if (npc == null || npcDespawned.getNpc() != npc || !npc.isDead()) + { + return; + } + + log.debug("Boss has died!"); } private int getHit(float modifier, int deltaExperience) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java index 1a68d06e51..b83425834b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java @@ -10,6 +10,7 @@ class DpsMember { private final String name; private Instant start = Instant.now(); + private Instant end; private int damage; void addDamage(int amount) @@ -17,10 +18,20 @@ class DpsMember damage += amount; } - int getDps() + float getDps() { - int diff = (int) (Instant.now().toEpochMilli() - start.toEpochMilli()) / 1000; - if (diff == 0) return 0; - return (int) ((float) damage / (float) diff); + Instant now = end == null ? Instant.now() : end; + int diff = (int) (now.toEpochMilli() - start.toEpochMilli()) / 1000; + if (diff == 0) + { + return 0; + } + + return (float) damage / (float) diff; + } + + void pause() + { + end = Instant.now(); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java index 42254ab92e..52fe67dd6e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java @@ -2,9 +2,12 @@ package net.runelite.client.plugins.dpscounter; import java.awt.Dimension; import java.awt.Graphics2D; +import java.text.DecimalFormat; import java.util.Map; import javax.inject.Inject; +import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; import net.runelite.client.ui.overlay.Overlay; +import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.components.LineComponent; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.TitleComponent; @@ -12,62 +15,52 @@ import net.runelite.client.ws.PartyService; public class DpsOverlay extends Overlay { + private static final DecimalFormat DPS_FORMAT = new DecimalFormat("#0.0"); + private final DpsCounterPlugin dpsCounterPlugin; + private final DpsConfig dpsConfig; private final PartyService partyService; private final PanelComponent panelComponent = new PanelComponent(); @Inject - DpsOverlay(DpsCounterPlugin dpsCounterPlugin, PartyService partyService) + DpsOverlay(DpsCounterPlugin dpsCounterPlugin, DpsConfig dpsConfig, PartyService partyService) { super(dpsCounterPlugin); this.dpsCounterPlugin = dpsCounterPlugin; + this.dpsConfig = dpsConfig; this.partyService = partyService; - //setPosition(OverlayPosition.TOP_LEFT); + getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, "Reset", "DPS counter")); } @Override public Dimension render(Graphics2D graphics) { Map dpsMembers = dpsCounterPlugin.getMembers(); + if (dpsMembers.isEmpty()) + { + return null; + } + + boolean inParty = !partyService.getMembers().isEmpty(); + boolean showDamage = dpsConfig.showDamage(); panelComponent.getChildren().clear(); + panelComponent.getChildren().add( TitleComponent.builder() - .text("DPS") - //olor(HIGHLIGHT_COLOR) + .text(inParty ? "Party DPS" : "DPS") .build()); -// panelComponent.getChildren().add( -// LineComponent.builder() -// .left("Player") -// // .leftColor(HIGHLIGHT_COLOR) -// .right("DPS") -// // .rightColor(HIGHLIGHT_COLOR) -// .build()); - - for (DpsMember dpsMember : dpsMembers.values()) { + for (DpsMember dpsMember : dpsMembers.values()) + { panelComponent.getChildren().add( LineComponent.builder() .left(dpsMember.getName()) - .right(Integer.toString(dpsMember.getDps())) - //.right(Integer.toString(playerSkillLevel) + "/" + Integer.toString(opponentSkillLevel)) - //.rightColor(comparisonStatColor(playerSkillLevel, opponentSkillLevel)) + .right(showDamage ? Integer.toString(dpsMember.getDamage()) : DPS_FORMAT.format(dpsMember.getDps())) .build()); } - //partyService.getMemberByName() -// for (PartyMember member : partyService.getMembers()) { -// DpsMember dpsMember = dpsMembers.get(member.getName()); -// if (dpsMember == null) continue; -// panelComponent.getChildren().add( -// LineComponent.builder() -// .left(member.getName()) -// .right(Integer.toString(dpsMember.getDps())) -// //.right(Integer.toString(playerSkillLevel) + "/" + Integer.toString(opponentSkillLevel)) -// //.rightColor(comparisonStatColor(playerSkillLevel, opponentSkillLevel)) -// .build()); -// } return panelComponent.render(graphics); } } From d590c64697375d7b600396930db2a3c0f456c4a7 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 11 May 2019 15:43:27 -0400 Subject: [PATCH 018/117] auto pause --- .../plugins/dpscounter/DpsCounterPlugin.java | 66 ++++++++++++++----- 1 file changed, 50 insertions(+), 16 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index 71705f064e..a61d77bae2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -16,6 +16,7 @@ import net.runelite.api.Skill; import net.runelite.api.events.ExperienceChanged; import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.NpcDespawned; +import net.runelite.api.events.NpcSpawned; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.events.OverlayMenuClicked; @@ -25,6 +26,7 @@ import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.ws.PartyMember; import net.runelite.client.ws.PartyService; import net.runelite.client.ws.WSClient; +import org.apache.commons.lang3.ArrayUtils; @PluginDescriptor( name = "DPS Counter", @@ -33,8 +35,6 @@ import net.runelite.client.ws.WSClient; @Slf4j public class DpsCounterPlugin extends Plugin { - private int lastXp = -1; - @Inject private Client client; @@ -51,7 +51,8 @@ public class DpsCounterPlugin extends Plugin private DpsOverlay dpsOverlay; private Boss boss; - private NPC npc; + private NPC bossNpc; + private int lastHpExp = -1; @Getter(AccessLevel.PACKAGE) private final Map members = new ConcurrentHashMap<>(); @@ -89,13 +90,13 @@ public class DpsCounterPlugin extends Plugin if (target instanceof NPC) { - int npcId = ((NPC) target).getId(); + NPC npc = (NPC) target; + int npcId = npc.getId(); Boss boss = Boss.findBoss(npcId); if (boss != null) { this.boss = boss; - npc = (NPC) target; - // boss = Boss.ABYSSAL_SIRE; + bossNpc = (NPC) target; } } } @@ -109,15 +110,15 @@ public class DpsCounterPlugin extends Plugin } final int xp = client.getSkillExperience(Skill.HITPOINTS); - if (boss == null || lastXp < 0 || xp < lastXp) + if (boss == null || lastHpExp < 0 || xp < lastHpExp) { - lastXp = xp; + lastHpExp = xp; return; } - final int delta = xp - lastXp; + final int delta = xp - lastHpExp; final int hit = getHit(boss.getModifier(), delta); - lastXp = xp; + lastHpExp = xp; // Update local member PartyMember localMember = partyService.getLocalMember(); @@ -130,9 +131,9 @@ public class DpsCounterPlugin extends Plugin if (hit > 0 && !partyService.getMembers().isEmpty()) { // Check the player is attacking the boss - if (npc != null && player.getInteracting() == npc) + if (bossNpc != null && player.getInteracting() == bossNpc) { - final DpsUpdate specialCounterUpdate = new DpsUpdate(npc.getId(), hit); + final DpsUpdate specialCounterUpdate = new DpsUpdate(bossNpc.getId(), hit); specialCounterUpdate.setMemberId(partyService.getLocalMember().getMemberId()); wsClient.send(specialCounterUpdate); } @@ -154,7 +155,7 @@ public class DpsCounterPlugin extends Plugin } // Hmm - not attacking the same boss I am - if (npc == null || dpsUpdate.getNpcId() != npc.getId()) + if (bossNpc == null || dpsUpdate.getNpcId() != bossNpc.getId()) { return; } @@ -175,14 +176,47 @@ public class DpsCounterPlugin extends Plugin } @Subscribe - public void onNpcDespawned(NpcDespawned npcDespawned) + public void onNpcSpawned(NpcSpawned npcSpawned) { - if (npc == null || npcDespawned.getNpc() != npc || !npc.isDead()) + if (boss == null) { return; } - log.debug("Boss has died!"); + NPC npc = npcSpawned.getNpc(); + int npcId = npc.getId(); + if (!ArrayUtils.contains(boss.getIds(), npcId)) + { + return; + } + + log.debug("Boss has spawned!"); + bossNpc = npc; + } + + @Subscribe + public void onNpcDespawned(NpcDespawned npcDespawned) + { + if (bossNpc == null || npcDespawned.getNpc() != bossNpc) + { + return; + } + + if (bossNpc.isDead()) + { + log.debug("Boss has died!"); + pause(); + } + + bossNpc = null; + } + + private void pause() + { + for (DpsMember dpsMember : members.values()) + { + dpsMember.pause(); + } } private int getHit(float modifier, int deltaExperience) From 75f835f3221e9f365374fde404c01310198e1536 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 11 May 2019 15:43:47 -0400 Subject: [PATCH 019/117] add config --- .../client/plugins/dpscounter/DpsConfig.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java new file mode 100644 index 0000000000..5fc88bf342 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java @@ -0,0 +1,19 @@ +package net.runelite.client.plugins.dpscounter; + +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("dpscounter") +public interface DpsConfig +{ + @ConfigItem( + position = 0, + name = "Show Damage", + keyName = "showDamage", + description = "Show total damage instead of DPS" + ) + default boolean showDamage() + { + return false; + } +} From bb3463bbce7f57548d4869e7a634ecf7a9c45c20 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 11 May 2019 15:58:11 -0400 Subject: [PATCH 020/117] unpause --- .../client/plugins/dpscounter/DpsConfig.java | 3 ++- .../plugins/dpscounter/DpsCounterPlugin.java | 12 ++++++++++++ .../client/plugins/dpscounter/DpsMember.java | 17 +++++++++++++++++ .../client/plugins/dpscounter/DpsOverlay.java | 4 ++-- 4 files changed, 33 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java index 5fc88bf342..6845168f09 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java @@ -1,10 +1,11 @@ package net.runelite.client.plugins.dpscounter; +import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; @ConfigGroup("dpscounter") -public interface DpsConfig +public interface DpsConfig extends Config { @ConfigItem( position = 0, diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index a61d77bae2..64315aba19 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -128,6 +128,12 @@ public class DpsCounterPlugin extends Plugin DpsMember dpsMember = members.computeIfAbsent(name, n -> new DpsMember(name)); dpsMember.addDamage(hit); + if (dpsMember.isPaused()) + { + dpsMember.unpause(); + log.debug("Unpausing {}", dpsMember.getName()); + } + if (hit > 0 && !partyService.getMembers().isEmpty()) { // Check the player is attacking the boss @@ -162,6 +168,12 @@ public class DpsCounterPlugin extends Plugin DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new); dpsMember.addDamage(dpsUpdate.getHit()); + + if (dpsMember.isPaused()) + { + dpsMember.unpause(); + log.debug("Unpausing {}", dpsMember.getName()); + } } @Subscribe diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java index b83425834b..5c1ca5a85c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java @@ -1,5 +1,6 @@ package net.runelite.client.plugins.dpscounter; +import java.time.Duration; import java.time.Instant; import lombok.Getter; import lombok.RequiredArgsConstructor; @@ -34,4 +35,20 @@ class DpsMember { end = Instant.now(); } + + boolean isPaused() + { + return end != null; + } + + void unpause() + { + if (end == null) + { + return; + } + + start = start.plus(Duration.between(end, Instant.now()); + end = null; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java index 52fe67dd6e..2d1f664fe7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java @@ -5,7 +5,7 @@ import java.awt.Graphics2D; import java.text.DecimalFormat; import java.util.Map; import javax.inject.Inject; -import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; +import static net.runelite.api.MenuAction.RUNELITE_OVERLAY; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.components.LineComponent; @@ -30,7 +30,7 @@ public class DpsOverlay extends Overlay this.dpsCounterPlugin = dpsCounterPlugin; this.dpsConfig = dpsConfig; this.partyService = partyService; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, "Reset", "DPS counter")); + getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, "Reset", "DPS counter")); } @Override From f21eea455a2ddab7e031105dabca1e77ff9301b6 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 11 May 2019 16:16:49 -0400 Subject: [PATCH 021/117] ignore if xp doesnt change --- .../runelite/client/plugins/dpscounter/DpsCounterPlugin.java | 2 +- .../java/net/runelite/client/plugins/dpscounter/DpsMember.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index 64315aba19..3623dd5589 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -110,7 +110,7 @@ public class DpsCounterPlugin extends Plugin } final int xp = client.getSkillExperience(Skill.HITPOINTS); - if (boss == null || lastHpExp < 0 || xp < lastHpExp) + if (boss == null || lastHpExp < 0 || xp <= lastHpExp) { lastHpExp = xp; return; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java index 5c1ca5a85c..fd109479a0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java @@ -48,7 +48,7 @@ class DpsMember return; } - start = start.plus(Duration.between(end, Instant.now()); + start = start.plus(Duration.between(end, Instant.now())); end = null; } } From 1ba39cdf9a8b339253f11695b6482cdd96437dc7 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 11 May 2019 16:27:58 -0400 Subject: [PATCH 022/117] fix reset --- .../runelite/client/plugins/dpscounter/DpsCounterPlugin.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index 3623dd5589..147824b929 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -74,6 +74,7 @@ public class DpsCounterPlugin extends Plugin { wsClient.unregisterMessage(DpsUpdate.class); overlayManager.remove(dpsOverlay); + members.clear(); boss = null; } @@ -180,8 +181,8 @@ public class DpsCounterPlugin extends Plugin public void onOverlayMenuClicked(OverlayMenuClicked event) { if (event.getEntry().getMenuAction() == MenuAction.RUNELITE_OVERLAY && - event.getEntry().getTarget().equals("Reset") && - event.getEntry().getOption().equals("DPS counter")) + event.getEntry().getOption().equals("Reset") && + event.getEntry().getTarget().equals("DPS counter")) { members.clear(); } From 88b1c47a552c63dc6c7a9cff90aa18827109a0b1 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 11 May 2019 16:28:56 -0400 Subject: [PATCH 023/117] Reset when party changes --- .../client/plugins/dpscounter/DpsCounterPlugin.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index 147824b929..8352b4e63d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -20,6 +20,7 @@ import net.runelite.api.events.NpcSpawned; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.events.OverlayMenuClicked; +import net.runelite.client.events.PartyChanged; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.ui.overlay.OverlayManager; @@ -78,6 +79,12 @@ public class DpsCounterPlugin extends Plugin boss = null; } + @Subscribe + public void onPartyChanged(PartyChanged partyChanged) + { + members.clear(); + } + @Subscribe public void onInteractingChanged(InteractingChanged interactingChanged) { From de9b8ac6897a8827e1ee114fb31fd1ba04aa431e Mon Sep 17 00:00:00 2001 From: 15987632 Date: Mon, 13 May 2019 19:55:56 -0400 Subject: [PATCH 024/117] me start --- .../main/java/net/runelite/api/Varbits.java | 9 +++ .../client/plugins/dpscounter/Boss.java | 65 +++++++++++++++++-- .../plugins/dpscounter/DpsCounterPlugin.java | 40 +++++++++++- 3 files changed, 109 insertions(+), 5 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Varbits.java b/runelite-api/src/main/java/net/runelite/api/Varbits.java index f1768c2aaf..0a3fa6038f 100644 --- a/runelite-api/src/main/java/net/runelite/api/Varbits.java +++ b/runelite-api/src/main/java/net/runelite/api/Varbits.java @@ -293,6 +293,15 @@ public enum Varbits */ THEATRE_OF_BLOOD(6440), + /** + * Theatre of Blood orb varbits each number stands for the player's health on a scale of 1-27 (I think), 0 hides the orb + */ + THEATRE_OF_BLOOD_ORB_1(6442), + THEATRE_OF_BLOOD_ORB_2(6443), + THEATRE_OF_BLOOD_ORB_3(6444), + THEATRE_OF_BLOOD_ORB_4(6445), + THEATRE_OF_BLOOD_ORB_5(6446), + /** * Nightmare Zone */ diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java index bfd4587e25..b8ff7325cf 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java @@ -25,12 +25,13 @@ package net.runelite.client.plugins.dpscounter; import com.google.common.collect.ImmutableMap; +import com.google.common.collect.ImmutableSet; import java.util.Map; +import java.util.Set; import lombok.Getter; import lombok.ToString; import net.runelite.api.NpcID; -@Getter @ToString enum Boss { @@ -45,15 +46,66 @@ enum Boss KING_BLACK_DRAGON(1.075f, NpcID.KING_BLACK_DRAGON, NpcID.KING_BLACK_DRAGON_2642, NpcID.KING_BLACK_DRAGON_6502), KRIL_TSUROTH(1.375f, NpcID.KRIL_TSUTSAROTH, NpcID.KRIL_TSUTSAROTH_6495), VENETENATIS(1.4f, NpcID.VENENATIS, NpcID.VENENATIS_6610), - VETION(1.225f, NpcID.VETION, NpcID.VETION_REBORN); + VETION(1.225f, NpcID.VETION, NpcID.VETION_REBORN), + MAIDEN(1f, NpcID.THE_MAIDEN_OF_SUGADINTI, NpcID.THE_MAIDEN_OF_SUGADINTI_8361, NpcID.THE_MAIDEN_OF_SUGADINTI_8362, NpcID.THE_MAIDEN_OF_SUGADINTI_8363, NpcID.THE_MAIDEN_OF_SUGADINTI_8364, NpcID.THE_MAIDEN_OF_SUGADINTI_8365), + BLOAT(new float[]{1.7f, 1.775f, 1.85f}, NpcID.PESTILENT_BLOAT), + NYLOCAS_BOSS(new float[]{1.175f, 1.2f, 1.225f}, NpcID.NYLOCAS_VASILIAS, NpcID.NYLOCAS_VASILIAS_8355, NpcID.NYLOCAS_VASILIAS_8356, NpcID.NYLOCAS_VASILIAS_8357), + SOTETSEG(new float[]{1.525f, 1.6f, 1.675f}, NpcID.SOTETSEG, NpcID.SOTETSEG_8388), + XARPUS(1f, NpcID.XARPUS_8340, NpcID.XARPUS_8341), + VERZIK_P1(1.05f, NpcID.VERZIK_VITUR_8370), + VERZIK_P2(new float[]{1.35f, 1.4f, 1.425f}, NpcID.VERZIK_VITUR_8372), + VERZIK_P3(new float[]{1.675f, 1.75f, 1.85f}, NpcID.VERZIK_VITUR_8374); + private static final Set TOB_BOSSES = ImmutableSet.of(MAIDEN, BLOAT, NYLOCAS_BOSS, SOTETSEG, XARPUS, VERZIK_P1, VERZIK_P2, VERZIK_P3); + + @Getter private final int[] ids; - private final float modifier; // Some NPCs have a modifier to the experience a player receives. + private final int[] minions; + private final float[] modifier; // Some NPCs have a modifier to the experience a player receives. Boss(float modifier, int... ids) { - this.modifier = modifier; + this.modifier = new float[]{modifier}; this.ids = ids; + this.minions = null; + } + + Boss(float[] modifiers, int... ids) + { + this(modifiers, null, ids); + } + + Boss(float[] modifiers, int[] minions, int ... ids) + { + this.ids = ids; + this.modifier = modifiers; + this.minions = minions; + } + + float getModifier() + { + return modifier[0]; + } + + float getModifier(int partySize) + { + if (modifier.length == 1) + { + return modifier[0]; + } + + if (partySize == 5) + { + return modifier[2]; + } + else if (partySize == 4) + { + return modifier[1]; + } + else + { + return modifier[0]; + } } private static final Map BOSS_MAP; @@ -63,6 +115,11 @@ enum Boss return BOSS_MAP.get(id); } + static boolean isTOB(Boss boss) + { + return TOB_BOSSES.contains(boss); + } + static { ImmutableMap.Builder builder = ImmutableMap.builder(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java index 8352b4e63d..79693838f4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java @@ -1,8 +1,10 @@ package net.runelite.client.plugins.dpscounter; +import com.google.common.collect.ImmutableSet; import com.google.inject.Inject; import com.google.inject.Provides; import java.util.Map; +import java.util.Set; import java.util.concurrent.ConcurrentHashMap; import lombok.AccessLevel; import lombok.Getter; @@ -13,6 +15,7 @@ import net.runelite.api.MenuAction; import net.runelite.api.NPC; import net.runelite.api.Player; import net.runelite.api.Skill; +import net.runelite.api.Varbits; import net.runelite.api.events.ExperienceChanged; import net.runelite.api.events.InteractingChanged; import net.runelite.api.events.NpcDespawned; @@ -51,6 +54,10 @@ public class DpsCounterPlugin extends Plugin @Inject private DpsOverlay dpsOverlay; + static private final Set TOB_PARTY_ORBS_VARBITS = ImmutableSet.of(Varbits.THEATRE_OF_BLOOD_ORB_1, + Varbits.THEATRE_OF_BLOOD_ORB_2, Varbits.THEATRE_OF_BLOOD_ORB_3, Varbits.THEATRE_OF_BLOOD_ORB_4, + Varbits.THEATRE_OF_BLOOD_ORB_5); + private Boss boss; private NPC bossNpc; private int lastHpExp = -1; @@ -125,7 +132,20 @@ public class DpsCounterPlugin extends Plugin } final int delta = xp - lastHpExp; - final int hit = getHit(boss.getModifier(), delta); + + float modifier; + if (Boss.isTOB(boss)) + { + int partySize = getTobPartySize(); + System.out.println(partySize); + modifier = boss.getModifier(partySize); + } + else + { + modifier = boss.getModifier(); + } + + final int hit = getHit(modifier, delta); lastHpExp = xp; // Update local member @@ -245,4 +265,22 @@ public class DpsCounterPlugin extends Plugin float damageOutput = (deltaExperience * modifierBase) / 1.3333f; return Math.round(damageOutput); } + + private int getTobPartySize() + { + int partySize = 0; + for (Varbits varbit : TOB_PARTY_ORBS_VARBITS) + { + if (client.getVar(varbit) != 0) + { + partySize++; + System.out.println(varbit.getId() + ": " + client.getVar(varbit)); + } + else + { + break; + } + } + return partySize; + } } From 4271d2da54d3be903473d488616f128f270327f8 Mon Sep 17 00:00:00 2001 From: William Maga Date: Sun, 9 Jun 2019 12:05:16 -0600 Subject: [PATCH 025/117] inventory grid: add config for drag delay Co-authored-by: Adam --- .../plugins/inventorygrid/InventoryGridConfig.java | 12 ++++++++++++ .../plugins/inventorygrid/InventoryGridOverlay.java | 4 ++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridConfig.java index eda6b7cbb8..33c6868c4d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridConfig.java @@ -27,6 +27,7 @@ package net.runelite.client.plugins.inventorygrid; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.Range; @ConfigGroup("inventorygrid") public interface InventoryGridConfig extends Config @@ -60,4 +61,15 @@ public interface InventoryGridConfig extends Config { return true; } + + @ConfigItem( + keyName = "dragDelay", + name = "Drag Delay", + description = "Time in ms to wait after item press before showing grid" + ) + @Range(min = 100) + default int dragDelay() + { + return 100; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridOverlay.java index f628f007c6..e7395f299d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventorygrid/InventoryGridOverlay.java @@ -34,6 +34,7 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.image.BufferedImage; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.widgets.Widget; import net.runelite.api.widgets.WidgetInfo; import net.runelite.api.widgets.WidgetItem; @@ -45,7 +46,6 @@ import net.runelite.client.ui.overlay.OverlayPosition; class InventoryGridOverlay extends Overlay { private static final int INVENTORY_SIZE = 28; - private static final int DRAG_DELAY = 5; private static final Color HIGHLIGHT = new Color(0, 255, 0, 45); private static final Color GRID = new Color(255, 255, 255, 45); @@ -72,7 +72,7 @@ class InventoryGridOverlay extends Overlay final Widget inventoryWidget = client.getWidget(WidgetInfo.INVENTORY); if (if1DraggingWidget == null || if1DraggingWidget != inventoryWidget - || client.getItemPressedDuration() < DRAG_DELAY) + || client.getItemPressedDuration() < config.dragDelay() / Constants.CLIENT_TICK_LENGTH) { return null; } From dfef693211dc3942a5bc3a974c31ac26321f3663 Mon Sep 17 00:00:00 2001 From: Connor Clark Date: Mon, 10 Jun 2019 23:10:39 -0700 Subject: [PATCH 026/117] world map plugin: show quest completion state Co-authored-by: Rens-br --- .../src/main/java/net/runelite/api/Quest.java | 1 + .../plugins/worldmap/QuestStartLocation.java | 276 +++++++++--------- .../plugins/worldmap/QuestStartPoint.java | 8 +- .../plugins/worldmap/WorldMapConfig.java | 4 +- .../plugins/worldmap/WorldMapPlugin.java | 115 +++++++- .../plugins/worldmap/quest_completed_icon.png | Bin 0 -> 478 bytes .../worldmap/quest_not_started_icon.png | Bin 0 -> 489 bytes .../plugins/worldmap/quest_started_icon.png | Bin 0 -> 430 bytes 8 files changed, 256 insertions(+), 148 deletions(-) create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_completed_icon.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_not_started_icon.png create mode 100644 runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_started_icon.png diff --git a/runelite-api/src/main/java/net/runelite/api/Quest.java b/runelite-api/src/main/java/net/runelite/api/Quest.java index a1489a0ba8..420611d235 100644 --- a/runelite-api/src/main/java/net/runelite/api/Quest.java +++ b/runelite-api/src/main/java/net/runelite/api/Quest.java @@ -51,6 +51,7 @@ public enum Quest SHIELD_OF_ARRAV(316, "Shield of Arrav"), VAMPIRE_SLAYER(317, "Vampire Slayer"), WITCHS_POTION(318, "Witch's Potion"), + X_MARKS_THE_SPOT(550, "X Marks the Spot"), //Members' Quests ANIMAL_MAGNETISM(331, "Animal Magnetism"), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java index b49a56a2a0..ccccc47e2d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java @@ -27,151 +27,159 @@ package net.runelite.client.plugins.worldmap; import lombok.Getter; import net.runelite.api.coords.WorldPoint; +import net.runelite.api.Quest; +// Some quests are in the same spot, but they are done in order. If multiple +// quests start in the same location, an array of quests is expected. enum QuestStartLocation { //Free Quests - COOKS_ASSISTANT_RFD("Cook's Assistant", new WorldPoint(3211, 3216, 0)), - THE_CORSAIR_CURSE("The Corsair Curse", new WorldPoint(3029, 3273, 0)), - DEMON_SLAYER("Demon Slayer", new WorldPoint(3204, 3424, 0)), - DORICS_QUEST("Doric's Quest", new WorldPoint(2952, 3450, 0)), - DRAGON_SLAYER("Dragon Slayer", new WorldPoint(3190, 3362, 0)), - ERNEST_THE_CHICKEN("Ernest the Chicken", new WorldPoint(3109, 3330, 0)), - GOBLIN_DIPLOMACY("Goblin Diplomacy", new WorldPoint(2957, 3509, 0)), - IMP_CATCHER("Imp Catcher", new WorldPoint(3108, 3160, 0)), - THE_KNIGHTS_SWORD("The Knight's Sword", new WorldPoint(2976, 3342, 0)), - MISTHALIN_MYSTERY("Misthalin Mystery", new WorldPoint(3234, 3155, 0)), - PIRATES_TREASURE("Pirate's Treasure", new WorldPoint(3051, 3252, 0)), - PRINCE_ALI_RESCUE("Prince Ali Rescue", new WorldPoint(3301, 3163, 0)), - THE_RESTLESS_GHOST("The Restless Ghost", new WorldPoint(3240, 3210, 0)), - RUNE_MYSTERIES("Rune Mysteries", new WorldPoint(3210, 3220, 0)), - SHEEP_SHEARER("Sheep Shearer", new WorldPoint(3190, 3272, 0)), - SHIELD_OF_ARRAV_PHOENIX_GANG("Shield of Arrav (Phoenix Gang)", new WorldPoint(3208, 3495, 0)), - SHIELD_OF_ARRAV_BLACK_ARM_GANG("Shield of Arrav (Black Arm Gang)", new WorldPoint(3208, 3392, 0)), - VAMPIRE_SLAYER("Vampire Slayer", new WorldPoint(3096, 3266, 0)), - WITCHS_POTION("Witch's Potion", new WorldPoint(2967, 3203, 0)), - X_MARKS_THE_SPOT("X Marks the Spot", new WorldPoint(3227, 3242, 0)), + COOKS_ASSISTANT_RFD(Quest.COOKS_ASSISTANT, new WorldPoint(3211, 3216, 0)), + THE_CORSAIR_CURSE(Quest.THE_CORSAIR_CURSE, new WorldPoint(3029, 3273, 0)), + DEMON_SLAYER(Quest.DEMON_SLAYER, new WorldPoint(3204, 3424, 0)), + DORICS_QUEST(Quest.DORICS_QUEST, new WorldPoint(2952, 3450, 0)), + DRAGON_SLAYER(Quest.DRAGON_SLAYER, new WorldPoint(3190, 3362, 0)), + ERNEST_THE_CHICKEN(Quest.ERNEST_THE_CHICKEN, new WorldPoint(3109, 3330, 0)), + GOBLIN_DIPLOMACY(Quest.GOBLIN_DIPLOMACY, new WorldPoint(2957, 3509, 0)), + IMP_CATCHER(Quest.IMP_CATCHER, new WorldPoint(3108, 3160, 0)), + THE_KNIGHTS_SWORD(Quest.THE_KNIGHTS_SWORD, new WorldPoint(2976, 3342, 0)), + MISTHALIN_MYSTERY(Quest.MISTHALIN_MYSTERY, new WorldPoint(3234, 3155, 0)), + PIRATES_TREASURE(Quest.PIRATES_TREASURE, new WorldPoint(3051, 3252, 0)), + PRINCE_ALI_RESCUE(Quest.PRINCE_ALI_RESCUE, new WorldPoint(3301, 3163, 0)), + THE_RESTLESS_GHOST(Quest.THE_RESTLESS_GHOST, new WorldPoint(3240, 3210, 0)), + RUNE_MYSTERIES(Quest.RUNE_MYSTERIES, new WorldPoint(3210, 3220, 0)), + SHEEP_SHEARER(Quest.SHEEP_SHEARER, new WorldPoint(3190, 3272, 0)), + SHIELD_OF_ARRAV(Quest.SHIELD_OF_ARRAV, new WorldPoint(3208, 3495, 0)), + VAMPIRE_SLAYER(Quest.VAMPIRE_SLAYER, new WorldPoint(3096, 3266, 0)), + WITCHS_POTION(Quest.WITCHS_POTION, new WorldPoint(2967, 3203, 0)), + X_MARKS_THE_SPOT(Quest.X_MARKS_THE_SPOT, new WorldPoint(3227, 3242, 0)), //Members' Quests - ANIMAL_MAGNETISM("Animal Magnetism", new WorldPoint(3094, 3360, 0)), - ANOTHER_SLICE_OF_HAM("Another Slice of H.A.M.", new WorldPoint(2799, 5428, 0)), - THE_ASCENT_OF_ARCEUUS("The Ascent of Arceuus", new WorldPoint(1700, 3742, 0)), - BETWEEN_A_ROCK("Between a Rock...", new WorldPoint(2823, 10168, 0)), - BIG_CHOMPY_BIRD_HUNTING("Big Chompy Bird Hunting", new WorldPoint(2629, 2981, 0)), - BIOHAZARD("Biohazard", new WorldPoint(2591, 3335, 0)), - BONE_VOYAGE("Bone Voyage", new WorldPoint(3259, 3450, 0)), - CABIN_FEVER("Cabin Fever", new WorldPoint(3674, 3496, 0)), - CLIENT_OF_KOUREND("Client of Kourend", new WorldPoint(1823, 3690, 0)), - CLOCK_TOWER("Clock Tower", new WorldPoint(2568, 3249, 0)), - COLD_WAR("Cold War", new WorldPoint(2593, 3265, 0)), - CONTACT("Contact!", new WorldPoint(3280, 2770, 0)), - CREATURE_OF_FENKENSTRAIN("Creature of Fenkenstrain", new WorldPoint(3487, 3485, 0)), - DARKNESS_OF_HALLOWVALE("Darkness of Hallowvale", new WorldPoint(3494, 9628, 0)), - DEATH_PLATEAU_TROLL_STRONGHOLD("Death Plateau & Troll Stronghold", new WorldPoint(2895, 3528, 0)), - DEATH_TO_THE_DORGESHUUN("Death to the Dorgeshuun", new WorldPoint(3316, 9613, 0)), - THE_DEPTHS_OF_DESPAIR("The Depths of Despair", new WorldPoint(1846, 3556, 0)), - DESERT_TREASURE("Desert Treasure", new WorldPoint(3177, 3043, 0)), - DEVIOUS_MINDS("Devious Minds", new WorldPoint(3405, 3492, 0)), - THE_DIG_SITE("The Dig Site", new WorldPoint(3363, 3337, 0)), - DRAGON_SLAYER_II("Dragon Slayer II", new WorldPoint(2456, 2868, 0)), - DREAM_MENTOR("Dream Mentor", new WorldPoint(2144, 10346, 0)), - DRUIDIC_RITUAL("Druidic Ritual", new WorldPoint(2916, 3484, 0)), - DWARF_CANNON("Dwarf Cannon", new WorldPoint(2566, 3461, 0)), - EADGARS_RUSE("Eadgar's Ruse", new WorldPoint(2896, 3426, 0)), - EAGLES_PEAK("Eagles' Peak", new WorldPoint(2605, 3264, 0)), - ELEMENTAL_WORKSHOP("Elemental Workshop I & II", new WorldPoint(2714, 3482, 0)), - ENAKHRAS_LAMENT("Enakhra's Lament", new WorldPoint(3190, 2926, 0)), - ENLIGHTENED_JOURNEY("Enlightened Journey", new WorldPoint(2809, 3356, 0)), - THE_EYES_OF_GLOUPHRIE("The Eyes of Glouphrie", new WorldPoint(2400, 3419, 0)), - FAIRYTALE("Fairytale I & II", new WorldPoint(3077, 3258, 0)), - FAMILY_CREST("Family Crest", new WorldPoint(3278, 3404, 0)), - THE_FEUD("The Feud", new WorldPoint(3301, 3211, 0)), - FIGHT_ARENA("Fight Arena", new WorldPoint(2565, 3199, 0)), - FISHING_CONTEST_1("Fishing Contest", new WorldPoint(2875, 3483, 0)), - FISHING_CONTEST_2("Fishing Contest", new WorldPoint(2820, 3487, 0)), - FORGETTABLE_TALE("Forgettable Tale...", new WorldPoint(2826, 10215, 0)), - THE_FORSAKEN_TOWER("The Forsaken Tower", new WorldPoint(1484, 3747, 0)), - THE_FREMENNIK_ISLES("The Fremennik Isles", new WorldPoint(2645, 3711, 0)), - THE_FREMENNIK_TRIALS("The Fremennik Trials", new WorldPoint(2657, 3669, 0)), - GARDEN_OF_TRANQUILLITY("Garden of Tranquillity", new WorldPoint(3227, 3477, 0)), - GERTRUDES_CAT_RATCATCHERS("Gertrude's Cat & Ratcatchers", new WorldPoint(3150, 3411, 0)), - GHOSTS_AHOY("Ghosts Ahoy", new WorldPoint(3677, 3510, 0)), - THE_GIANT_DWARF("The Giant Dwarf", new WorldPoint(2841, 10129, 0)), - THE_GOLEM("The Golem", new WorldPoint(3487, 3089, 0)), - THE_GRAND_TREE_MONKEY_MADNESS("The Grand Tree & Monkey Madness I & II", new WorldPoint(2466, 3497, 0)), - THE_GREAT_BRAIN_ROBBERY("The Great Brain Robbery", new WorldPoint(3681, 2963, 0)), - GRIM_TALES("Grim Tales", new WorldPoint(2890, 3454, 0)), - THE_HAND_IN_THE_SAND("The Hand in the Sand", new WorldPoint(2552, 3101, 0)), - HAUNTED_MINE("Haunted Mine", new WorldPoint(3443, 3258, 0)), - HAZEEL_CULT("Hazeel Cult", new WorldPoint(2565, 3271, 0)), - HEROES_QUEST("Heroes' Quest", new WorldPoint(2903, 3511, 0)), - HOLY_GRAIL("Holy Grail & Merlin's Crystal", new WorldPoint(2763, 3515, 0)), - HORROR_FROM_THE_DEEP("Horror from the Deep", new WorldPoint(2507, 3635, 0)), - ICTHLARINS_LITTLE_HELPER("Icthlarin's Little Helper", new WorldPoint(3314, 2849, 0)), - IN_SEARCH_OF_THE_MYREQUE("In Search of the Myreque", new WorldPoint(3502, 3477, 0)), - JUNGLE_POTION("Jungle Potion", new WorldPoint(2809, 3086, 0)), - KINGS_RANSOM("King's Ransom", new WorldPoint(2741, 3554, 0)), - LEGENDS_QUEST("Legends' Quest", new WorldPoint(2725, 3367, 0)), - LOST_CITY("Lost City", new WorldPoint(3149, 3205, 0)), - THE_LOST_TRIBE("The Lost Tribe", new WorldPoint(3211, 3224, 0)), - LUNAR_DIPLOMACY("Lunar Diplomacy", new WorldPoint(2619, 3689, 0)), - MAKING_FRIENDS_WITH_MY_ARM("Making Friends with My Arm", new WorldPoint(2904, 10092, 0)), - MAKING_HISTORY("Making History", new WorldPoint(2435, 3346, 0)), - MONKS_FRIEND("Monk's Friend", new WorldPoint(2605, 3209, 0)), - MOUNTAIN_DAUGHTER("Mountain Daughter", new WorldPoint(2810, 3672, 0)), - MOURNINGS_ENDS_PART_I("Mourning's Ends Part I", new WorldPoint(2289, 3149, 0)), - MOURNINGS_ENDS_PART_II("Mourning's Ends Part II", new WorldPoint(2352, 3172, 0)), - MURDER_MYSTERY("Murder Mystery", new WorldPoint(2740, 3562, 0)), - MY_ARMS_BIG_ADVENTURE("My Arm's Big Adventure", new WorldPoint(2908, 10088, 0)), - NATURE_SPIRIT("Nature Spirit", new WorldPoint(3440, 9894, 0)), - OBSERVATORY_QUEST("Observatory Quest", new WorldPoint(2438, 3185, 0)), - OLAFS_QUEST("Olaf's Quest", new WorldPoint(2723, 3729, 0)), - ONE_SMALL_FAVOUR("One Small Favour", new WorldPoint(2834, 2985, 0)), - PLAGUE_CITY("Plague City", new WorldPoint(2567, 3334, 0)), - PRIEST_IN_PERIL("Priest in Peril", new WorldPoint(3219, 3473, 0)), - THE_QUEEN_OF_THIEVES("The Queen of Thieves", new WorldPoint(1795, 3782, 0)), - RAG_AND_BONE_MAN("Rag and Bone Man I & II", new WorldPoint(3359, 3504, 0)), - RECRUITMENT_DRIVE_BLACK_KNIGHTS_FORTRESS("Recruitment Drive & Black Knights' Fortress", new WorldPoint(2959, 3336, 0)), - ROVING_ELVES("Roving Elves", new WorldPoint(2289, 3146, 0)), - RUM_DEAL("Rum Deal", new WorldPoint(3679, 3535, 0)), - SCORPION_CATCHER("Scorpion Catcher", new WorldPoint(2701, 3399, 0)), - SEA_SLUG("Sea Slug", new WorldPoint(2715, 3302, 0)), - SHADES_OF_MORTTON("Shades of Mort'ton", new WorldPoint(3463, 3308, 0)), - SHADOW_OF_THE_STORM("Shadow of the Storm", new WorldPoint(3270, 3159, 0)), - SHEEP_HERDER("Sheep Herder", new WorldPoint(2616, 3299, 0)), - SHILO_VILLAGE("Shilo Village", new WorldPoint(2882, 2951, 0)), - A_SOULS_BANE("A Soul's Bane", new WorldPoint(3307, 3454, 0)), - SPIRITS_OF_THE_ELID("Spirits of the Elid", new WorldPoint(3441, 2911, 0)), - SWAN_SONG("Swan Song", new WorldPoint(2345, 3652, 0)), - TAI_BWO_WANNAI_TRIO("Tai Bwo Wannai Trio", new WorldPoint(2779, 3087, 0)), - A_TAIL_OF_TWO_CATS("A Tail of Two Cats", new WorldPoint(2917, 3557, 0)), - TALE_OF_THE_RIGHTEOUS("Tale of the Righteous", new WorldPoint(1511, 3631, 0)), - A_TASTE_OF_HOPE("A Taste of Hope", new WorldPoint(3668, 3216, 0)), - TEARS_OF_GUTHIX("Tears of Guthix", new WorldPoint(3251, 9517, 0)), - TEMPLE_OF_IKOV("Temple of Ikov", new WorldPoint(2574, 3320, 0)), - THRONE_OF_MISCELLANIA_ROYAL_TROUBLE("Throne of Miscellania & Royal Trouble", new WorldPoint(2497, 3859, 0)), - THE_TOURIST_TRAP("The Tourist Trap", new WorldPoint(3302, 3113, 0)), - TOWER_OF_LIFE("Tower of Life", new WorldPoint(2640, 3218, 0)), - TREE_GNOME_VILLAGE("Tree Gnome Village", new WorldPoint(2541, 3169, 0)), - TRIBAL_TOTEM("Tribal Totem", new WorldPoint(2790, 3182, 0)), - TROLL_ROMANCE("Troll Romance", new WorldPoint(2890, 10097, 0)), - UNDERGROUND_PASS_REGICIDE("Underground Pass & Regicide", new WorldPoint(2575, 3293, 0)), - WANTED_SLUG_MENACE("Wanted! & The Slug Menace", new WorldPoint(2996, 3373, 0)), - WATCHTOWER("Watchtower", new WorldPoint(2545, 3112, 0)), - WATERFALL_QUEST("Waterfall Quest", new WorldPoint(2521, 3498, 0)), - WHAT_LIES_BELOW("What Lies Below", new WorldPoint(3265, 3333, 0)), - WITCHS_HOUSE("Witch's House", new WorldPoint(2927, 3456, 0)), - ZOGRE_FLESH_EATERS("Zogre Flesh Eaters", new WorldPoint(2442, 3051, 0)); - - @Getter - private final String tooltip; + ANIMAL_MAGNETISM(Quest.ANIMAL_MAGNETISM, new WorldPoint(3094, 3360, 0)), + ANOTHER_SLICE_OF_HAM(Quest.ANOTHER_SLICE_OF_HAM, new WorldPoint(2799, 5428, 0)), + THE_ASCENT_OF_ARCEUUS(Quest.THE_ASCENT_OF_ARCEUUS, new WorldPoint(1700, 3742, 0)), + BETWEEN_A_ROCK(Quest.BETWEEN_A_ROCK, new WorldPoint(2823, 10168, 0)), + BIG_CHOMPY_BIRD_HUNTING(Quest.BIG_CHOMPY_BIRD_HUNTING, new WorldPoint(2629, 2981, 0)), + BIOHAZARD(Quest.BIOHAZARD, new WorldPoint(2591, 3335, 0)), + BONE_VOYAGE(Quest.BONE_VOYAGE, new WorldPoint(3259, 3450, 0)), + CABIN_FEVER(Quest.CABIN_FEVER, new WorldPoint(3674, 3496, 0)), + CLIENT_OF_KOUREND(Quest.CLIENT_OF_KOUREND, new WorldPoint(1823, 3690, 0)), + CLOCK_TOWER(Quest.CLOCK_TOWER, new WorldPoint(2568, 3249, 0)), + COLD_WAR(Quest.COLD_WAR, new WorldPoint(2593, 3265, 0)), + CONTACT(Quest.CONTACT, new WorldPoint(3280, 2770, 0)), + CREATURE_OF_FENKENSTRAIN(Quest.CREATURE_OF_FENKENSTRAIN, new WorldPoint(3487, 3485, 0)), + DARKNESS_OF_HALLOWVALE(Quest.DARKNESS_OF_HALLOWVALE, new WorldPoint(3494, 9628, 0)), + DEATH_PLATEAU_TROLL_STRONGHOLD(new Quest[]{Quest.DEATH_PLATEAU, Quest.TROLL_STRONGHOLD}, new WorldPoint(2895, 3528, 0)), + DEATH_TO_THE_DORGESHUUN(Quest.DEATH_TO_THE_DORGESHUUN, new WorldPoint(3316, 9613, 0)), + THE_DEPTHS_OF_DESPAIR(Quest.THE_DEPTHS_OF_DESPAIR, new WorldPoint(1846, 3556, 0)), + DESERT_TREASURE(Quest.DESERT_TREASURE, new WorldPoint(3177, 3043, 0)), + DEVIOUS_MINDS(Quest.DEVIOUS_MINDS, new WorldPoint(3405, 3492, 0)), + THE_DIG_SITE(Quest.THE_DIG_SITE, new WorldPoint(3363, 3337, 0)), + DRAGON_SLAYER_II(Quest.DRAGON_SLAYER_II, new WorldPoint(2456, 2868, 0)), + DREAM_MENTOR(Quest.DREAM_MENTOR, new WorldPoint(2144, 10346, 0)), + DRUIDIC_RITUAL(Quest.DRUIDIC_RITUAL, new WorldPoint(2916, 3484, 0)), + DWARF_CANNON(Quest.DWARF_CANNON, new WorldPoint(2566, 3461, 0)), + EADGARS_RUSE(Quest.EADGARS_RUSE, new WorldPoint(2896, 3426, 0)), + EAGLES_PEAK(Quest.EAGLES_PEAK, new WorldPoint(2605, 3264, 0)), + ELEMENTAL_WORKSHOP(new Quest[]{Quest.ELEMENTAL_WORKSHOP_I, Quest.ELEMENTAL_WORKSHOP_II}, new WorldPoint(2714, 3482, 0)), + ENAKHRAS_LAMENT(Quest.ENAKHRAS_LAMENT, new WorldPoint(3190, 2926, 0)), + ENLIGHTENED_JOURNEY(Quest.ENLIGHTENED_JOURNEY, new WorldPoint(2809, 3356, 0)), + THE_EYES_OF_GLOUPHRIE(Quest.THE_EYES_OF_GLOUPHRIE, new WorldPoint(2400, 3419, 0)), + FAIRYTALE(new Quest[]{Quest.FAIRYTALE_I__GROWING_PAINS, Quest.FAIRYTALE_II__CURE_A_QUEEN}, new WorldPoint(3077, 3258, 0)), + FAMILY_CREST(Quest.FAMILY_CREST, new WorldPoint(3278, 3404, 0)), + THE_FEUD(Quest.THE_FEUD, new WorldPoint(3301, 3211, 0)), + FIGHT_ARENA(Quest.FIGHT_ARENA, new WorldPoint(2565, 3199, 0)), + FISHING_CONTEST_1(Quest.FISHING_CONTEST, new WorldPoint(2875, 3483, 0)), + FISHING_CONTEST_2(Quest.FISHING_CONTEST, new WorldPoint(2820, 3487, 0)), + FORGETTABLE_TALE(Quest.FORGETTABLE_TALE, new WorldPoint(2826, 10215, 0)), + THE_FORSAKEN_TOWER(Quest.THE_FORSAKEN_TOWER, new WorldPoint(1484, 3747, 0)), + THE_FREMENNIK_ISLES(Quest.THE_FREMENNIK_ISLES, new WorldPoint(2645, 3711, 0)), + THE_FREMENNIK_TRIALS(Quest.THE_FREMENNIK_TRIALS, new WorldPoint(2657, 3669, 0)), + GARDEN_OF_TRANQUILLITY(Quest.GARDEN_OF_TRANQUILLITY, new WorldPoint(3227, 3477, 0)), + GERTRUDES_CAT_RATCATCHERS(Quest.GERTRUDES_CAT, new WorldPoint(3150, 3411, 0)), + GHOSTS_AHOY(Quest.GHOSTS_AHOY, new WorldPoint(3677, 3510, 0)), + THE_GIANT_DWARF(Quest.THE_GIANT_DWARF, new WorldPoint(2841, 10129, 0)), + THE_GOLEM(Quest.THE_GOLEM, new WorldPoint(3487, 3089, 0)), + THE_GRAND_TREE_MONKEY_MADNESS(new Quest[]{Quest.THE_GRAND_TREE, Quest.MONKEY_MADNESS_I, Quest.MONKEY_MADNESS_II}, new WorldPoint(2466, 3497, 0)), + THE_GREAT_BRAIN_ROBBERY(Quest.THE_GREAT_BRAIN_ROBBERY, new WorldPoint(3681, 2963, 0)), + GRIM_TALES(Quest.GRIM_TALES, new WorldPoint(2890, 3454, 0)), + THE_HAND_IN_THE_SAND(Quest.THE_HAND_IN_THE_SAND, new WorldPoint(2552, 3101, 0)), + HAUNTED_MINE(Quest.HAUNTED_MINE, new WorldPoint(3443, 3258, 0)), + HAZEEL_CULT(Quest.HAZEEL_CULT, new WorldPoint(2565, 3271, 0)), + HEROES_QUEST(Quest.HEROES_QUEST, new WorldPoint(2903, 3511, 0)), + HOLY_GRAIL(new Quest[]{Quest.MERLINS_CRYSTAL, Quest.HOLY_GRAIL}, new WorldPoint(2763, 3515, 0)), + HORROR_FROM_THE_DEEP(Quest.HORROR_FROM_THE_DEEP, new WorldPoint(2507, 3635, 0)), + ICTHLARINS_LITTLE_HELPER(Quest.ICTHLARINS_LITTLE_HELPER, new WorldPoint(3314, 2849, 0)), + IN_SEARCH_OF_THE_MYREQUE(Quest.IN_SEARCH_OF_THE_MYREQUE, new WorldPoint(3502, 3477, 0)), + JUNGLE_POTION(Quest.JUNGLE_POTION, new WorldPoint(2809, 3086, 0)), + KINGS_RANSOM(Quest.KINGS_RANSOM, new WorldPoint(2741, 3554, 0)), + LEGENDS_QUEST(Quest.LEGENDS_QUEST, new WorldPoint(2725, 3367, 0)), + LOST_CITY(Quest.LOST_CITY, new WorldPoint(3149, 3205, 0)), + THE_LOST_TRIBE(Quest.THE_LOST_TRIBE, new WorldPoint(3211, 3224, 0)), + LUNAR_DIPLOMACY(Quest.LUNAR_DIPLOMACY, new WorldPoint(2619, 3689, 0)), + MAKING_FRIENDS_WITH_MY_ARM(Quest.MAKING_FRIENDS_WITH_MY_ARM, new WorldPoint(2904, 10092, 0)), + MAKING_HISTORY(Quest.MAKING_HISTORY, new WorldPoint(2435, 3346, 0)), + MONKS_FRIEND(Quest.MONKS_FRIEND, new WorldPoint(2605, 3209, 0)), + MOUNTAIN_DAUGHTER(Quest.MOUNTAIN_DAUGHTER, new WorldPoint(2810, 3672, 0)), + MOURNINGS_ENDS_PART_I(Quest.MOURNINGS_ENDS_PART_I, new WorldPoint(2289, 3149, 0)), + MOURNINGS_ENDS_PART_II(Quest.MONKEY_MADNESS_II, new WorldPoint(2352, 3172, 0)), + MURDER_MYSTERY(Quest.MURDER_MYSTERY, new WorldPoint(2740, 3562, 0)), + MY_ARMS_BIG_ADVENTURE(Quest.MY_ARMS_BIG_ADVENTURE, new WorldPoint(2908, 10088, 0)), + NATURE_SPIRIT(Quest.NATURE_SPIRIT, new WorldPoint(3440, 9894, 0)), + OBSERVATORY_QUEST(Quest.OBSERVATORY_QUEST, new WorldPoint(2438, 3185, 0)), + OLAFS_QUEST(Quest.OLAFS_QUEST, new WorldPoint(2723, 3729, 0)), + ONE_SMALL_FAVOUR(Quest.ONE_SMALL_FAVOUR, new WorldPoint(2834, 2985, 0)), + PLAGUE_CITY(Quest.PLAGUE_CITY, new WorldPoint(2567, 3334, 0)), + PRIEST_IN_PERIL(Quest.PRIEST_IN_PERIL, new WorldPoint(3219, 3473, 0)), + THE_QUEEN_OF_THIEVES(Quest.THE_QUEEN_OF_THIEVES, new WorldPoint(1795, 3782, 0)), + RAG_AND_BONE_MAN(new Quest[]{Quest.RAG_AND_BONE_MAN, Quest.RAG_AND_BONE_MAN_II}, new WorldPoint(3359, 3504, 0)), + RECRUITMENT_DRIVE_BLACK_KNIGHTS_FORTRESS(new Quest[]{Quest.BLACK_KNIGHTS_FORTRESS, Quest.RECRUITMENT_DRIVE}, new WorldPoint(2959, 3336, 0)), + ROVING_ELVES(Quest.ROVING_ELVES, new WorldPoint(2289, 3146, 0)), + RUM_DEAL(Quest.RUM_DEAL, new WorldPoint(3679, 3535, 0)), + SCORPION_CATCHER(Quest.SCORPION_CATCHER, new WorldPoint(2701, 3399, 0)), + SEA_SLUG(Quest.SEA_SLUG, new WorldPoint(2715, 3302, 0)), + SHADES_OF_MORTTON(Quest.SHADES_OF_MORTTON, new WorldPoint(3463, 3308, 0)), + SHADOW_OF_THE_STORM(Quest.SHADES_OF_MORTTON, new WorldPoint(3270, 3159, 0)), + SHEEP_HERDER(Quest.SHEEP_HERDER, new WorldPoint(2616, 3299, 0)), + SHILO_VILLAGE(Quest.SHILO_VILLAGE, new WorldPoint(2882, 2951, 0)), + A_SOULS_BANE(Quest.A_SOULS_BANE, new WorldPoint(3307, 3454, 0)), + SPIRITS_OF_THE_ELID(Quest.SPIRITS_OF_THE_ELID, new WorldPoint(3441, 2911, 0)), + SWAN_SONG(Quest.SWAN_SONG, new WorldPoint(2345, 3652, 0)), + TAI_BWO_WANNAI_TRIO(Quest.TAI_BWO_WANNAI_TRIO, new WorldPoint(2779, 3087, 0)), + A_TAIL_OF_TWO_CATS(Quest.A_TAIL_OF_TWO_CATS, new WorldPoint(2917, 3557, 0)), + TALE_OF_THE_RIGHTEOUS(Quest.TALE_OF_THE_RIGHTEOUS, new WorldPoint(1511, 3631, 0)), + A_TASTE_OF_HOPE(Quest.A_TASTE_OF_HOPE, new WorldPoint(3668, 3216, 0)), + TEARS_OF_GUTHIX(Quest.TEARS_OF_GUTHIX, new WorldPoint(3251, 9517, 0)), + TEMPLE_OF_IKOV(Quest.TEMPLE_OF_IKOV, new WorldPoint(2574, 3320, 0)), + THRONE_OF_MISCELLANIA_ROYAL_TROUBLE(new Quest[]{Quest.THRONE_OF_MISCELLANIA, Quest.ROYAL_TROUBLE}, new WorldPoint(2497, 3859, 0)), + THE_TOURIST_TRAP(Quest.THE_TOURIST_TRAP, new WorldPoint(3302, 3113, 0)), + TOWER_OF_LIFE(Quest.TOWER_OF_LIFE, new WorldPoint(2640, 3218, 0)), + TREE_GNOME_VILLAGE(Quest.TREE_GNOME_VILLAGE, new WorldPoint(2541, 3169, 0)), + TRIBAL_TOTEM(Quest.TRIBAL_TOTEM, new WorldPoint(2790, 3182, 0)), + TROLL_ROMANCE(Quest.TROLL_ROMANCE, new WorldPoint(2890, 10097, 0)), + UNDERGROUND_PASS_REGICIDE(new Quest[]{Quest.REGICIDE, Quest.UNDERGROUND_PASS}, new WorldPoint(2575, 3293, 0)), + WANTED_SLUG_MENACE(new Quest[]{Quest.WANTED, Quest.THE_SLUG_MENACE}, new WorldPoint(2996, 3373, 0)), + WATCHTOWER(Quest.WATCHTOWER, new WorldPoint(2545, 3112, 0)), + WATERFALL_QUEST(Quest.WATERFALL_QUEST, new WorldPoint(2521, 3498, 0)), + WHAT_LIES_BELOW(Quest.WHAT_LIES_BELOW, new WorldPoint(3265, 3333, 0)), + WITCHS_HOUSE(Quest.WITCHS_HOUSE, new WorldPoint(2927, 3456, 0)), + ZOGRE_FLESH_EATERS(Quest.ZOGRE_FLESH_EATERS, new WorldPoint(2442, 3051, 0)); @Getter private final WorldPoint location; - QuestStartLocation(String description, WorldPoint location) + @Getter + private final Quest[] quests; + + QuestStartLocation(Quest[] quests, WorldPoint location) { - this.tooltip = "Quest Start - " + description; this.location = location; + this.quests = quests; + } + + QuestStartLocation(Quest quest, WorldPoint location) + { + this.location = location; + this.quests = new Quest[]{quest}; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartPoint.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartPoint.java index 14f1842f62..681015b98e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartPoint.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartPoint.java @@ -25,15 +25,15 @@ */ package net.runelite.client.plugins.worldmap; +import net.runelite.api.coords.WorldPoint; import net.runelite.client.ui.overlay.worldmap.WorldMapPoint; import java.awt.image.BufferedImage; class QuestStartPoint extends WorldMapPoint { - QuestStartPoint(QuestStartLocation data, BufferedImage icon) + QuestStartPoint(WorldPoint location, BufferedImage icon, String tooltip) { - super(data.getLocation(), icon); - - setTooltip(data.getTooltip()); + super(location, icon); + setTooltip(tooltip); } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java index ca62df484d..7ebe417ef2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapConfig.java @@ -166,8 +166,8 @@ public interface WorldMapConfig extends Config @ConfigItem( keyName = WorldMapPlugin.CONFIG_KEY_QUEST_START_TOOLTIPS, - name = "Show quest names", - description = "Indicates the names of quests and highlights incomplete ones", + name = "Show quest names and status", + description = "Indicates the names of quests and shows completion status", position = 13 ) default boolean questStartTooltips() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java index 5fd38d5ff2..757584a9bb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/WorldMapPlugin.java @@ -31,9 +31,15 @@ import java.awt.image.BufferedImage; import java.util.Arrays; import net.runelite.api.Client; import net.runelite.api.Experience; +import net.runelite.api.GameState; import net.runelite.api.Skill; +import net.runelite.api.Quest; +import net.runelite.api.QuestState; import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.ExperienceChanged; +import net.runelite.api.events.WidgetLoaded; +import net.runelite.api.widgets.WidgetID; +import net.runelite.client.callback.ClientThread; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.game.AgilityShortcut; @@ -52,6 +58,9 @@ public class WorldMapPlugin extends Plugin static final BufferedImage BLANK_ICON; private static final BufferedImage FAIRY_TRAVEL_ICON; private static final BufferedImage NOPE_ICON; + private static final BufferedImage NOT_STARTED_ICON; + private static final BufferedImage STARTED_ICON; + private static final BufferedImage FINISHED_ICON; static final String CONFIG_KEY = "worldmap"; static final String CONFIG_KEY_FAIRY_RING_TOOLTIPS = "fairyRingTooltips"; @@ -77,6 +86,9 @@ public class WorldMapPlugin extends Plugin //A size of 17 gives us a buffer when triggering tooltips final int iconBufferSize = 17; + //Quest icons are a bit bigger. + final int questIconBufferSize = 22; + BLANK_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB); FAIRY_TRAVEL_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB); @@ -86,11 +98,26 @@ public class WorldMapPlugin extends Plugin NOPE_ICON = new BufferedImage(iconBufferSize, iconBufferSize, BufferedImage.TYPE_INT_ARGB); final BufferedImage nopeImage = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "nope_icon.png"); NOPE_ICON.getGraphics().drawImage(nopeImage, 1, 1, null); + + NOT_STARTED_ICON = new BufferedImage(questIconBufferSize, questIconBufferSize, BufferedImage.TYPE_INT_ARGB); + final BufferedImage notStartedIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "quest_not_started_icon.png"); + NOT_STARTED_ICON.getGraphics().drawImage(notStartedIcon, 4, 4, null); + + STARTED_ICON = new BufferedImage(questIconBufferSize, questIconBufferSize, BufferedImage.TYPE_INT_ARGB); + final BufferedImage startedIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "quest_started_icon.png"); + STARTED_ICON.getGraphics().drawImage(startedIcon, 4, 4, null); + + FINISHED_ICON = new BufferedImage(questIconBufferSize, questIconBufferSize, BufferedImage.TYPE_INT_ARGB); + final BufferedImage finishedIcon = ImageUtil.getResourceStreamFromClass(WorldMapPlugin.class, "quest_completed_icon.png"); + FINISHED_ICON.getGraphics().drawImage(finishedIcon, 4, 4, null); } @Inject private Client client; + @Inject + private ClientThread clientThread; + @Inject private WorldMapConfig config; @@ -164,6 +191,17 @@ public class WorldMapPlugin extends Plugin } } + @Subscribe + public void onWidgetLoaded(WidgetLoaded widgetLoaded) + { + if (widgetLoaded.getGroupId() == WidgetID.WORLD_MAP_GROUP_ID) + { + // Quest icons are per-account due to showing quest status, + // so we recreate them each time the map is loaded + updateQuestStartPointIcons(); + } + } + private void updateAgilityIcons() { worldMapPointManager.removeIf(AgilityShortcutPoint.class::isInstance); @@ -200,6 +238,7 @@ public class WorldMapPlugin extends Plugin { updateAgilityIcons(); updateRareTreeIcons(); + updateQuestStartPointIcons(); worldMapPointManager.removeIf(FairyRingPoint.class::isInstance); if (config.fairyRingIcon() || config.fairyRingTooltips()) @@ -219,14 +258,6 @@ public class WorldMapPlugin extends Plugin .forEach(worldMapPointManager::add); } - worldMapPointManager.removeIf(QuestStartPoint.class::isInstance); - if (config.questStartTooltips()) - { - Arrays.stream(QuestStartLocation.values()) - .map(value -> new QuestStartPoint(value, BLANK_ICON)) - .forEach(worldMapPointManager::add); - } - worldMapPointManager.removeIf(TransportationPoint.class::isInstance); if (config.transportationTeleportTooltips()) { @@ -271,4 +302,72 @@ public class WorldMapPlugin extends Plugin }).map(TeleportPoint::new) .forEach(worldMapPointManager::add); } + + private void updateQuestStartPointIcons() + { + worldMapPointManager.removeIf(QuestStartPoint.class::isInstance); + + if (!config.questStartTooltips()) + { + return; + } + + // Must setup the quest icons on the client thread, after the player has logged in. + clientThread.invokeLater(() -> + { + if (client.getGameState() != GameState.LOGGED_IN) + { + return false; + } + + Arrays.stream(QuestStartLocation.values()) + .map(this::createQuestStartPoint) + .forEach(worldMapPointManager::add); + return true; + }); + } + + private QuestStartPoint createQuestStartPoint(QuestStartLocation data) + { + Quest[] quests = data.getQuests(); + + // Get first uncompleted quest. Else, return the last quest. + Quest quest = null; + for (int i = 0; i < quests.length; i++) + { + if (quests[i].getState(client) != QuestState.FINISHED) + { + quest = quests[i]; + break; + } + } + if (quest == null) + { + quest = quests[quests.length - 1]; + } + + BufferedImage icon = BLANK_ICON; + String tooltip = ""; + if (quest != null) + { + tooltip = quest.getName(); + switch (quest.getState(client)) + { + case FINISHED: + icon = FINISHED_ICON; + tooltip += " - Finished"; + break; + case IN_PROGRESS: + icon = STARTED_ICON; + tooltip += " - Started"; + break; + case NOT_STARTED: + icon = NOT_STARTED_ICON; + tooltip += " - Not Started"; + break; + } + } + + return new QuestStartPoint(data.getLocation(), icon, tooltip); + } } diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_completed_icon.png b/runelite-client/src/main/resources/net/runelite/client/plugins/worldmap/quest_completed_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..71193ddba2d24b45a1ba2d2073e0c38efa395b07 GIT binary patch literal 478 zcmeAS@N?(olHy`uVBq!ia0vp^A|TAc1|)ksWqE-VTavfC3y=napU%7MffQ$fM`SSr zgPt-7Ggd6MF9Qm)mw5WRvOi|yVG}d+v%Q+Zz`&U8>Eak-aeD7%doN~3k>elVx0tB; zZT8d@N^}hB6q}^9Kw2l~%@I5H3*0v<7;=jmW0YG}Sb`%o!yF?#1P-b#i(LFP;zdr{ zH~&qGew?~_lRv-iv)hCSr=!=WC^&bjthoOAs9Dv#>6~I}Vy)}mn_1qd^l7*pxRK-X zS78(J*b3?V=o!cK^}HjMRK(xDEBoblRx@HY+g;ADZZkht9I<)4q`SLhg|%^DFXNBP zhnLDen{0Gh!y&V_b)h}?_4a>K%hk_soO!8yk~jChXCe~6jN|6pF|63-x+-tt;=8jy zypWn)+xfE-|c0d`45 zK~y-)m6f|r0znjpzacadtA)xCvn0E*hKj-lL*Wzn7FL!vHg;Om$s15p7-=kwg_eZu zCQM;$G*n=FEMWFJz;HIxoH_aSKet_l)s&QdqHr)}15GBAQedywa{{X@tO$DkIHTX0 zS-{(&Y8TAdA<#MkXuQdIZ0_@nF9azU>zznot*(0WcGpk1%V@coC;AWVF>kKY8|7_GO@ zZ7yZg&8}BV6gHZDWb@qLoB-hatsG1cBE&v6OWjUj(|E;b5E3B-$(*UofUjWyF%Y84 zV{`0(5_scWnjwnVV33@$EDS_d%-hn{TBl^v54 z)5pPjQs@;2^Qj99*GWX&5Xe7h{efYRbKGL)EH*2HgA$6aSq*(lgl*HTLqv z$vTny-}?Wbdp>Og+hX5d38to-4wdurbEX8bHQuy3!*bVN_VJ%DN14i;XYwz5q<>+W zW=)v7l+VHZ_g0FkE~iVr@A%<#DmnLZij8~y4cAcLjjJ}keZZVo5L52k}F*&6Y zH?x*4V7Op;$2m|>dank5L9y-Ur8)XFr;5nH7&Eb zCZo0Dfii=`B$=NLN5XtpAD*)L--hm!755I* z`K)s~E1mgvWRZQU!K&Zg9d*a6Sy%D1W=?$UuJ}e`Vs_%UU9+G4?$X#0CvxKV`j5;R Wku%qy*y`5w literal 0 HcmV?d00001 From 1b7340f341a22d80de4bac5618da3cf8d1fe8981 Mon Sep 17 00:00:00 2001 From: Twiglet1022 <29353990+Twiglet1022@users.noreply.github.com> Date: Sat, 15 Jun 2019 12:33:30 +0100 Subject: [PATCH 027/117] clues: correct text of falo the bard warrior guild token clue --- .../client/plugins/cluescrolls/clues/FaloTheBardClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java index 68ad2e0af8..2524ce45a4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java @@ -87,7 +87,7 @@ public class FaloTheBardClue extends ClueScroll implements TextClueScroll, NpcCl new FaloTheBardClue("A shiny helmet of flight, to obtain this with melee, struggle you might.", item(ARMADYL_HELMET)), // The wiki doesn't specify whether the trimmed dragon defender will work so I've assumed that it doesn't new FaloTheBardClue("A sword held in the other hand, red its colour, Cyclops strength you must withstand.", item(DRAGON_DEFENDER)), - new FaloTheBardClue("A token used to kill mythical beasts, in hope of a blade or just for an xp feast.", item(WARRIOR_GUILD_TOKEN)), + new FaloTheBardClue("A token used to kill mythical beasts, in hopes of a blade or just for an xp feast.", item(WARRIOR_GUILD_TOKEN)), new FaloTheBardClue("Green is my favorite, mature ale I do love, this takes your herblore above.", item(GREENMANS_ALEM)), new FaloTheBardClue("It can hold down a boat or crush a goat, this object, you see, is quite heavy.", item(BARRELCHEST_ANCHOR)), new FaloTheBardClue("It comes from the ground, underneath the snowy plain. Trolls aplenty, with what looks like a mane.", item(BASALT)), From 844089ae2e625462958179f850551903be62f9f3 Mon Sep 17 00:00:00 2001 From: James Munson Date: Sat, 15 Jun 2019 16:00:36 -0700 Subject: [PATCH 028/117] NPC hider based on name --- .../src/main/java/net/runelite/api/Client.java | 7 +++++++ .../plugins/entityhider/EntityHiderConfig.java | 14 +++++++++++++- .../plugins/entityhider/EntityHiderPlugin.java | 1 + .../runelite/mixins/EntityHiderBridgeMixin.java | 11 +++++++++++ .../java/net/runelite/mixins/EntityHiderMixin.java | 12 ++++++++++++ 5 files changed, 44 insertions(+), 1 deletion(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index b8bd992eae..726bc43886 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1426,6 +1426,13 @@ public interface Client extends GameShell */ void setNPCsHidden(boolean state); + /** + * Sets which NPCs are hidden + * + * @param names the names of the npcs seperated by ',' + */ + void setNPCsNames(String names); + /** * Sets whether 2D sprites (ie. overhead prayers) related to * the NPCs are hidden. diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderConfig.java index caca619791..154258d2d6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderConfig.java @@ -132,7 +132,18 @@ public interface EntityHiderConfig extends Config } @ConfigItem( - position = 10, + position = 10, + keyName = "hideNPCsNames", + name = "Hide NPCs Names", + description = "Configures which NPCs to hide" + ) + default String hideNPCsNames() + { + return ""; + } + + @ConfigItem( + position = 11, keyName = "hideProjectiles", name = "Hide Projectiles", description = "Configures whether or not projectiles are hidden" @@ -141,4 +152,5 @@ public interface EntityHiderConfig extends Config { return false; } + } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderPlugin.java index 4082e205ec..73069862cd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/entityhider/EntityHiderPlugin.java @@ -94,6 +94,7 @@ public class EntityHiderPlugin extends Plugin client.setNPCsHidden(config.hideNPCs()); client.setNPCsHidden2D(config.hideNPCs2D()); + client.setNPCsNames(config.hideNPCsNames()); client.setAttackersHidden(config.hideAttackers()); diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderBridgeMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderBridgeMixin.java index 959e9c41bc..f9e9a175f2 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderBridgeMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderBridgeMixin.java @@ -64,6 +64,10 @@ public abstract class EntityHiderBridgeMixin implements RSClient @Inject public static boolean hideProjectiles; + @Inject + public static String hideNPCsNames; + + @Inject @Override public void setIsHidingEntities(boolean state) @@ -127,6 +131,13 @@ public abstract class EntityHiderBridgeMixin implements RSClient hideNPCs2D = state; } + @Inject + @Override + public void setNPCsNames(String NPCs) + { + hideNPCsNames = NPCs; + } + @Inject @Override public void setAttackersHidden(boolean state) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java index 2e69f55007..46c09f91cd 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java @@ -67,6 +67,9 @@ public abstract class EntityHiderMixin implements RSScene @Shadow("hideNPCs") private static boolean hideNPCs; + @Shadow("hideNPCsNames") + private static String hideNPCsNames; + @Shadow("hideNPCs2D") private static boolean hideNPCs2D; @@ -151,6 +154,7 @@ public abstract class EntityHiderMixin implements RSScene else if (renderable instanceof RSNPC) { RSNPC npc = (RSNPC) renderable; + String[] names = hideNPCsNames.split(","); if (!hideAttackers) { @@ -160,6 +164,14 @@ public abstract class EntityHiderMixin implements RSScene } } + for(String name: names) + { + if(names.equals(npc.getName())) + { + return false; + } + } + return drawingUI ? !hideNPCs2D : !hideNPCs; } else if (renderable instanceof RSProjectile) From 71a4b5d58b13464bdc40aad0e967b2b4eca03dc4 Mon Sep 17 00:00:00 2001 From: James Munson Date: Sat, 15 Jun 2019 16:51:44 -0700 Subject: [PATCH 029/117] NPC hider based on name --- .../src/main/java/net/runelite/mixins/EntityHiderMixin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java index 46c09f91cd..851c1b5480 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java @@ -164,9 +164,9 @@ public abstract class EntityHiderMixin implements RSScene } } - for(String name: names) + for (String name: names) { - if(names.equals(npc.getName())) + if (names.equals(npc.getName())) { return false; } From 8988226d1cbe5de8c40adfb49ba6dd08214e4b9c Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 15 Jun 2019 19:28:10 -0600 Subject: [PATCH 030/117] chat notifier: fix matching < and > in chat messages --- .../ChatNotificationsPlugin.java | 7 +++- .../ChatNotificationsPluginTest.java | 38 +++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java index e2e2699f2a..16127de3b6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPlugin.java @@ -117,9 +117,12 @@ public class ChatNotificationsPlugin extends Plugin { List items = Text.fromCSV(config.highlightWordsString()); String joined = items.stream() + .map(Text::escapeJagex) // we compare these strings to the raw Jagex ones .map(Pattern::quote) .collect(Collectors.joining("|")); - highlightMatcher = Pattern.compile("\\b(" + joined + ")\\b", Pattern.CASE_INSENSITIVE); + // To match \b doesn't work due to <> not being in \w, + // so match \b or \s + highlightMatcher = Pattern.compile("(?:\\b|(?<=\\s))(" + joined + ")(?:\\b|(?=\\s))", Pattern.CASE_INSENSITIVE); } } @@ -127,7 +130,6 @@ public class ChatNotificationsPlugin extends Plugin public void onChatMessage(ChatMessage chatMessage) { MessageNode messageNode = chatMessage.getMessageNode(); - String nodeValue = Text.removeTags(messageNode.getValue()); boolean update = false; switch (chatMessage.getType()) @@ -177,6 +179,7 @@ public class ChatNotificationsPlugin extends Plugin if (highlightMatcher != null) { + String nodeValue = messageNode.getValue(); Matcher matcher = highlightMatcher.matcher(nodeValue); boolean found = false; StringBuffer stringBuffer = new StringBuffer(); diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java index 6c154eaa9b..ffa54ccbae 100644 --- a/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java +++ b/runelite-client/src/test/java/net/runelite/client/plugins/chatnotifications/ChatNotificationsPluginTest.java @@ -93,6 +93,44 @@ public class ChatNotificationsPluginTest verify(messageNode).setValue("Deathbeam, Deathbeam OSRS"); } + @Test + public void testLtGt() + { + when(config.highlightWordsString()).thenReturn(""); + + String message = "test test test"; + MessageNode messageNode = mock(MessageNode.class); + when(messageNode.getValue()).thenReturn(message); + + ChatMessage chatMessage = new ChatMessage(); + chatMessage.setType(ChatMessageType.PUBLICCHAT); + chatMessage.setMessageNode(messageNode); + + chatNotificationsPlugin.startUp(); // load highlight config + chatNotificationsPlugin.onChatMessage(chatMessage); + + verify(messageNode).setValue("test test test"); + } + + @Test + public void testFullStop() + { + when(config.highlightWordsString()).thenReturn("test"); + + String message = "foo test. bar"; + MessageNode messageNode = mock(MessageNode.class); + when(messageNode.getValue()).thenReturn(message); + + ChatMessage chatMessage = new ChatMessage(); + chatMessage.setType(ChatMessageType.PUBLICCHAT); + chatMessage.setMessageNode(messageNode); + + chatNotificationsPlugin.startUp(); // load highlight config + chatNotificationsPlugin.onChatMessage(chatMessage); + + verify(messageNode).setValue("foo test. bar"); + } + @Test public void highlightListTest() { From 879e7f6b5df0183b6ccd617c5bfbc5ae6ccce461 Mon Sep 17 00:00:00 2001 From: Adam Date: Sat, 15 Jun 2019 19:28:31 -0600 Subject: [PATCH 031/117] emoji plugin: fix stripping chat recolor tags This was using the event's message instead of the node's, after the node's message had been wrapped with col tags. Additionally, fix plugin to match emoji triggers that are in the same word as (col) tags. --- .../client/plugins/emojis/EmojiPlugin.java | 39 +++++- .../plugins/emojis/EmojiPluginTest.java | 116 ++++++++++++++++++ 2 files changed, 151 insertions(+), 4 deletions(-) create mode 100644 runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/emojis/EmojiPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/emojis/EmojiPlugin.java index 988e73a625..21eb1eab10 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/emojis/EmojiPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/emojis/EmojiPlugin.java @@ -26,6 +26,8 @@ package net.runelite.client.plugins.emojis; import java.awt.image.BufferedImage; import java.util.Arrays; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.annotation.Nullable; import javax.inject.Inject; import joptsimple.internal.Strings; @@ -52,6 +54,8 @@ import net.runelite.client.util.ImageUtil; @Slf4j public class EmojiPlugin extends Plugin { + private static final Pattern TAG_REGEXP = Pattern.compile("<[^>]*>"); + @Inject private Client client; @@ -128,7 +132,8 @@ public class EmojiPlugin extends Plugin return; } - final String message = chatMessage.getMessage(); + final MessageNode messageNode = chatMessage.getMessageNode(); + final String message = messageNode.getValue(); final String updatedMessage = updateMessage(message); if (updatedMessage == null) @@ -136,7 +141,6 @@ public class EmojiPlugin extends Plugin return; } - final MessageNode messageNode = chatMessage.getMessageNode(); messageNode.setRuneLiteFormatMessage(updatedMessage); chatMessageManager.update(messageNode); client.refreshChat(); @@ -169,7 +173,9 @@ public class EmojiPlugin extends Plugin boolean editedMessage = false; for (int i = 0; i < messageWords.length; i++) { - final Emoji emoji = Emoji.getEmoji(messageWords[i]); + // Remove tags except for and + final String trigger = removeTags(messageWords[i]); + final Emoji emoji = Emoji.getEmoji(trigger); if (emoji == null) { @@ -178,7 +184,7 @@ public class EmojiPlugin extends Plugin final int emojiId = modIconsStart + emoji.ordinal(); - messageWords[i] = ""; + messageWords[i] = messageWords[i].replace(trigger, ""); editedMessage = true; } @@ -190,4 +196,29 @@ public class EmojiPlugin extends Plugin return Strings.join(messageWords, " "); } + + /** + * Remove tags, except for <lt> and <gt> + * + * @return + */ + private static String removeTags(String str) + { + StringBuffer stringBuffer = new StringBuffer(); + Matcher matcher = TAG_REGEXP.matcher(str); + while (matcher.find()) + { + matcher.appendReplacement(stringBuffer, ""); + String match = matcher.group(0); + switch (match) + { + case "": + case "": + stringBuffer.append(match); + break; + } + } + matcher.appendTail(stringBuffer); + return stringBuffer.toString(); + } } diff --git a/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java b/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java new file mode 100644 index 0000000000..3427246946 --- /dev/null +++ b/runelite-client/src/test/java/net/runelite/client/plugins/emojis/EmojiPluginTest.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2019, Adam + * 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.emojis; + +import com.google.inject.Guice; +import com.google.inject.Inject; +import com.google.inject.testing.fieldbinder.Bind; +import com.google.inject.testing.fieldbinder.BoundFieldModule; +import net.runelite.api.ChatMessageType; +import net.runelite.api.Client; +import net.runelite.api.GameState; +import net.runelite.api.IndexedSprite; +import net.runelite.api.MessageNode; +import net.runelite.api.events.ChatMessage; +import net.runelite.api.events.GameStateChanged; +import net.runelite.client.chat.ChatMessageManager; +import org.junit.Before; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.mockito.Mock; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; +import org.mockito.runners.MockitoJUnitRunner; + +@RunWith(MockitoJUnitRunner.class) +public class EmojiPluginTest +{ + @Mock + @Bind + private Client client; + + @Mock + @Bind + private ChatMessageManager chatMessageManager; + + @Inject + private EmojiPlugin emojiPlugin; + + @Before + public void before() + { + Guice.createInjector(BoundFieldModule.of(this)).injectMembers(this); + } + + @Test + public void testOnChatMessage() + { + when(client.getGameState()).thenReturn(GameState.LOGGED_IN); + when(client.getModIcons()).thenReturn(new IndexedSprite[0]); + when(client.createIndexedSprite()).thenReturn(mock(IndexedSprite.class)); + + // Trip emoji loading + GameStateChanged gameStateChanged = new GameStateChanged(); + gameStateChanged.setGameState(GameState.LOGGED_IN); + emojiPlugin.onGameStateChanged(gameStateChanged); + + MessageNode messageNode = mock(MessageNode.class); + // With chat recolor, message may be wrapped in col tags + when(messageNode.getValue()).thenReturn(":) :) :)"); + + ChatMessage chatMessage = new ChatMessage(); + chatMessage.setType(ChatMessageType.PUBLICCHAT); + chatMessage.setMessageNode(messageNode); + + emojiPlugin.onChatMessage(chatMessage); + + verify(messageNode).setRuneLiteFormatMessage(" "); + } + + @Test + public void testGtLt() + { + when(client.getGameState()).thenReturn(GameState.LOGGED_IN); + when(client.getModIcons()).thenReturn(new IndexedSprite[0]); + when(client.createIndexedSprite()).thenReturn(mock(IndexedSprite.class)); + + // Trip emoji loading + GameStateChanged gameStateChanged = new GameStateChanged(); + gameStateChanged.setGameState(GameState.LOGGED_IN); + emojiPlugin.onGameStateChanged(gameStateChanged); + + MessageNode messageNode = mock(MessageNode.class); + when(messageNode.getValue()).thenReturn(":D"); + + ChatMessage chatMessage = new ChatMessage(); + chatMessage.setType(ChatMessageType.PUBLICCHAT); + chatMessage.setMessageNode(messageNode); + + emojiPlugin.onChatMessage(chatMessage); + + verify(messageNode).setRuneLiteFormatMessage(""); + } +} \ No newline at end of file From cc23d83bf0f48f74098dd40d905e85beb438df35 Mon Sep 17 00:00:00 2001 From: Twiglet1022 <29353990+Twiglet1022@users.noreply.github.com> Date: Fri, 7 Jun 2019 19:57:49 +0100 Subject: [PATCH 032/117] mining plugin: remove progress pie from mlm veins that respawn early --- .../client/plugins/mining/MiningPlugin.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java index cd2feb16cc..0c526222c3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningPlugin.java @@ -39,7 +39,12 @@ import static net.runelite.api.ObjectID.DEPLETED_VEIN_26666; import static net.runelite.api.ObjectID.DEPLETED_VEIN_26667; import static net.runelite.api.ObjectID.DEPLETED_VEIN_26668; import static net.runelite.api.ObjectID.EMPTY_WALL; +import static net.runelite.api.ObjectID.ORE_VEIN_26661; +import static net.runelite.api.ObjectID.ORE_VEIN_26662; +import static net.runelite.api.ObjectID.ORE_VEIN_26663; +import static net.runelite.api.ObjectID.ORE_VEIN_26664; import net.runelite.api.WallObject; +import net.runelite.api.coords.WorldPoint; import net.runelite.api.events.GameObjectDespawned; import net.runelite.api.events.GameStateChanged; import net.runelite.api.events.GameTick; @@ -158,6 +163,16 @@ public class MiningPlugin extends Plugin respawns.add(rockRespawn); break; } + case ORE_VEIN_26661: // Motherlode vein + case ORE_VEIN_26662: // Motherlode vein + case ORE_VEIN_26663: // Motherlode vein + case ORE_VEIN_26664: // Motherlode vein + { + // If the vein respawns before the timer is up, remove it + final WorldPoint point = object.getWorldLocation(); + respawns.removeIf(rockRespawn -> rockRespawn.getWorldPoint().equals(point)); + break; + } } } From 963776a1be0c89e2ab2d4e076fc1b87e895dea6a Mon Sep 17 00:00:00 2001 From: Twiglet1022 <29353990+Twiglet1022@users.noreply.github.com> Date: Wed, 5 Jun 2019 21:10:05 +0100 Subject: [PATCH 033/117] mining plugin: recolour pie in MLM during random segment of timer --- .../client/plugins/mining/MiningOverlay.java | 19 +++++++++++++++++-- .../runelite/client/plugins/mining/Rock.java | 2 +- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java index 3c9ab79234..62cc7c4d77 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/MiningOverlay.java @@ -43,6 +43,12 @@ import net.runelite.client.ui.overlay.components.ProgressPieComponent; class MiningOverlay extends Overlay { + // Range of Motherlode vein respawn time - not 100% confirmed but based on observation + static final int ORE_VEIN_MAX_RESPAWN_TIME = 123; + private static final int ORE_VEIN_MIN_RESPAWN_TIME = 90; + private static final float ORE_VEIN_RANDOM_PERCENT_THRESHOLD = (float) ORE_VEIN_MIN_RESPAWN_TIME / ORE_VEIN_MAX_RESPAWN_TIME; + private static final Color DARK_GREEN = new Color(0, 100, 0); + private final Client client; private final MiningPlugin plugin; @@ -67,6 +73,8 @@ class MiningOverlay extends Overlay Instant now = Instant.now(); for (Iterator it = respawns.iterator(); it.hasNext();) { + Color pieFillColor = Color.YELLOW; + Color pieBorderColor = Color.ORANGE; RockRespawn rockRespawn = it.next(); float percent = (now.toEpochMilli() - rockRespawn.getStartTime().toEpochMilli()) / (float) rockRespawn.getRespawnTime(); WorldPoint worldPoint = rockRespawn.getWorldPoint(); @@ -84,9 +92,16 @@ class MiningOverlay extends Overlay continue; } + // Recolour pie on motherlode veins during the portion of the timer where they may respawn + if (rockRespawn.getRock() == Rock.ORE_VEIN && percent > ORE_VEIN_RANDOM_PERCENT_THRESHOLD) + { + pieFillColor = Color.GREEN; + pieBorderColor = DARK_GREEN; + } + ProgressPieComponent ppc = new ProgressPieComponent(); - ppc.setBorderColor(Color.ORANGE); - ppc.setFill(Color.YELLOW); + ppc.setBorderColor(pieBorderColor); + ppc.setFill(pieFillColor); ppc.setPosition(point); ppc.setProgress(percent); ppc.render(graphics); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java index cfa52372be..5f8ba42a67 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java @@ -98,7 +98,7 @@ enum Rock return inMiningGuild ? Duration.ofMinutes(6) : super.respawnTime; } }, - ORE_VEIN(Duration.ofSeconds(108), 150), + ORE_VEIN(Duration.ofSeconds(MiningOverlay.ORE_VEIN_MAX_RESPAWN_TIME), 150), AMETHYST(Duration.ofSeconds(75), 120); private static final Map ROCKS; From 4967ab87f2accd93406c4cdfe45a7f2f0d5185ea Mon Sep 17 00:00:00 2001 From: James Munson Date: Sun, 16 Jun 2019 03:30:31 -0700 Subject: [PATCH 034/117] Removed --- .../client/plugins/dpscounter/Boss.java | 135 --------- .../client/plugins/dpscounter/DpsConfig.java | 20 -- .../plugins/dpscounter/DpsCounterPlugin.java | 286 ------------------ .../client/plugins/dpscounter/DpsMember.java | 54 ---- .../client/plugins/dpscounter/DpsOverlay.java | 66 ---- .../client/plugins/dpscounter/DpsUpdate.java | 13 - 6 files changed, 574 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsUpdate.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java deleted file mode 100644 index b8ff7325cf..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/Boss.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2018, Raqes - * 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.dpscounter; - -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import java.util.Map; -import java.util.Set; -import lombok.Getter; -import lombok.ToString; -import net.runelite.api.NpcID; - -@ToString -enum Boss -{ - ABYSSAL_SIRE(1.25f, NpcID.ABYSSAL_SIRE, NpcID.ABYSSAL_SIRE_5887, NpcID.ABYSSAL_SIRE_5888, NpcID.ABYSSAL_SIRE_5889, NpcID.ABYSSAL_SIRE_5890, NpcID.ABYSSAL_SIRE_5891, NpcID.ABYSSAL_SIRE_5908), - CALLISTO(1.225f, NpcID.CALLISTO, NpcID.CALLISTO_6609), - CERBERUS(1.15f, NpcID.CERBERUS, NpcID.CERBERUS_5863, NpcID.CERBERUS_5866), - CHAOS_ELEMENTAL(1.075f, NpcID.CHAOS_ELEMENTAL, NpcID.CHAOS_ELEMENTAL_6505), - CORPOREAL_BEAST(1.55f, NpcID.CORPOREAL_BEAST), - GENERAL_GRAARDOR(1.325f, NpcID.GENERAL_GRAARDOR, NpcID.GENERAL_GRAARDOR_6494), - GIANT_MOLE(1.075f, NpcID.GIANT_MOLE, NpcID.GIANT_MOLE_6499), - KALPHITE_QUEEN(1.05f, NpcID.KALPHITE_QUEEN, NpcID.KALPHITE_QUEEN_963, NpcID.KALPHITE_QUEEN_965, NpcID.KALPHITE_QUEEN_4303, NpcID.KALPHITE_QUEEN_4304, NpcID.KALPHITE_QUEEN_6500, NpcID.KALPHITE_QUEEN_6501), - KING_BLACK_DRAGON(1.075f, NpcID.KING_BLACK_DRAGON, NpcID.KING_BLACK_DRAGON_2642, NpcID.KING_BLACK_DRAGON_6502), - KRIL_TSUROTH(1.375f, NpcID.KRIL_TSUTSAROTH, NpcID.KRIL_TSUTSAROTH_6495), - VENETENATIS(1.4f, NpcID.VENENATIS, NpcID.VENENATIS_6610), - VETION(1.225f, NpcID.VETION, NpcID.VETION_REBORN), - MAIDEN(1f, NpcID.THE_MAIDEN_OF_SUGADINTI, NpcID.THE_MAIDEN_OF_SUGADINTI_8361, NpcID.THE_MAIDEN_OF_SUGADINTI_8362, NpcID.THE_MAIDEN_OF_SUGADINTI_8363, NpcID.THE_MAIDEN_OF_SUGADINTI_8364, NpcID.THE_MAIDEN_OF_SUGADINTI_8365), - BLOAT(new float[]{1.7f, 1.775f, 1.85f}, NpcID.PESTILENT_BLOAT), - NYLOCAS_BOSS(new float[]{1.175f, 1.2f, 1.225f}, NpcID.NYLOCAS_VASILIAS, NpcID.NYLOCAS_VASILIAS_8355, NpcID.NYLOCAS_VASILIAS_8356, NpcID.NYLOCAS_VASILIAS_8357), - SOTETSEG(new float[]{1.525f, 1.6f, 1.675f}, NpcID.SOTETSEG, NpcID.SOTETSEG_8388), - XARPUS(1f, NpcID.XARPUS_8340, NpcID.XARPUS_8341), - VERZIK_P1(1.05f, NpcID.VERZIK_VITUR_8370), - VERZIK_P2(new float[]{1.35f, 1.4f, 1.425f}, NpcID.VERZIK_VITUR_8372), - VERZIK_P3(new float[]{1.675f, 1.75f, 1.85f}, NpcID.VERZIK_VITUR_8374); - - private static final Set TOB_BOSSES = ImmutableSet.of(MAIDEN, BLOAT, NYLOCAS_BOSS, SOTETSEG, XARPUS, VERZIK_P1, VERZIK_P2, VERZIK_P3); - - @Getter - private final int[] ids; - private final int[] minions; - private final float[] modifier; // Some NPCs have a modifier to the experience a player receives. - - Boss(float modifier, int... ids) - { - this.modifier = new float[]{modifier}; - this.ids = ids; - this.minions = null; - } - - Boss(float[] modifiers, int... ids) - { - this(modifiers, null, ids); - } - - Boss(float[] modifiers, int[] minions, int ... ids) - { - this.ids = ids; - this.modifier = modifiers; - this.minions = minions; - } - - float getModifier() - { - return modifier[0]; - } - - float getModifier(int partySize) - { - if (modifier.length == 1) - { - return modifier[0]; - } - - if (partySize == 5) - { - return modifier[2]; - } - else if (partySize == 4) - { - return modifier[1]; - } - else - { - return modifier[0]; - } - } - - private static final Map BOSS_MAP; - - static Boss findBoss(int id) - { - return BOSS_MAP.get(id); - } - - static boolean isTOB(Boss boss) - { - return TOB_BOSSES.contains(boss); - } - - static - { - ImmutableMap.Builder builder = ImmutableMap.builder(); - for (Boss boss : values()) - { - for (int id : boss.ids) - { - builder.put(id, boss); - } - } - BOSS_MAP = builder.build(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java deleted file mode 100644 index 6845168f09..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsConfig.java +++ /dev/null @@ -1,20 +0,0 @@ -package net.runelite.client.plugins.dpscounter; - -import net.runelite.client.config.Config; -import net.runelite.client.config.ConfigGroup; -import net.runelite.client.config.ConfigItem; - -@ConfigGroup("dpscounter") -public interface DpsConfig extends Config -{ - @ConfigItem( - position = 0, - name = "Show Damage", - keyName = "showDamage", - description = "Show total damage instead of DPS" - ) - default boolean showDamage() - { - return false; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java deleted file mode 100644 index 79693838f4..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsCounterPlugin.java +++ /dev/null @@ -1,286 +0,0 @@ -package net.runelite.client.plugins.dpscounter; - -import com.google.common.collect.ImmutableSet; -import com.google.inject.Inject; -import com.google.inject.Provides; -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; -import lombok.AccessLevel; -import lombok.Getter; -import lombok.extern.slf4j.Slf4j; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.MenuAction; -import net.runelite.api.NPC; -import net.runelite.api.Player; -import net.runelite.api.Skill; -import net.runelite.api.Varbits; -import net.runelite.api.events.ExperienceChanged; -import net.runelite.api.events.InteractingChanged; -import net.runelite.api.events.NpcDespawned; -import net.runelite.api.events.NpcSpawned; -import net.runelite.client.config.ConfigManager; -import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.events.OverlayMenuClicked; -import net.runelite.client.events.PartyChanged; -import net.runelite.client.plugins.Plugin; -import net.runelite.client.plugins.PluginDescriptor; -import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ws.PartyMember; -import net.runelite.client.ws.PartyService; -import net.runelite.client.ws.WSClient; -import org.apache.commons.lang3.ArrayUtils; - -@PluginDescriptor( - name = "DPS Counter", - description = "counts dps?" -) -@Slf4j -public class DpsCounterPlugin extends Plugin -{ - @Inject - private Client client; - - @Inject - private OverlayManager overlayManager; - - @Inject - private PartyService partyService; - - @Inject - private WSClient wsClient; - - @Inject - private DpsOverlay dpsOverlay; - - static private final Set TOB_PARTY_ORBS_VARBITS = ImmutableSet.of(Varbits.THEATRE_OF_BLOOD_ORB_1, - Varbits.THEATRE_OF_BLOOD_ORB_2, Varbits.THEATRE_OF_BLOOD_ORB_3, Varbits.THEATRE_OF_BLOOD_ORB_4, - Varbits.THEATRE_OF_BLOOD_ORB_5); - - private Boss boss; - private NPC bossNpc; - private int lastHpExp = -1; - @Getter(AccessLevel.PACKAGE) - private final Map members = new ConcurrentHashMap<>(); - - @Provides - DpsConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(DpsConfig.class); - } - - @Override - protected void startUp() - { - overlayManager.add(dpsOverlay); - wsClient.registerMessage(DpsUpdate.class); - } - - @Override - protected void shutDown() - { - wsClient.unregisterMessage(DpsUpdate.class); - overlayManager.remove(dpsOverlay); - members.clear(); - boss = null; - } - - @Subscribe - public void onPartyChanged(PartyChanged partyChanged) - { - members.clear(); - } - - @Subscribe - public void onInteractingChanged(InteractingChanged interactingChanged) - { - Actor source = interactingChanged.getSource(); - Actor target = interactingChanged.getTarget(); - - if (source != client.getLocalPlayer()) - { - return; - } - - if (target instanceof NPC) - { - NPC npc = (NPC) target; - int npcId = npc.getId(); - Boss boss = Boss.findBoss(npcId); - if (boss != null) - { - this.boss = boss; - bossNpc = (NPC) target; - } - } - } - - @Subscribe - public void onExperienceChanged(ExperienceChanged experienceChanged) - { - if (experienceChanged.getSkill() != Skill.HITPOINTS) - { - return; - } - - final int xp = client.getSkillExperience(Skill.HITPOINTS); - if (boss == null || lastHpExp < 0 || xp <= lastHpExp) - { - lastHpExp = xp; - return; - } - - final int delta = xp - lastHpExp; - - float modifier; - if (Boss.isTOB(boss)) - { - int partySize = getTobPartySize(); - System.out.println(partySize); - modifier = boss.getModifier(partySize); - } - else - { - modifier = boss.getModifier(); - } - - final int hit = getHit(modifier, delta); - lastHpExp = xp; - - // Update local member - PartyMember localMember = partyService.getLocalMember(); - Player player = client.getLocalPlayer(); - // If not in a party, user local player name - final String name = localMember == null ? player.getName() : localMember.getName(); - DpsMember dpsMember = members.computeIfAbsent(name, n -> new DpsMember(name)); - dpsMember.addDamage(hit); - - if (dpsMember.isPaused()) - { - dpsMember.unpause(); - log.debug("Unpausing {}", dpsMember.getName()); - } - - if (hit > 0 && !partyService.getMembers().isEmpty()) - { - // Check the player is attacking the boss - if (bossNpc != null && player.getInteracting() == bossNpc) - { - final DpsUpdate specialCounterUpdate = new DpsUpdate(bossNpc.getId(), hit); - specialCounterUpdate.setMemberId(partyService.getLocalMember().getMemberId()); - wsClient.send(specialCounterUpdate); - } - } - } - - @Subscribe - public void onDpsUpdate(DpsUpdate dpsUpdate) - { - if (partyService.getLocalMember().getMemberId().equals(dpsUpdate.getMemberId())) - { - return; - } - - String name = partyService.getMemberById(dpsUpdate.getMemberId()).getName(); - if (name == null) - { - return; - } - - // Hmm - not attacking the same boss I am - if (bossNpc == null || dpsUpdate.getNpcId() != bossNpc.getId()) - { - return; - } - - DpsMember dpsMember = members.computeIfAbsent(name, DpsMember::new); - dpsMember.addDamage(dpsUpdate.getHit()); - - if (dpsMember.isPaused()) - { - dpsMember.unpause(); - log.debug("Unpausing {}", dpsMember.getName()); - } - } - - @Subscribe - public void onOverlayMenuClicked(OverlayMenuClicked event) - { - if (event.getEntry().getMenuAction() == MenuAction.RUNELITE_OVERLAY && - event.getEntry().getOption().equals("Reset") && - event.getEntry().getTarget().equals("DPS counter")) - { - members.clear(); - } - } - - @Subscribe - public void onNpcSpawned(NpcSpawned npcSpawned) - { - if (boss == null) - { - return; - } - - NPC npc = npcSpawned.getNpc(); - int npcId = npc.getId(); - if (!ArrayUtils.contains(boss.getIds(), npcId)) - { - return; - } - - log.debug("Boss has spawned!"); - bossNpc = npc; - } - - @Subscribe - public void onNpcDespawned(NpcDespawned npcDespawned) - { - if (bossNpc == null || npcDespawned.getNpc() != bossNpc) - { - return; - } - - if (bossNpc.isDead()) - { - log.debug("Boss has died!"); - pause(); - } - - bossNpc = null; - } - - private void pause() - { - for (DpsMember dpsMember : members.values()) - { - dpsMember.pause(); - } - } - - private int getHit(float modifier, int deltaExperience) - { - float modifierBase = 1f / modifier; - float damageOutput = (deltaExperience * modifierBase) / 1.3333f; - return Math.round(damageOutput); - } - - private int getTobPartySize() - { - int partySize = 0; - for (Varbits varbit : TOB_PARTY_ORBS_VARBITS) - { - if (client.getVar(varbit) != 0) - { - partySize++; - System.out.println(varbit.getId() + ": " + client.getVar(varbit)); - } - else - { - break; - } - } - return partySize; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java deleted file mode 100644 index fd109479a0..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsMember.java +++ /dev/null @@ -1,54 +0,0 @@ -package net.runelite.client.plugins.dpscounter; - -import java.time.Duration; -import java.time.Instant; -import lombok.Getter; -import lombok.RequiredArgsConstructor; - -@RequiredArgsConstructor -@Getter -class DpsMember -{ - private final String name; - private Instant start = Instant.now(); - private Instant end; - private int damage; - - void addDamage(int amount) - { - damage += amount; - } - - float getDps() - { - Instant now = end == null ? Instant.now() : end; - int diff = (int) (now.toEpochMilli() - start.toEpochMilli()) / 1000; - if (diff == 0) - { - return 0; - } - - return (float) damage / (float) diff; - } - - void pause() - { - end = Instant.now(); - } - - boolean isPaused() - { - return end != null; - } - - void unpause() - { - if (end == null) - { - return; - } - - start = start.plus(Duration.between(end, Instant.now())); - end = null; - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java deleted file mode 100644 index 2d1f664fe7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsOverlay.java +++ /dev/null @@ -1,66 +0,0 @@ -package net.runelite.client.plugins.dpscounter; - -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.text.DecimalFormat; -import java.util.Map; -import javax.inject.Inject; -import static net.runelite.api.MenuAction.RUNELITE_OVERLAY; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayMenuEntry; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; -import net.runelite.client.ws.PartyService; - -public class DpsOverlay extends Overlay -{ - private static final DecimalFormat DPS_FORMAT = new DecimalFormat("#0.0"); - - private final DpsCounterPlugin dpsCounterPlugin; - private final DpsConfig dpsConfig; - private final PartyService partyService; - - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - DpsOverlay(DpsCounterPlugin dpsCounterPlugin, DpsConfig dpsConfig, PartyService partyService) - { - super(dpsCounterPlugin); - this.dpsCounterPlugin = dpsCounterPlugin; - this.dpsConfig = dpsConfig; - this.partyService = partyService; - getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY, "Reset", "DPS counter")); - } - - @Override - public Dimension render(Graphics2D graphics) - { - Map dpsMembers = dpsCounterPlugin.getMembers(); - if (dpsMembers.isEmpty()) - { - return null; - } - - boolean inParty = !partyService.getMembers().isEmpty(); - boolean showDamage = dpsConfig.showDamage(); - - panelComponent.getChildren().clear(); - - panelComponent.getChildren().add( - TitleComponent.builder() - .text(inParty ? "Party DPS" : "DPS") - .build()); - - for (DpsMember dpsMember : dpsMembers.values()) - { - panelComponent.getChildren().add( - LineComponent.builder() - .left(dpsMember.getName()) - .right(showDamage ? Integer.toString(dpsMember.getDamage()) : DPS_FORMAT.format(dpsMember.getDps())) - .build()); - } - - return panelComponent.render(graphics); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsUpdate.java b/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsUpdate.java deleted file mode 100644 index 5aa02da373..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/dpscounter/DpsUpdate.java +++ /dev/null @@ -1,13 +0,0 @@ -package net.runelite.client.plugins.dpscounter; - -import lombok.EqualsAndHashCode; -import lombok.Value; -import net.runelite.http.api.ws.messages.party.PartyMemberMessage; - -@Value -@EqualsAndHashCode(callSuper = true) -public class DpsUpdate extends PartyMemberMessage -{ - private int npcId; - private int hit; -} From 1868d503aaee1c286ee6adba50311003fe66123e Mon Sep 17 00:00:00 2001 From: James Munson Date: Sun, 16 Jun 2019 03:56:50 -0700 Subject: [PATCH 035/117] Added performance stats aka dps counter --- .../client/plugins/performancestats/PerformanceStatsPlugin.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java index 4eac3aa1ed..fa3e7fd530 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/performancestats/PerformanceStatsPlugin.java @@ -55,6 +55,7 @@ import net.runelite.client.events.PartyChanged; import net.runelite.client.game.NPCManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.plugins.PluginType; import net.runelite.client.ui.overlay.OverlayManager; import net.runelite.client.util.Text; import net.runelite.client.ws.PartyMember; @@ -67,6 +68,7 @@ import net.runelite.http.api.ws.messages.party.UserSync; name = "Performance Stats", description = "Displays your current performance stats", tags = {"performance", "stats", "dps", "damage", "combat"}, + type = PluginType.UTILITY, enabledByDefault = false ) @Slf4j From 305e64d1399dd7f89f1f6a5c0957245878232fc4 Mon Sep 17 00:00:00 2001 From: Twiglet1022 <29353990+Twiglet1022@users.noreply.github.com> Date: Sun, 16 Jun 2019 14:23:33 +0100 Subject: [PATCH 036/117] clues: correct text of falo the bard obby maul clue --- .../client/plugins/cluescrolls/clues/FaloTheBardClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java index 2524ce45a4..7025f2c8f4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/FaloTheBardClue.java @@ -91,7 +91,7 @@ public class FaloTheBardClue extends ClueScroll implements TextClueScroll, NpcCl new FaloTheBardClue("Green is my favorite, mature ale I do love, this takes your herblore above.", item(GREENMANS_ALEM)), new FaloTheBardClue("It can hold down a boat or crush a goat, this object, you see, is quite heavy.", item(BARRELCHEST_ANCHOR)), new FaloTheBardClue("It comes from the ground, underneath the snowy plain. Trolls aplenty, with what looks like a mane.", item(BASALT)), - new FaloTheBardClue("No attack to wield, only strength is required, made of obsidian but with no room for a shield.", item(TZHAARKETOM)), + new FaloTheBardClue("No attack to wield, only strength is required, made of obsidian, but with no room for a shield.", item(TZHAARKETOM)), new FaloTheBardClue("Penance healers runners and more, obtaining this body often gives much deplore.", item(FIGHTER_TORSO)), new FaloTheBardClue("Strangely found in a chest, many believe these gloves are the best.", item(BARROWS_GLOVES)), new FaloTheBardClue("These gloves of white won't help you fight, but aid in cooking, they just might.", item(COOKING_GAUNTLETS)), From 5eeb9e2fed5b2e77b3c2e65fd606a519b94391e3 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sun, 16 Jun 2019 16:55:19 +0100 Subject: [PATCH 037/117] timers: fix teleblock message --- .../net/runelite/client/plugins/timers/TimersPlugin.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java index 5672ffdd31..f52a49c1ba 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timers/TimersPlugin.java @@ -88,13 +88,13 @@ public class TimersPlugin extends Plugin private static final String CANNON_REPAIR_MESSAGE = "You repair your cannon, restoring it to working order."; private static final String CHARGE_EXPIRED_MESSAGE = "Your magical charge fades away."; private static final String CHARGE_MESSAGE = "You feel charged with magic power."; - private static final String DEADMAN_HALF_TELEBLOCK_MESSAGE = "A teleblock spell has been cast on you. It will expire in 1 minute, 15 seconds."; + private static final String DEADMAN_HALF_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you. It will expire in 1 minute, 15 seconds."; private static final String EXTENDED_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended antifire potion."; private static final String EXTENDED_SUPER_ANTIFIRE_DRINK_MESSAGE = "You drink some of your extended super antifire potion."; private static final String FROZEN_MESSAGE = "You have been frozen!"; - private static final String FULL_TELEBLOCK_MESSAGE = "A teleblock spell has been cast on you. It will expire in 5 minutes, 0 seconds."; + private static final String FULL_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you. It will expire in 5 minutes, 0 seconds."; private static final String GOD_WARS_ALTAR_MESSAGE = "you recharge your prayer."; - private static final String HALF_TELEBLOCK_MESSAGE = "A teleblock spell has been cast on you. It will expire in 2 minutes, 30 seconds."; + private static final String HALF_TELEBLOCK_MESSAGE = "A Tele Block spell has been cast on you. It will expire in 2 minutes, 30 seconds."; private static final String IMBUED_HEART_READY_MESSAGE = "Your imbued heart has regained its magical power."; private static final String MAGIC_IMBUE_EXPIRED_MESSAGE = "Your Magic Imbue charge has ended."; private static final String MAGIC_IMBUE_MESSAGE = "You are charged to combine runes!"; From d777183ae85167b70f6081a914460e70838b8b20 Mon Sep 17 00:00:00 2001 From: Sander de Groot Date: Sun, 16 Jun 2019 18:02:43 -0400 Subject: [PATCH 038/117] Fix typo in spiritual mage master cryptic clue (#9105) --- .../runelite/client/plugins/cluescrolls/clues/CrypticClue.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java index 583d99fae8..ca75bf4ca8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cluescrolls/clues/CrypticClue.java @@ -259,7 +259,7 @@ public class CrypticClue extends ClueScroll implements TextClueScroll, NpcClueSc new CrypticClue("Search the drawers in Catherby's Archery shop.", DRAWERS_350, new WorldPoint(2825, 3442, 0), "Hickton's Archery Emporium in Catherby."), new CrypticClue("The hand ain't listening.", "The Face", new WorldPoint(3019, 3232, 0), "Talk to The Face located by the manhole just north of the Port Sarim fishing shop."), new CrypticClue("Search the chest in the left-hand tower of Camelot Castle.", CLOSED_CHEST_25592, new WorldPoint(2748, 3495, 2), "Located on the second floor of the western tower of Camelot."), - new CrypticClue("Kill the spiritual, magic and godly whilst representing their own god", null, "Kill a spiritual mage while wearing a corresponding god item."), + new CrypticClue("Kill the spiritual, magic and godly whilst representing their own god.", null, "Kill a spiritual mage while wearing a corresponding god item."), new CrypticClue("Anger those who adhere to Saradomin's edicts to prevent travel.", "Monk of Entrana", new WorldPoint(3042, 3236, 0), "Port Sarim Docks, try to charter a ship to Entrana with armour or weapons equipped."), new CrypticClue("South of a river in a town surrounded by the undead, what lies beneath the furnace?", new WorldPoint(2857, 2966, 0), "Dig in front of the Shilo Village furnace."), new CrypticClue("Talk to the Squire in the White Knights' castle in Falador.", "Squire", new WorldPoint(2977, 3343, 0), "The squire is located in the courtyard of the White Knights' Castle."), From bf286206470ce5ef569551d778f91de35a38e7f0 Mon Sep 17 00:00:00 2001 From: Lucas Date: Mon, 17 Jun 2019 21:46:23 +0200 Subject: [PATCH 039/117] Add occluder raw injector --- .../java/net/runelite/injector/Inject.java | 3 + .../net/runelite/injector/raw/Occluder.java | 83 +++++++++++++++++++ .../net/runelite/injector/raw/RenderDraw.java | 2 +- 3 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 injector-plugin/src/main/java/net/runelite/injector/raw/Occluder.java diff --git a/injector-plugin/src/main/java/net/runelite/injector/Inject.java b/injector-plugin/src/main/java/net/runelite/injector/Inject.java index 3e24a55374..b228e55e5e 100644 --- a/injector-plugin/src/main/java/net/runelite/injector/Inject.java +++ b/injector-plugin/src/main/java/net/runelite/injector/Inject.java @@ -48,6 +48,7 @@ import net.runelite.deob.deobfuscators.arithmetic.DMath; import net.runelite.injector.raw.ClearColorBuffer; import net.runelite.injector.raw.DrawAfterWidgets; import net.runelite.injector.raw.DrawMenu; +import net.runelite.injector.raw.Occluder; import net.runelite.injector.raw.RasterizerHook; import net.runelite.injector.raw.RenderDraw; import net.runelite.injector.raw.ScriptVM; @@ -76,6 +77,7 @@ public class Inject private final ScriptVM scriptVM = new ScriptVM(this); private final ClearColorBuffer clearColorBuffer = new ClearColorBuffer(this); private final RenderDraw renderDraw = new RenderDraw(this); + private final Occluder occluder = new Occluder(this); // deobfuscated contains exports etc to apply to vanilla private final ClassGroup deobfuscated, vanilla; @@ -334,6 +336,7 @@ public class Inject clearColorBuffer.inject(); renderDraw.inject(); drawMenu.inject(); + occluder.inject(); } private java.lang.Class injectInterface(ClassFile cf, ClassFile other) diff --git a/injector-plugin/src/main/java/net/runelite/injector/raw/Occluder.java b/injector-plugin/src/main/java/net/runelite/injector/raw/Occluder.java new file mode 100644 index 0000000000..9dc2c716a7 --- /dev/null +++ b/injector-plugin/src/main/java/net/runelite/injector/raw/Occluder.java @@ -0,0 +1,83 @@ +package net.runelite.injector.raw; + +import com.google.common.base.Stopwatch; +import java.util.ListIterator; +import net.runelite.asm.Method; +import net.runelite.asm.attributes.Code; +import net.runelite.asm.attributes.code.Instruction; +import net.runelite.asm.attributes.code.Instructions; +import net.runelite.asm.attributes.code.instructions.BiPush; +import net.runelite.injector.Inject; +import net.runelite.injector.InjectUtil; +import net.runelite.injector.InjectionException; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class Occluder +{ + private final Inject inject; + private static final Logger log = LoggerFactory.getLogger(Occluder.class); + private static final byte OLDVALUE = 25; + private static final byte NEWVALUE = 90; + + public Occluder(Inject inject) + { + this.inject = inject; + } + + public void inject() throws InjectionException + { + Stopwatch stopwatch = Stopwatch.createStarted(); + Method occlude = InjectUtil.findMethod(inject, "occlude"); + int replaced = 0; + + if (occlude == null) + { + throw new InjectionException("Occlude couldn't be found"); + } + + Code code = occlude.getCode(); + + if (code == null) + { + throw new InjectionException("Occlude code was null"); + } + + Instructions ins = code.getInstructions(); + + ListIterator it = ins.getInstructions().listIterator(); + + while (it.hasNext()) + { + Instruction i = it.next(); + + if (!(i instanceof BiPush)) + { + continue; + } + + boolean shouldChange = (byte) ((BiPush) i).getConstant() == OLDVALUE; + + if (!shouldChange) + { + continue; + } + + replaced++; + + Instruction biPush = new BiPush(ins, NEWVALUE); + + it.set(biPush); + } + + stopwatch.stop(); + + if (replaced != 10) + { + throw new InjectionException("Only found " + replaced + " 25's to replace in occlude instead of expected 10"); + } + + log.info("Changed {} values in occlude()", replaced); + log.info("occluder took {}", stopwatch.toString()); + } +} diff --git a/injector-plugin/src/main/java/net/runelite/injector/raw/RenderDraw.java b/injector-plugin/src/main/java/net/runelite/injector/raw/RenderDraw.java index bef73b133f..0d559df9ca 100644 --- a/injector-plugin/src/main/java/net/runelite/injector/raw/RenderDraw.java +++ b/injector-plugin/src/main/java/net/runelite/injector/raw/RenderDraw.java @@ -17,7 +17,7 @@ import org.slf4j.LoggerFactory; public class RenderDraw { - private static final Logger log = LoggerFactory.getLogger(ClearColorBuffer.class); + private static final Logger log = LoggerFactory.getLogger(RenderDraw.class); private static final net.runelite.asm.pool.Method renderDraw = new net.runelite.asm.pool.Method( new Class("net.runelite.client.callback.Hooks"), "renderDraw", From dd2bf0fa128d41883c66e6e5541c384c1aa36160 Mon Sep 17 00:00:00 2001 From: gazivodag Date: Mon, 17 Jun 2019 18:25:11 -0400 Subject: [PATCH 040/117] Fix issue #635 Menu entry shop swapper should now work. This checks if the option is value and checks if buy/sell is active so both values for buying and selling don't conflict with each other --- .../menuentryswapper/MenuEntrySwapperPlugin.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index 09995ee46a..dac8fd8c09 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -32,6 +32,7 @@ import com.google.common.base.Strings; import com.google.common.collect.ImmutableSet; import com.google.inject.Provides; import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -604,7 +605,10 @@ public class MenuEntrySwapperPlugin extends Plugin } } - if (option.contains("buy")) + if ((option.contains("buy") || option.contains("value")) && Arrays.stream(entries).anyMatch(menuEntry -> + { + return menuEntry.getOption().toLowerCase().contains("buy"); + })) { if (config.getSwapBuyOne() && !config.getBuyOneItems().equals("")) { @@ -650,7 +654,10 @@ public class MenuEntrySwapperPlugin extends Plugin } } } - else if (option.contains("sell")) + else if ((option.contains("sell") || option.contains("value")) && Arrays.stream(entries).anyMatch(menuEntry -> + { + return menuEntry.getOption().toLowerCase().contains("sell"); + })) { if (config.getSwapSellOne() && !config.getSellOneItems().equals("")) { From 42d76a3636e24e6b72afc1fb319e63aef05040ff Mon Sep 17 00:00:00 2001 From: Dava Date: Tue, 18 Jun 2019 05:36:52 +0100 Subject: [PATCH 041/117] items stats: add option to show weight --- .../client/plugins/itemstats/ItemStatConfig.java | 10 ++++++++++ .../client/plugins/itemstats/ItemStatOverlay.java | 5 ++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java index 3c7d586a86..60bb256475 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatConfig.java @@ -92,6 +92,16 @@ public interface ItemStatConfig extends Config return false; } + @ConfigItem( + keyName = "showWeight", + name = "Show Weight", + description = "Show weight in tooltip" + ) + default boolean showWeight() + { + return true; + } + @ConfigItem( keyName = "colorBetterUncapped", name = "Better (Uncapped)", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java index 206ab6fc13..32be872c91 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatOverlay.java @@ -189,7 +189,10 @@ public class ItemStatOverlay extends Overlay private String buildStatBonusString(ItemStats s) { final StringBuilder b = new StringBuilder(); - b.append(getChangeString("Weight", s.getWeight(), true, false)); + if (config.showWeight()) + { + b.append(getChangeString("Weight", s.getWeight(), true, false)); + } ItemStats other = null; final ItemEquipmentStats currentEquipment = s.getEquipment(); From 982ffa6e2021348dcdef11ae82a39f7db5772729 Mon Sep 17 00:00:00 2001 From: Ganom Date: Tue, 18 Jun 2019 01:00:18 -0400 Subject: [PATCH 042/117] Fix and improve Sound Manager for Zulrah. (#643) * Fix and improve Sound Manager for Zulrah. * Add Zulrahphase animation to api. * Re-Add Config Check --- .../java/net/runelite/api/AnimationID.java | 1 + .../client/plugins/zulrah/ZulrahPlugin.java | 89 ++++++++++++------- 2 files changed, 56 insertions(+), 34 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/AnimationID.java b/runelite-api/src/main/java/net/runelite/api/AnimationID.java index c76971fbef..37e87d4e99 100644 --- a/runelite-api/src/main/java/net/runelite/api/AnimationID.java +++ b/runelite-api/src/main/java/net/runelite/api/AnimationID.java @@ -178,6 +178,7 @@ public final class AnimationID public static final int BLACKJACK_KO = 838; public static final int VETION_EARTHQUAKE = 5507; public static final int ZULRAH_DEATH = 5804; + public static final int ZULRAH_PHASE = 5072; // Farming public static final int FARMING_HARVEST_FRUIT_TREE = 2280; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ZulrahPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ZulrahPlugin.java index b2e57c6cd1..366d636e94 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ZulrahPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/zulrah/ZulrahPlugin.java @@ -2,6 +2,7 @@ * Copyright (c) 2017, Aria * Copyright (c) 2017, Adam * Copyright (c) 2017, Devin French + * Copyright (c) 2019, Ganom * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -30,9 +31,13 @@ import com.google.inject.Provides; import javax.inject.Inject; import lombok.Getter; import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Actor; +import net.runelite.api.AnimationID; import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.NPC; +import net.runelite.api.Prayer; +import net.runelite.api.events.AnimationChanged; import net.runelite.api.events.GameTick; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; @@ -53,7 +58,6 @@ import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternB; import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternC; import net.runelite.client.plugins.zulrah.patterns.ZulrahPatternD; import net.runelite.client.plugins.zulrah.phase.ZulrahPhase; -import net.runelite.client.plugins.zulrah.phase.ZulrahType; import net.runelite.client.ui.overlay.OverlayManager; @PluginDescriptor( @@ -66,32 +70,32 @@ import net.runelite.client.ui.overlay.OverlayManager; @Slf4j public class ZulrahPlugin extends Plugin { + private static final ZulrahPattern[] patterns = new ZulrahPattern[] + { + new ZulrahPatternA(), + new ZulrahPatternB(), + new ZulrahPatternC(), + new ZulrahPatternD() + }; @Getter private NPC zulrah; - @Inject private Client client; - @Inject private ZulrahConfig config; - @Inject private OverlayManager overlayManager; - @Inject private SoundManager soundManager; - @Inject private ZulrahCurrentPhaseOverlay currentPhaseOverlay; - @Inject private ZulrahNextPhaseOverlay nextPhaseOverlay; - @Inject private ZulrahPrayerOverlay zulrahPrayerOverlay; - @Inject private ZulrahOverlay zulrahOverlay; + private ZulrahInstance instance; @Provides ZulrahConfig getConfig(ConfigManager configManager) @@ -99,16 +103,6 @@ public class ZulrahPlugin extends Plugin return configManager.getConfig(ZulrahConfig.class); } - private static final ZulrahPattern[] patterns = new ZulrahPattern[] - { - new ZulrahPatternA(), - new ZulrahPatternB(), - new ZulrahPatternC(), - new ZulrahPatternD() - }; - - private ZulrahInstance instance; - @Override protected void startUp() throws Exception { @@ -168,22 +162,8 @@ public class ZulrahPlugin extends Plugin log.debug("Zulrah phase has moved from {} -> {}, stage: {}", previousPhase, currentPhase, instance.getStage()); } - ZulrahType type = instance.getPhase().getType(); - - if (config.sounds()) - { - if (type == ZulrahType.RANGE) - { - soundManager.playSound(Sound.PRAY_RANGED); - } - - if (type == ZulrahType.MAGIC) - { - soundManager.playSound(Sound.PRAY_MAGIC); - } - } - ZulrahPattern pattern = instance.getPattern(); + if (pattern == null) { int potential = 0; @@ -213,6 +193,47 @@ public class ZulrahPlugin extends Plugin } } + @Subscribe + public void onAnimationChanged(AnimationChanged event) + { + if (instance == null) + { + return; + } + + ZulrahPhase currentPhase = instance.getPhase(); + + if (currentPhase == null) + { + return; + } + + Actor actor = event.getActor(); + if (config.sounds()) + { + if (zulrah == actor) + { + if (zulrah.getAnimation() == AnimationID.ZULRAH_PHASE) + { + Prayer prayer = instance.getNextPhase().getPrayer(); + + if (prayer != null) + { + switch (prayer) + { + case PROTECT_FROM_MAGIC: + soundManager.playSound(Sound.PRAY_MAGIC); + break; + case PROTECT_FROM_MISSILES: + soundManager.playSound(Sound.PRAY_RANGED); + break; + } + } + } + } + } + } + @Subscribe public void onNpcSpawned(NpcSpawned event) { From d4e53da6930177ab3066701ae3c38a6f379aacd0 Mon Sep 17 00:00:00 2001 From: pklite <46624825+pklite@users.noreply.github.com> Date: Tue, 18 Jun 2019 06:44:03 -0400 Subject: [PATCH 043/117] Adds the option to remove the world map and special attack orbs to the (#645) learn to click plugin Signed-off-by: PKLite --- .../learntoclick/LearnToClickConfig.java | 11 ++++ .../learntoclick/LearnToClickPlugin.java | 58 ++++++++++++++++++- 2 files changed, 66 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickConfig.java index 35b699cba0..a10cee98c3 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickConfig.java @@ -74,4 +74,15 @@ public interface LearnToClickConfig extends Config { return false; } + + @ConfigItem( + position = 5, + keyName = "hideOrbs", + name = "Hide Orbs", + description = "Completely hides the world map and special attack orbs" + ) + default boolean hideOrbs() + { + return false; + } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickPlugin.java index c70dbb5faf..cea339008b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/learntoclick/LearnToClickPlugin.java @@ -10,13 +10,18 @@ package net.runelite.client.plugins.learntoclick; +import com.google.common.collect.ImmutableList; import com.google.inject.Provides; import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.MenuEntry; +import net.runelite.api.events.ConfigChanged; import net.runelite.api.events.MenuEntryAdded; import net.runelite.api.events.MenuShouldLeftClick; +import net.runelite.api.events.WidgetLoaded; +import net.runelite.api.widgets.WidgetID; +import net.runelite.api.widgets.WidgetInfo; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.plugins.Plugin; @@ -36,6 +41,9 @@ import org.apache.commons.lang3.ArrayUtils; @Slf4j public class LearnToClickPlugin extends Plugin { + private static final ImmutableList ORB_WIDGETS = ImmutableList.of(WidgetInfo.MINIMAP_WORLDMAP_ORB, + WidgetInfo.MINIMAP_SPEC_ORB); + @Inject private LearnToClickConfig config; private boolean forceRightClickFlag; @@ -51,13 +59,44 @@ public class LearnToClickPlugin extends Plugin @Override protected void startUp() throws Exception { - } @Override protected void shutDown() throws Exception { forceRightClickFlag = false; + hideOrbWidgets(false); + } + + @Subscribe + public void onConfigChanged(ConfigChanged event) + { + if (!event.getGroup().equals("learntoclick") && !event.getKey().equals("hideOrbs")) + { + return; + } + if (config.hideOrbs()) + { + hideOrbWidgets(true); + } + else + { + hideOrbWidgets(false); + } + + } + + @Subscribe + public void onWidgetLoaded(WidgetLoaded event) + { + if (!config.hideOrbs()) + { + return; + } + if (event.getGroupId() == WidgetID.MINIMAP_GROUP_ID) + { + hideOrbWidgets(true); + } } @Subscribe @@ -71,7 +110,10 @@ public class LearnToClickPlugin extends Plugin MenuEntry[] menuEntries = client.getMenuEntries(); for (MenuEntry entry : menuEntries) { - if ((entry.getOption().equals("Floating") && config.shouldRightClickMap()) || (entry.getOption().equals("Hide") && config.shouldRightClickXp()) || (entry.getOption().equals("Show") && config.shouldRightClickXp()) || (entry.getOption().equals("Auto retaliate") && config.shouldRightClickRetaliate())) + if ((entry.getOption().equals("Floating") && config.shouldRightClickMap()) || + (entry.getOption().equals("Hide") && config.shouldRightClickXp()) || (entry.getOption().equals("Show") + && config.shouldRightClickXp()) || (entry.getOption().equals("Auto retaliate") + && config.shouldRightClickRetaliate())) { event.setForceRightClick(true); return; @@ -82,7 +124,9 @@ public class LearnToClickPlugin extends Plugin @Subscribe public void onMenuEntryAdded(MenuEntryAdded event) { - if ((event.getOption().equals("Floating") && config.shouldRightClickMap()) || (event.getOption().equals("Hide") && config.shouldRightClickXp()) || (event.getOption().equals("Show") && config.shouldRightClickXp()) || (event.getOption().equals("Auto retaliate") && config.shouldRightClickRetaliate())) + if ((event.getOption().equals("Floating") && config.shouldRightClickMap()) || (event.getOption().equals("Hide") + && config.shouldRightClickXp()) || (event.getOption().equals("Show") && config.shouldRightClickXp()) || + (event.getOption().equals("Auto retaliate") && config.shouldRightClickRetaliate())) { forceRightClickFlag = true; } @@ -99,6 +143,14 @@ public class LearnToClickPlugin extends Plugin } client.setMenuEntries(entries); } + } + /** + * Toggles hiding the World map and special attack orb widgets + * @param hidden - hides the Widgets if true, un-hides them if false + */ + private void hideOrbWidgets(boolean hidden) + { + ORB_WIDGETS.forEach(widgetInfo -> client.getWidget(widgetInfo).setHidden(hidden)); } } From 9df05ef772386d35d6cbcc69c6347d08385b7615 Mon Sep 17 00:00:00 2001 From: James <38226001+f0rmatme@users.noreply.github.com> Date: Tue, 18 Jun 2019 03:47:02 -0700 Subject: [PATCH 044/117] Fix's for overlays (#644) --- .../plugins/blastfurnace/BlastFurnaceCofferOverlay.java | 8 +++++--- .../client/plugins/itemcharges/ItemRecoilOverlay.java | 7 +++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java index 47b335e5b4..6e7bd9483f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java @@ -38,6 +38,7 @@ import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.table.TableComponent; +import net.runelite.client.ui.overlay.components.table.TableAlignment; import net.runelite.client.util.StackFormatter; class BlastFurnaceCofferOverlay extends Overlay @@ -59,6 +60,9 @@ class BlastFurnaceCofferOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { + TableComponent tableComponent = new TableComponent(); + tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); + if (plugin.getConveyorBelt() == null) { return null; @@ -72,12 +76,10 @@ class BlastFurnaceCofferOverlay extends Overlay { sack.setHidden(true); - TableComponent tableComponent = new TableComponent(); tableComponent.addRow("Coffer:", StackFormatter.quantityToStackSize(client.getVar(BLAST_FURNACE_COFFER)) + " gp"); - panelComponent.getChildren().add(tableComponent); } - + panelComponent.getChildren().add(tableComponent); return panelComponent.render(graphics); } } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemRecoilOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemRecoilOverlay.java index 6828fbb646..af55d54fe7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemRecoilOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemcharges/ItemRecoilOverlay.java @@ -35,6 +35,8 @@ import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.components.ImageComponent; import net.runelite.client.ui.overlay.components.PanelComponent; +import net.runelite.client.ui.overlay.components.table.TableAlignment; +import net.runelite.client.ui.overlay.components.table.TableComponent; class ItemRecoilOverlay extends Overlay { @@ -55,6 +57,9 @@ class ItemRecoilOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { + TableComponent tableComponent = new TableComponent(); + tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); + this.imagePanelComponent.getChildren().clear(); if (config.showrecoil()) { @@ -64,6 +69,8 @@ class ItemRecoilOverlay extends Overlay imagePanelComponent.setBackgroundColor(plugin .isRingOfRecoilEquipped() ? ACTIVATED_BACKGROUND_COLOR : NOT_ACTIVATED_BACKGROUND_COLOR); imagePanelComponent.getChildren().add(new ImageComponent(recoilImage)); + + imagePanelComponent.getChildren().add(tableComponent); return imagePanelComponent.render(graphics); } } From 4ce7cc714cb39cc0432b385b8975dc7b06edbfc6 Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Tue, 18 Jun 2019 18:31:37 +0200 Subject: [PATCH 045/117] Fix blast furnance table issue introduced in #644 --- .../blastfurnace/BlastFurnaceCofferOverlay.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java index 6e7bd9483f..49242d63a8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/blastfurnace/BlastFurnaceCofferOverlay.java @@ -60,14 +60,14 @@ class BlastFurnaceCofferOverlay extends Overlay @Override public Dimension render(Graphics2D graphics) { - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - if (plugin.getConveyorBelt() == null) { return null; } + TableComponent tableComponent = new TableComponent(); + tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); + Widget sack = client.getWidget(WidgetInfo.BLAST_FURNACE_COFFER); panelComponent.getChildren().clear(); @@ -77,9 +77,13 @@ class BlastFurnaceCofferOverlay extends Overlay sack.setHidden(true); tableComponent.addRow("Coffer:", StackFormatter.quantityToStackSize(client.getVar(BLAST_FURNACE_COFFER)) + " gp"); - } - panelComponent.getChildren().add(tableComponent); + + if (!tableComponent.isEmpty()) + { + panelComponent.getChildren().add(tableComponent); + } + return panelComponent.render(graphics); } } \ No newline at end of file From dc7d810491fff00373929fa45f765c7efcb5e959 Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Tue, 18 Jun 2019 18:49:56 +0200 Subject: [PATCH 046/117] Use TableComponent in the combat counter plugin --- .../plugins/combatcounter/CombatOverlay.java | 44 ++++++++++++------- .../plugins/combatcounter/DamageOverlay.java | 30 ++++++++----- 2 files changed, 46 insertions(+), 28 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatOverlay.java index e420e28fb7..7b0c039e44 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatOverlay.java @@ -24,22 +24,22 @@ */ package net.runelite.client.plugins.combatcounter; -import net.runelite.api.Client; -import net.runelite.api.Player; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayMenuEntry; -import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.LineComponent; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.client.ui.overlay.components.TitleComponent; - -import javax.inject.Inject; -import java.awt.*; +import java.awt.Dimension; +import java.awt.Graphics2D; import java.util.HashMap; import java.util.Map; - +import javax.inject.Inject; +import net.runelite.api.Client; import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; +import net.runelite.api.Player; +import net.runelite.client.ui.overlay.Overlay; import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; +import net.runelite.client.ui.overlay.OverlayMenuEntry; +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; +import net.runelite.client.util.ColorUtil; class CombatOverlay extends Overlay { @@ -81,9 +81,12 @@ class CombatOverlay extends Overlay panelComponent.setBackgroundColor(config.bgColor()); panelComponent.getChildren().add(TitleComponent.builder().text("Tick Counter").color(config.titleColor()).build()); int total = 0; + + TableComponent tableComponent = new TableComponent(); + if (plugin.getCounter().isEmpty()) { - panelComponent.getChildren().add(LineComponent.builder().left(local.getName()).right("0").build()); + tableComponent.addRow(local.getName(), "0"); } else { @@ -95,21 +98,28 @@ class CombatOverlay extends Overlay { if (client.getLocalPlayer().getName().contains(name)) { - panelComponent.getChildren().add(1, LineComponent.builder().left(name).right(Long.toString(map.get(name))).leftColor(config.selfColor()).rightColor(config.selfColor()).build()); + tableComponent.addRow(ColorUtil.prependColorTag(name, config.selfColor()), ColorUtil.prependColorTag(Long.toString(map.get(name)), config.selfColor())); } else { - panelComponent.getChildren().add(1, LineComponent.builder().left(name).right(Long.toString(map.get(name))).leftColor(config.otherColor()).rightColor(config.otherColor()).build()); + tableComponent.addRow(ColorUtil.prependColorTag(name, config.otherColor()), ColorUtil.prependColorTag(Long.toString(map.get(name)), config.otherColor())); } total += map.get(name); } if (!map.containsKey(local.getName())) { - panelComponent.getChildren().add(LineComponent.builder().left(local.getName()).right("0").leftColor(config.selfColor()).rightColor(config.selfColor()).build()); + tableComponent.addRow(ColorUtil.prependColorTag(local.getName(), config.selfColor()), ColorUtil.prependColorTag("0", config.selfColor())); } } - panelComponent.getChildren().add(LineComponent.builder().left("Total").leftColor(config.totalColor()).rightColor(config.totalColor()).right(String.valueOf(total)).build()); + + tableComponent.addRow(ColorUtil.prependColorTag("Total:", config.totalColor()), ColorUtil.prependColorTag(String.valueOf(total), config.totalColor())); + + if (!tableComponent.isEmpty()) + { + panelComponent.getChildren().add(tableComponent); + } + return panelComponent.render(graphics); } else diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/DamageOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/DamageOverlay.java index 2462f29762..47f5839a59 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/DamageOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/DamageOverlay.java @@ -24,20 +24,21 @@ */ package net.runelite.client.plugins.combatcounter; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.util.Map; +import javax.inject.Inject; import net.runelite.api.Client; +import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; import net.runelite.api.Player; import net.runelite.client.ui.overlay.Overlay; +import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.OverlayPosition; -import net.runelite.client.ui.overlay.components.LineComponent; import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.client.ui.overlay.components.TitleComponent; -import javax.inject.Inject; -import java.awt.*; -import java.util.Map; - -import static net.runelite.api.MenuAction.RUNELITE_OVERLAY_CONFIG; -import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; +import net.runelite.client.ui.overlay.components.table.TableComponent; +import net.runelite.client.util.ColorUtil; class DamageOverlay extends Overlay { @@ -79,9 +80,11 @@ class DamageOverlay extends Overlay panelComponent.setBackgroundColor(config.bgColor()); panelComponent.getChildren().add(TitleComponent.builder().text("Damage Counter").color(config.titleColor()).build()); + TableComponent tableComponent = new TableComponent(); + if (plugin.getCounter().isEmpty()) { - panelComponent.getChildren().add(LineComponent.builder().left(local.getName()).right("0").build()); + tableComponent.addRow(local.getName(), "0"); } else { @@ -94,20 +97,25 @@ class DamageOverlay extends Overlay String val = String.format("%.1f", map.get(name)); if (client.getLocalPlayer().getName().contains(name)) { - panelComponent.getChildren().add(1, LineComponent.builder().left(name).right(val).leftColor(config.selfColor()).rightColor(config.selfColor()).build()); + tableComponent.addRow(ColorUtil.prependColorTag(name, config.selfColor()), ColorUtil.prependColorTag(val, config.selfColor())); } else { - panelComponent.getChildren().add(1, LineComponent.builder().left(name).right(val).leftColor(config.otherColor()).rightColor(config.otherColor()).build()); + tableComponent.addRow(ColorUtil.prependColorTag(name, config.otherColor()), ColorUtil.prependColorTag(val, config.otherColor())); } } if (!map.containsKey(local.getName())) { - panelComponent.getChildren().add(LineComponent.builder().left(local.getName()).right("0").leftColor(config.selfColor()).rightColor(config.selfColor()).build()); + tableComponent.addRow(ColorUtil.prependColorTag(local.getName(), config.selfColor()), ColorUtil.prependColorTag("0", config.selfColor())); } } + if (!tableComponent.isEmpty()) + { + panelComponent.getChildren().add(tableComponent); + } + return panelComponent.render(graphics); } else From a1d1f080fd23d9b2e17510591de6e7ab83c78b6c Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Tue, 18 Jun 2019 19:02:51 +0200 Subject: [PATCH 047/117] Add slider value next to the slider instead of the config entry name label --- .../client/plugins/config/ConfigPanel.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index e98cd09d47..7eb0769c32 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -702,20 +702,26 @@ public class ConfigPanel extends PluginPanel if (max < Integer.MAX_VALUE) { + JLabel sliderValueLabel = new JLabel(); JSlider slider = new JSlider(min, max, value); - configEntryName.setText(name.concat(": ").concat(String.valueOf(slider.getValue()))); + sliderValueLabel.setText(String.valueOf(slider.getValue())); slider.setPreferredSize(new Dimension(85, 25)); - String finalName = name; slider.addChangeListener((l) -> { - configEntryName.setText(finalName.concat(": ").concat(String.valueOf(slider.getValue()))); + sliderValueLabel.setText(String.valueOf(slider.getValue())); if (!slider.getValueIsAdjusting()) { changeConfiguration(listItem, config, slider, cd, cid); } } ); - item.add(slider, BorderLayout.EAST); + + JPanel subPanel = new JPanel(); + + subPanel.add( sliderValueLabel); + subPanel.add( slider); + + item.add(subPanel, BorderLayout.EAST); } else { From 07d702358f947f65565e8af8cab04618a4809b42 Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Tue, 18 Jun 2019 19:25:23 +0200 Subject: [PATCH 048/117] Clicking the slider value will show a spinner for fast input (when spinner value is changed the spinner will be hidden and the slider and slider value label will be visible again) --- .../client/plugins/config/ConfigPanel.java | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index 7eb0769c32..9ea43fbed5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -716,10 +716,38 @@ public class ConfigPanel extends PluginPanel } ); + SpinnerModel model = new SpinnerNumberModel(value, min, max, 1); + JSpinner spinner = new JSpinner(model); + Component editor = spinner.getEditor(); + JFormattedTextField spinnerTextField = ((JSpinner.DefaultEditor) editor).getTextField(); + spinnerTextField.setColumns(SPINNER_FIELD_WIDTH); + spinner.addChangeListener((ce) -> + { + changeConfiguration(listItem, config, spinner, cd, cid); + spinner.setVisible(false); + sliderValueLabel.setText(String.valueOf(spinner.getValue())); + sliderValueLabel.setVisible(true); + slider.setValue((Integer) spinner.getValue()); + slider.setVisible(true); + }); + spinner.setVisible(false); + + sliderValueLabel.addMouseListener(new MouseAdapter() + { + public void mouseClicked(MouseEvent e) + { + spinner.setValue(slider.getValue()); + spinner.setVisible(true); + sliderValueLabel.setVisible(false); + slider.setVisible(false); + } + }); + JPanel subPanel = new JPanel(); - subPanel.add( sliderValueLabel); - subPanel.add( slider); + subPanel.add(spinner); + subPanel.add(sliderValueLabel); + subPanel.add(slider); item.add(subPanel, BorderLayout.EAST); } From 4689794dd3a9830891c29286dbc2e9f21782a49f Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Tue, 18 Jun 2019 19:42:04 +0200 Subject: [PATCH 049/117] Hide arrows in the spinner (they will cause the change listener to run) --- .../runelite/client/plugins/config/ConfigPanel.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index 9ea43fbed5..aee7415898 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -75,6 +75,7 @@ import javax.swing.border.EmptyBorder; import javax.swing.event.ChangeListener; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import javax.swing.plaf.basic.BasicSpinnerUI; import javax.swing.text.JTextComponent; import lombok.extern.slf4j.Slf4j; import net.runelite.client.config.ChatColorConfig; @@ -721,6 +722,15 @@ public class ConfigPanel extends PluginPanel Component editor = spinner.getEditor(); JFormattedTextField spinnerTextField = ((JSpinner.DefaultEditor) editor).getTextField(); spinnerTextField.setColumns(SPINNER_FIELD_WIDTH); + spinner.setUI(new BasicSpinnerUI() { + protected Component createNextButton() { + return null; + } + + protected Component createPreviousButton() { + return null; + } + }); spinner.addChangeListener((ce) -> { changeConfiguration(listItem, config, spinner, cd, cid); From 0170d19ef54157daaa43b57d9f8e618b3293c2db Mon Sep 17 00:00:00 2001 From: sdburns1998 Date: Tue, 18 Jun 2019 20:27:10 +0200 Subject: [PATCH 050/117] Braces --- .../net/runelite/client/plugins/config/ConfigPanel.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java index aee7415898..39553d8271 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/config/ConfigPanel.java @@ -722,12 +722,15 @@ public class ConfigPanel extends PluginPanel Component editor = spinner.getEditor(); JFormattedTextField spinnerTextField = ((JSpinner.DefaultEditor) editor).getTextField(); spinnerTextField.setColumns(SPINNER_FIELD_WIDTH); - spinner.setUI(new BasicSpinnerUI() { - protected Component createNextButton() { + spinner.setUI(new BasicSpinnerUI() + { + protected Component createNextButton() + { return null; } - protected Component createPreviousButton() { + protected Component createPreviousButton() + { return null; } }); From dd3c7650d83b009bc5e62295f4ce1fe0953636e4 Mon Sep 17 00:00:00 2001 From: Ganom Date: Tue, 18 Jun 2019 16:45:29 -0400 Subject: [PATCH 051/117] Add Crab Handlers and clean up Scouter. --- .../runelite/client/plugins/raids/Raid.java | 34 +++- .../client/plugins/raids/RaidRoom.java | 86 +++++----- .../client/plugins/raids/RaidsConfig.java | 125 ++++++++------ .../client/plugins/raids/RaidsOverlay.java | 83 ++++++++- .../client/plugins/raids/RaidsPanel.java | 6 +- .../plugins/raids/RaidsPartyOverlay.java | 18 +- .../client/plugins/raids/RaidsPlugin.java | 160 ++++++++---------- .../plugins/raids/RaidsPointsOverlay.java | 25 +-- .../client/plugins/raids/RaidsTimer.java | 72 ++++---- .../raids/shortcuts/ShortcutPlugin.java | 5 +- .../client/plugins/raids/solver/Layout.java | 5 + .../plugins/raids/solver/LayoutSolver.java | 1 + .../plugins/raids/solver/RotationSolver.java | 38 ++--- 13 files changed, 359 insertions(+), 299 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/Raid.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/Raid.java index a0baabe691..69feb04fca 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/Raid.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/Raid.java @@ -40,7 +40,7 @@ public class Raid @Getter private Layout layout; - public void updateLayout(Layout layout) + void updateLayout(Layout layout) { if (layout == null) { @@ -83,7 +83,7 @@ public class Raid return rooms[position]; } - public void setRoom(RaidRoom room, int position) + void setRoom(RaidRoom room, int position) { if (position < rooms.length) { @@ -91,7 +91,7 @@ public class Raid } } - public RaidRoom[] getCombatRooms() + RaidRoom[] getCombatRooms() { List combatRooms = new ArrayList<>(); @@ -111,12 +111,34 @@ public class Raid return combatRooms.toArray(new RaidRoom[combatRooms.size()]); } - public String getRotationString() + String getRotationString() { return Joiner.on(",").join(Arrays.stream(getCombatRooms()).map(r -> r.getBoss().getName()).toArray()); } - public String toCode() + private RaidRoom[] getAllRooms() + { + List getAllRooms = new ArrayList<>(); + + for (Room room : layout.getRooms()) + { + if (room == null) + { + continue; + } + + getAllRooms.add(rooms[room.getPosition()]); + } + + return getAllRooms.toArray(new RaidRoom[0]); + } + + String getFullRotationString() + { + return Joiner.on(",").join(Arrays.stream(getAllRooms()).toArray()); + } + + String toCode() { StringBuilder builder = new StringBuilder(); @@ -135,7 +157,7 @@ public class Raid return builder.toString(); } - public String toRoomString() + String toRoomString() { final StringBuilder sb = new StringBuilder(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidRoom.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidRoom.java index 23df0ff407..aa2fd9e162 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidRoom.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidRoom.java @@ -31,7 +31,46 @@ import net.runelite.api.Tile; public class RaidRoom { - public static final int ROOM_MAX_SIZE = 32; + static final int ROOM_MAX_SIZE = 32; + @Getter + private final Tile base; + @Getter + @Setter + private Type type; + @Getter + @Setter + private Boss boss; + @Getter + @Setter + private Puzzle puzzle; + @Getter + @Setter + private RaidRoom previousRoom; + @Getter + @Setter + private RaidRoom nextRoom; + + RaidRoom(Tile base, Type type) + { + this.base = base; + this.type = type; + } + + @Override + public String toString() + { + switch (type) + { + case COMBAT: + return " " + type.getName() + " - " + boss.getName(); + + case PUZZLE: + return " " + type.getName() + " - " + puzzle.getName(); + + default: + return " " + type.getName(); + } + } @AllArgsConstructor public enum Type @@ -119,49 +158,4 @@ public class RaidRoom return null; } } - - @Getter - private final Tile base; - - @Getter - @Setter - private Type type; - - @Getter - @Setter - private Boss boss; - - @Getter - @Setter - private Puzzle puzzle; - - @Getter - @Setter - private RaidRoom previousRoom; - - @Getter - @Setter - private RaidRoom nextRoom; - - public RaidRoom(Tile base, Type type) - { - this.base = base; - this.type = type; - } - - @Override - public String toString() - { - switch (type) - { - case COMBAT: - return "RaidRoom (type: " + type.getName() + ", " + boss.getName() + ")"; - - case PUZZLE: - return "RaidRoom (type: " + type.getName() + ", " + puzzle.getName() + ")"; - - default: - return "RaidRoom (type: " + type.getName() + ")"; - } - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index 2d206c9014..c1c55c5111 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -29,8 +29,8 @@ import java.awt.Color; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; -import net.runelite.client.config.Stub; import net.runelite.client.config.Keybind; +import net.runelite.client.config.Stub; @ConfigGroup("raids") public interface RaidsConfig extends Config @@ -185,32 +185,6 @@ public interface RaidsConfig extends Config @ConfigItem( position = 12, parent = "scouterConfig", - keyName = "colorTightrope", - name = "Color tightrope", - description = "Colors tightrope a separate color" - ) - default boolean colorTightrope() - { - return true; - } - - @ConfigItem( - position = 13, - parent = "scouterConfig", - keyName = "tightropeColor", - name = "Tightrope color", - description = "The color of tightropes", - hidden = true, - unhide = "colorTightrope" - ) - default Color tightropeColor() - { - return Color.MAGENTA; - } - - @ConfigItem( - position = 14, - parent = "scouterConfig", keyName = "layoutMessage", name = "Send raid layout message when entering raid", description = "Sends game message with raid layout on entering new raid" @@ -224,16 +198,69 @@ public interface RaidsConfig extends Config keyName = "roomConfig", name = "Room Config", description = "", - position = 15 + position = 13 ) default Stub roomConfig() { return new Stub(); } + @ConfigItem( + position = 14, + parent = "roomConfig", + keyName = "colorTightrope", + name = "Color tightrope", + description = "Colors tightrope a separate color" + ) + default boolean colorTightrope() + { + return true; + } + + @ConfigItem( + position = 15, + parent = "roomConfig", + keyName = "tightropeColor", + name = "Tightrope color", + description = "The color of tightropes", + hidden = true, + unhide = "colorTightrope" + ) + default Color tightropeColor() + { + return Color.MAGENTA; + } + @ConfigItem( position = 16, parent = "roomConfig", + keyName = "crabHandler", + name = "Color crabs", + description = "If your crabs are good, it will color them to your set color." + + "
If they are bad crabs, it will be set to RED" + ) + default boolean crabHandler() + { + return false; + } + + @ConfigItem( + position = 17, + parent = "roomConfig", + keyName = "crabColor", + name = "Crab color", + description = "The color of good crabs", + hidden = true, + unhide = "crabHandler" + ) + default Color crabColor() + { + return Color.MAGENTA; + } + + @ConfigItem( + position = 18, + parent = "roomConfig", keyName = "enableRotationWhitelist", name = "Enable rotation whitelist", description = "Enable the rotation whitelist" @@ -244,7 +271,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 17, + position = 19, parent = "roomConfig", keyName = "whitelistedRotations", name = "Whitelisted rotations", @@ -258,7 +285,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 18, + position = 20, parent = "roomConfig", keyName = "enableLayoutWhitelist", name = "Enable layout whitelist", @@ -270,7 +297,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 19, + position = 21, parent = "roomConfig", keyName = "whitelistedLayouts", name = "Whitelisted layouts", @@ -284,7 +311,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 20, + position = 22, parent = "roomConfig", keyName = "showScavsFarms", name = "Show scavengers and farming", @@ -296,7 +323,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 21, + position = 23, parent = "roomConfig", keyName = "scavsBeforeIce", name = "Show last scavs for Ice Demon", @@ -308,7 +335,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 22, + position = 24, parent = "roomConfig", keyName = "scavsBeforeOlm", name = "Show last scavs for Olm", @@ -320,7 +347,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 23, + position = 25, parent = "roomConfig", keyName = "scavPrepColor", name = "Last scavs color", @@ -332,7 +359,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 24, + position = 26, parent = "roomConfig", keyName = "whitelistedRooms", name = "Whitelisted rooms", @@ -347,7 +374,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 25, + position = 27, parent = "roomConfig", keyName = "blacklistedRooms", name = "Blacklisted rooms", @@ -365,7 +392,7 @@ public interface RaidsConfig extends Config keyName = "hideRooms", name = "Hide Rooms", description = "", - position = 26 + position = 28 ) default Stub hideRooms() { @@ -373,7 +400,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 27, + position = 29, parent = "hideRooms", keyName = "hideRopeless", name = "Hide no Tightrope raids", @@ -385,7 +412,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 28, + position = 30, parent = "hideRooms", keyName = "hideVanguards", name = "Hide Vanguard raids", @@ -397,7 +424,7 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 29, + position = 31, parent = "hideRooms", keyName = "hideUnknownCombat", name = "Hide Unknown combat raids", @@ -409,10 +436,10 @@ public interface RaidsConfig extends Config } @ConfigItem( - position = 30, - keyName = "partyDisplay", - name = "Party Info Display", - description = "Display an overlay that shows information about the current party" + position = 32, + keyName = "partyDisplay", + name = "Party Info Display", + description = "Display an overlay that shows information about the current party" ) default boolean partyDisplay() { @@ -420,10 +447,10 @@ public interface RaidsConfig extends Config } @ConfigItem( - keyName = "hotkey", - name = "Toggle scout overlay", - description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid", - position = 31 + keyName = "hotkey", + name = "Toggle scout overlay", + description = "When pressed the scout overlay will be toggled. Must enable show scout overlay in raid", + position = 33 ) default Keybind hotkey() { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java index 527deeaad3..e75e58668b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java @@ -25,6 +25,7 @@ */ package net.runelite.client.plugins.raids; +import com.google.common.collect.ImmutableList; import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; @@ -34,6 +35,8 @@ import java.util.ArrayList; import java.util.HashSet; import java.util.List; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import javax.inject.Inject; import lombok.Getter; import lombok.Setter; @@ -65,22 +68,56 @@ public class RaidsOverlay extends Overlay private static final int BORDER_OFFSET = 2; private static final int ICON_SIZE = 32; private static final int SMALL_ICON_SIZE = 21; - //might need to edit these if they are not standard private static final int TITLE_COMPONENT_HEIGHT = 20; private static final int LINE_COMPONENT_HEIGHT = 16; - - private Client client; - private RaidsPlugin plugin; - private RaidsConfig config; + private static final Pattern FIRST_HALF = Pattern.compile("Start, (.*), End,"); + private static final Pattern SECOND_HALF = Pattern.compile(", Start, (.*), End"); + private static final ImmutableList goodCrabsFirst = ImmutableList.of( + "FSCCP.PCSCF - #WNWSWN#ESEENW", + "SCFCP.CSCFS - #ENEESW#ENWWSW", + "SCFPC.CSPCF - #WSWWNE#WSEENE", + "SCPFC.CCPSF - #NWWWSE#WNEESE", + "SCPFC.CSPCF - #NEEESW#WWNEEE", + "SCSPF.CCSPF - #ESWWNW#ESENES", + "SPCFC.CSPCF - #WWNEEE#WSWNWS", + "SCPFC.PCSCF - #WNEEES#NWSWNW", + "SFCCPC.PCSCPF - #WSEENES#WWWNEEE", + "SCPFC.CCSSF - #NEESEN#WSWWNE" + ); + private static final ImmutableList goodCrabsSecond = ImmutableList.of( + "FSCCP.PCSCF - #WNWSWN#ESEENW", + "FSCCS.PCPSF - #WSEEEN#WSWNWS", + "FSCPC.CSCPF - #WNWWSE#EENWWW", + "SCFCP.CCSPF - #ESEENW#ESWWNW", + "SCFCP.CSCFS - #ENEESW#ENWWSW", + "SCFPC.CSPCF - #WSWWNE#WSEENE", + "SCFPC.PCCSF - #WSEENE#WWWSEE", + "SCFPC.SCPCF - #NESENE#WSWWNE", + "SCPFC.CCPSF - #NWWWSE#WNEESE", + "SCPFC.CSPCF - #NEEESW#WWNEEE", + "SCPFC.CSPSF - #WWSEEE#NWSWWN", + "SCSPF.CCSPF - #ESWWNW#ESENES", + "SFCCP.CSCPF - #WNEESE#NWSWWN", + "SFCCS.PCPSF - #ENWWSW#ENESEN", + "SPCFC.CSPCF - #WWNEEE#WSWNWS", + "SPCFC.SCCPF - #ESENES#WWWNEE", + "SPSFP.CCCSF - #NWSWWN#ESEENW", + "SFCCPC.PCSCPF - #WSEENES#WWWNEEE", + "FSCCP.PCSCF - #ENWWWS#NEESEN", + "SCPFC.CCSSF - #NEESEN#WSWWNE" + ); private final PanelComponent panelComponent = new PanelComponent(); private final ItemManager itemManager; private final SpriteManager spriteManager; private final PanelComponent panelImages = new PanelComponent(); - + private Client client; + private RaidsPlugin plugin; + private RaidsConfig config; @Setter private boolean sharable = false; - @Getter @Setter + @Getter + @Setter private boolean scoutOverlayShown = false; @Getter @@ -145,6 +182,8 @@ public class RaidsOverlay extends Overlay color = Color.RED; } + Matcher firstMatcher = FIRST_HALF.matcher(plugin.getRaid().getFullRotationString()); + Matcher secondMatcher = SECOND_HALF.matcher(plugin.getRaid().getFullRotationString()); int combatCount = 0; int roomCount = 0; List iceRooms = new ArrayList<>(); @@ -330,9 +369,22 @@ public class RaidsOverlay extends Overlay { color = config.tightropeColor(); } + if (config.crabHandler() && puzzleNameLC.equals("crabs")) + { + if (firstMatcher.find() && secondMatcher.find()) + { + if (crabHandler(firstMatcher.group(1), secondMatcher.group(1))) + { + color = config.crabColor(); + } + else + { + color = Color.RED; + } + } + } tableComponent.addRow(config.showRecommendedItems() ? "" : room.getType().getName(), ColorUtil.prependColorTag(puzzleName, color)); - break; case FARMING: if (config.showScavsFarms()) @@ -425,4 +477,19 @@ public class RaidsOverlay extends Overlay } return ImageUtil.resizeCanvas(bim, SMALL_ICON_SIZE, SMALL_ICON_SIZE); } + + private boolean crabHandler(String firstHalf, String secondHalf) + { + if (firstHalf.contains("Crabs") && goodCrabsFirst.contains(plugin.getLayoutFullCode())) + { + return true; + } + + if (secondHalf.contains("Crabs") && goodCrabsSecond.contains(plugin.getLayoutFullCode())) + { + return true; + } + + return false; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPanel.java index 737d245b82..7c62909195 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPanel.java @@ -39,7 +39,7 @@ import net.runelite.client.callback.ClientThread; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.PluginPanel; -public class RaidsPanel extends PluginPanel +class RaidsPanel extends PluginPanel { @Inject private Client client; @@ -95,10 +95,6 @@ public class RaidsPanel extends PluginPanel throw new RuntimeException(f); } } - else - { - //TODO: User is still in a dc, or not logged in. Possibly provide a meaningful message somewhere. - } }); reloadScouter.addActionListener((ActionEvent e) -> { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPartyOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPartyOverlay.java index 883c86dd26..85295b7083 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPartyOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPartyOverlay.java @@ -24,22 +24,18 @@ */ package net.runelite.client.plugins.raids; +import java.awt.Color; import java.awt.Dimension; import java.awt.Graphics2D; -import java.awt.Color; import java.util.Set; import javax.inject.Inject; - - +import net.runelite.api.ClanMember; import net.runelite.api.Client; import net.runelite.api.MenuAction; import net.runelite.api.VarPlayer; import net.runelite.api.Varbits; -import net.runelite.api.ClanMember; import net.runelite.client.ui.overlay.Overlay; - import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; - import net.runelite.client.ui.overlay.OverlayMenuEntry; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.OverlayPriority; @@ -50,18 +46,15 @@ import net.runelite.client.util.ColorUtil; public class RaidsPartyOverlay extends Overlay { - public static final String PARTY_OVERLAY_RESET = "Reset missing"; - public static final String PARTY_OVERLAY_REFRESH = "Refresh party"; + static final String PARTY_OVERLAY_RESET = "Reset missing"; + static final String PARTY_OVERLAY_REFRESH = "Refresh party"; private final PanelComponent panelComponent = new PanelComponent(); - + private final PanelComponent panel = new PanelComponent(); @Inject private Client client; - @Inject private RaidsPlugin plugin; - private final PanelComponent panel = new PanelComponent(); - @Inject private RaidsPartyOverlay(RaidsPlugin plugin) { @@ -97,7 +90,6 @@ public class RaidsPartyOverlay extends Overlay tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - String partyCountString; Color countColor = Color.WHITE; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 0975d5b3bf..cac68f4470 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -34,8 +34,10 @@ import java.time.Instant; import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; +import java.util.Set; import java.util.concurrent.ScheduledExecutorService; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -47,16 +49,16 @@ import net.runelite.api.Client; import net.runelite.api.GameState; import net.runelite.api.InstanceTemplates; import net.runelite.api.ItemID; +import net.runelite.api.MenuAction; import net.runelite.api.NullObjectID; import static net.runelite.api.Perspective.SCENE_SIZE; -import net.runelite.api.Point; import net.runelite.api.Player; +import net.runelite.api.Point; import net.runelite.api.SpriteID; import static net.runelite.api.SpriteID.TAB_QUESTS_BROWN_RAIDING_PARTY; import net.runelite.api.Tile; import net.runelite.api.VarPlayer; import net.runelite.api.Varbits; -import net.runelite.api.MenuAction; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.ClientTick; import net.runelite.api.events.ConfigChanged; @@ -71,8 +73,8 @@ import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.QueuedMessage; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; -import net.runelite.client.game.ItemManager; import net.runelite.client.events.OverlayMenuClicked; +import net.runelite.client.game.ItemManager; import net.runelite.client.game.SpriteManager; import net.runelite.client.input.KeyManager; import net.runelite.client.plugins.Plugin; @@ -85,17 +87,15 @@ import net.runelite.client.ui.ClientToolbar; import net.runelite.client.ui.DrawManager; import net.runelite.client.ui.NavigationButton; import net.runelite.client.ui.overlay.OverlayManager; -import net.runelite.client.ui.overlay.WidgetOverlay; import net.runelite.client.ui.overlay.OverlayMenuEntry; +import net.runelite.client.ui.overlay.WidgetOverlay; import net.runelite.client.ui.overlay.infobox.InfoBoxManager; import net.runelite.client.ui.overlay.tooltip.Tooltip; import net.runelite.client.ui.overlay.tooltip.TooltipManager; -import net.runelite.client.util.ImageUtil; import net.runelite.client.util.HotkeyListener; +import net.runelite.client.util.ImageUtil; import net.runelite.client.util.Text; import org.apache.commons.lang3.StringUtils; -import java.util.HashSet; -import java.util.Set; @PluginDescriptor( name = "Chambers Of Xeric", @@ -108,111 +108,101 @@ import java.util.Set; @Slf4j public class RaidsPlugin extends Plugin { + static final DecimalFormat POINTS_FORMAT = new DecimalFormat("#,###"); private static final int LOBBY_PLANE = 3; private static final String RAID_START_MESSAGE = "The raid has begun!"; private static final String LEVEL_COMPLETE_MESSAGE = "level complete!"; private static final String RAID_COMPLETE_MESSAGE = "Congratulations - your raid is complete!"; private static final DecimalFormat DECIMAL_FORMAT = new DecimalFormat("###.##"); - static final DecimalFormat POINTS_FORMAT = new DecimalFormat("#,###"); private static final String SPLIT_REGEX = "\\s*,\\s*"; private static final Pattern ROTATION_REGEX = Pattern.compile("\\[(.*?)]"); private static final int LINE_COMPONENT_HEIGHT = 16; - - @Inject - private ItemManager itemManager; private static final Pattern LEVEL_COMPLETE_REGEX = Pattern.compile("(.+) level complete! Duration: ([0-9:]+)"); private static final Pattern RAID_COMPLETE_REGEX = Pattern.compile("Congratulations - your raid is complete! Duration: ([0-9:]+)"); - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private InfoBoxManager infoBoxManager; - - @Inject - private Client client; - - @Inject - private DrawManager drawManager; - - @Inject - private ScheduledExecutorService executor; - - @Inject - private RaidsConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private RaidsOverlay overlay; - - @Inject - private RaidsPointsOverlay pointsOverlay; - - @Inject - private RaidsPartyOverlay partyOverlay; - - @Inject - private LayoutSolver layoutSolver; - - @Inject - private KeyManager keyManager; - - @Inject - private SpriteManager spriteManager; - - @Inject - private ClientThread clientThread; - - @Inject - private TooltipManager tooltipManager; - @Getter private final ArrayList roomWhitelist = new ArrayList<>(); - @Getter private final ArrayList roomBlacklist = new ArrayList<>(); - @Getter private final ArrayList rotationWhitelist = new ArrayList<>(); - @Getter private final ArrayList layoutWhitelist = new ArrayList<>(); - @Getter private final Map> recommendedItemsList = new HashMap<>(); - + private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.hotkey()) + { + @Override + public void hotkeyPressed() + { + if (config.scoutOverlayInRaid() && raidStarted) + { + if (overlay.isScoutOverlayShown()) + { + overlay.setScoutOverlayShown(false); + } + else + { + overlay.setScoutOverlayShown(true); + } + } + } + }; + public boolean canShow; + @Inject + private ChatMessageManager chatMessageManager; + @Inject + private InfoBoxManager infoBoxManager; + @Inject + private Client client; + @Inject + private DrawManager drawManager; + @Inject + private ScheduledExecutorService executor; + @Inject + private RaidsConfig config; + @Inject + private OverlayManager overlayManager; + @Inject + private RaidsOverlay overlay; + @Inject + private RaidsPointsOverlay pointsOverlay; + @Inject + private RaidsPartyOverlay partyOverlay; + @Inject + private LayoutSolver layoutSolver; + @Inject + private KeyManager keyManager; + @Inject + private SpriteManager spriteManager; + @Inject + private ClientThread clientThread; + @Inject + private TooltipManager tooltipManager; @Getter private Raid raid; - @Getter private boolean inRaidChambers; - @Inject private ClientToolbar clientToolbar; - private RaidsPanel panel; private int upperTime = -1; private int middleTime = -1; private int lowerTime = -1; private int raidTime = -1; private WidgetOverlay widgetOverlay; private String tooltip; - public boolean canShow; + @Inject + private ItemManager itemManager; private NavigationButton navButton; private boolean raidStarted; - + @Getter + private String layoutFullCode; private RaidsTimer timer; - @Getter private int startPlayerCount; - @Getter private List partyMembers = new ArrayList<>(); - @Getter private List startingPartyMembers = new ArrayList<>(); - @Getter private Set missingPartyMembers = new HashSet<>(); @@ -241,7 +231,7 @@ public class RaidsPlugin extends Plugin updateLists(); clientThread.invokeLater(() -> checkRaidPresence(true)); widgetOverlay = overlayManager.getWidgetOverlay(WidgetInfo.RAIDS_POINTS_INFOBOX); - panel = injector.getInstance(RaidsPanel.class); + RaidsPanel panel = injector.getInstance(RaidsPanel.class); panel.init(config); final BufferedImage icon = ImageUtil.getResourceStreamFromClass(this.getClass(), "instancereloadhelper.png"); navButton = NavigationButton.builder() @@ -485,13 +475,12 @@ public class RaidsPlugin extends Plugin } } - @Subscribe public void onOverlayMenuClicked(OverlayMenuClicked event) { OverlayMenuEntry entry = event.getEntry(); if (entry.getMenuAction() == MenuAction.RUNELITE_OVERLAY && - entry.getTarget().equals("Raids party overlay")) + entry.getTarget().equals("Raids party overlay")) { switch (entry.getOption()) { @@ -573,7 +562,7 @@ public class RaidsPlugin extends Plugin } } - public void checkRaidPresence(boolean force) + void checkRaidPresence(boolean force) { if (client.getGameState() != GameState.LOGGED_IN) { @@ -605,6 +594,8 @@ public class RaidsPlugin extends Plugin return; } + layoutFullCode = layout.getTest(); + log.debug("Full Layout Code: " + layoutFullCode); raid.updateLayout(layout); RotationSolver.solve(raid.getCombatRooms()); overlay.setScoutOverlayShown(true); @@ -1073,23 +1064,4 @@ public class RaidsPlugin extends Plugin tooltip = builder.toString(); } - private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.hotkey()) - { - @Override - public void hotkeyPressed() - { - if (config.scoutOverlayInRaid() && raidStarted) - { - if (overlay.isScoutOverlayShown()) - { - overlay.setScoutOverlayShown(false); - } - else - { - overlay.setScoutOverlayShown(true); - } - } - } - }; - } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPointsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPointsOverlay.java index 55888da06b..baedb561d7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPointsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPointsOverlay.java @@ -44,14 +44,6 @@ import net.runelite.client.ui.overlay.components.table.TableComponent; public class RaidsPointsOverlay extends Overlay { - @Inject - private Client client; - - @Inject - private RaidsPlugin plugin; - - private final PanelComponent panel = new PanelComponent(); - private static final NumberFormat UNIQUE_FORMAT = NumberFormat.getPercentInstance(Locale.ENGLISH); static @@ -60,6 +52,12 @@ public class RaidsPointsOverlay extends Overlay UNIQUE_FORMAT.setMinimumFractionDigits(2); } + private final PanelComponent panel = new PanelComponent(); + @Inject + private Client client; + @Inject + private RaidsPlugin plugin; + @Inject private RaidsPointsOverlay(RaidsPlugin plugin) { @@ -96,17 +94,6 @@ public class RaidsPointsOverlay extends Overlay } tableComponent.addRow("Unique:", UNIQUE_FORMAT.format(uniqueChance)); - //TODO this is annoyingly bugged, personalpoints returns null for some reason -/* - if (partySize > 1) - { - double personalChance = uniqueChance * (double)(personalPoints / totalPoints); - - panel.getChildren().add(LineComponent.builder() - .left("Personal:") - .right(UNIQUE_FORMAT.format(personalChance)) - .build()); - }*/ panel.getChildren().add(tableComponent); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsTimer.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsTimer.java index 8df3087054..8e7dec1309 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsTimer.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsTimer.java @@ -47,7 +47,7 @@ public class RaidsTimer extends InfoBox @Setter private boolean stopped; - public RaidsTimer(BufferedImage image, Plugin plugin, Instant startTime) + RaidsTimer(BufferedImage image, Plugin plugin, Instant startTime) { super(image, plugin); this.startTime = startTime; @@ -55,7 +55,7 @@ public class RaidsTimer extends InfoBox stopped = false; } - public void timeFloor() + void timeFloor() { Duration elapsed = Duration.between(floorTime, Instant.now()); @@ -75,45 +75,12 @@ public class RaidsTimer extends InfoBox floorTime = Instant.now(); } - public void timeOlm() + void timeOlm() { Duration elapsed = Duration.between(floorTime, Instant.now()); olmTime = LocalTime.ofSecondOfDay(elapsed.getSeconds()); } - @Override - public String getText() - { - if (startTime == null) - { - return ""; - } - - if (!stopped) - { - Duration elapsed = Duration.between(startTime, Instant.now()); - time = LocalTime.ofSecondOfDay(elapsed.getSeconds()); - } - - if (time.getHour() > 0) - { - return time.format(DateTimeFormatter.ofPattern("HH:mm")); - } - - return time.format(DateTimeFormatter.ofPattern("mm:ss")); - } - - @Override - public Color getTextColor() - { - if (stopped) - { - return Color.GREEN; - } - - return Color.WHITE; - } - @Override public String getTooltip() { @@ -147,4 +114,37 @@ public class RaidsTimer extends InfoBox return builder.toString(); } + + @Override + public String getText() + { + if (startTime == null) + { + return ""; + } + + if (!stopped) + { + Duration elapsed = Duration.between(startTime, Instant.now()); + time = LocalTime.ofSecondOfDay(elapsed.getSeconds()); + } + + if (time.getHour() > 0) + { + return time.format(DateTimeFormatter.ofPattern("HH:mm")); + } + + return time.format(DateTimeFormatter.ofPattern("mm:ss")); + } + + @Override + public Color getTextColor() + { + if (stopped) + { + return Color.GREEN; + } + + return Color.WHITE; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutPlugin.java index 59f6af301a..422c85225f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/shortcuts/ShortcutPlugin.java @@ -26,17 +26,14 @@ import net.runelite.client.ui.overlay.OverlayManager; @Slf4j public class ShortcutPlugin extends Plugin { + private final List shortcut = new ArrayList<>(); @Inject private Client client; - @Inject private OverlayManager overlayManager; - @Inject private ShortcutOverlay overlay; - private final List shortcut = new ArrayList<>(); - List getShortcut() { return shortcut; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/Layout.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/Layout.java index 3bee58d4fc..49944432a8 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/Layout.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/Layout.java @@ -27,12 +27,17 @@ package net.runelite.client.plugins.raids.solver; import java.util.ArrayList; import java.util.List; import lombok.Getter; +import lombok.Setter; public class Layout { @Getter private final List rooms = new ArrayList<>(); + @Getter + @Setter + private String test; + public void add(Room room) { rooms.add(room); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/LayoutSolver.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/LayoutSolver.java index 3b893aee4e..c71a0ce946 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/LayoutSolver.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/LayoutSolver.java @@ -213,6 +213,7 @@ public class LayoutSolver room.setPrevious(lastRoom); lastRoom.setNext(room); layout.add(room); + layout.setTest(code); position += 8; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/RotationSolver.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/RotationSolver.java index e7c9cd0c08..04e0323a5c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/RotationSolver.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/solver/RotationSolver.java @@ -32,25 +32,6 @@ import net.runelite.client.plugins.raids.RaidRoom.Boss; public class RotationSolver { - private static class Rotation extends ArrayList - { - Rotation(Collection bosses) - { - super(bosses); - } - - @Override - public E get(int index) - { - if (index < 0) - { - index = index + size(); - } - - return super.get(index % size()); - } - } - private static final Rotation[] ROTATIONS = { new Rotation<>(Arrays.asList(Boss.TEKTON, Boss.VASA, Boss.GUARDIANS, Boss.MYSTICS, Boss.SHAMANS, Boss.MUTTADILES, Boss.VANGUARDS, Boss.VESPULA)), @@ -147,4 +128,23 @@ public class RotationSolver return true; } + + private static class Rotation extends ArrayList + { + Rotation(Collection bosses) + { + super(bosses); + } + + @Override + public E get(int index) + { + if (index < 0) + { + index = index + size(); + } + + return super.get(index % size()); + } + } } From 34d36331a2f9599bc7ad35278b674966ceba793c Mon Sep 17 00:00:00 2001 From: Ganom Date: Tue, 18 Jun 2019 17:04:29 -0400 Subject: [PATCH 052/117] Thanks Intellij for making travis beat me again :( --- .../client/plugins/raids/RaidsPlugin.java | 36 +++++++++---------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index cac68f4470..9b6dc84c38 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -129,24 +129,6 @@ public class RaidsPlugin extends Plugin private final ArrayList layoutWhitelist = new ArrayList<>(); @Getter private final Map> recommendedItemsList = new HashMap<>(); - private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.hotkey()) - { - @Override - public void hotkeyPressed() - { - if (config.scoutOverlayInRaid() && raidStarted) - { - if (overlay.isScoutOverlayShown()) - { - overlay.setScoutOverlayShown(false); - } - else - { - overlay.setScoutOverlayShown(true); - } - } - } - }; public boolean canShow; @Inject private ChatMessageManager chatMessageManager; @@ -1064,4 +1046,22 @@ public class RaidsPlugin extends Plugin tooltip = builder.toString(); } + private final HotkeyListener hotkeyListener = new HotkeyListener(() -> config.hotkey()) + { + @Override + public void hotkeyPressed() + { + if (config.scoutOverlayInRaid() && raidStarted) + { + if (overlay.isScoutOverlayShown()) + { + overlay.setScoutOverlayShown(false); + } + else + { + overlay.setScoutOverlayShown(true); + } + } + } + }; } From 7c5a9682e2f0eac8f4b6dcf60470b228fb36850e Mon Sep 17 00:00:00 2001 From: Ganom Date: Tue, 18 Jun 2019 18:00:25 -0400 Subject: [PATCH 053/117] Adding Record Raid scout. --- .../client/plugins/raids/RaidsOverlay.java | 55 +++++++++++++------ .../client/plugins/raids/RaidsPlugin.java | 19 +++++++ 2 files changed, 56 insertions(+), 18 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java index e75e58668b..6174f7a9e0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java @@ -80,9 +80,9 @@ public class RaidsOverlay extends Overlay "SCPFC.CSPCF - #NEEESW#WWNEEE", "SCSPF.CCSPF - #ESWWNW#ESENES", "SPCFC.CSPCF - #WWNEEE#WSWNWS", - "SCPFC.PCSCF - #WNEEES#NWSWNW", - "SFCCPC.PCSCPF - #WSEENES#WWWNEEE", - "SCPFC.CCSSF - #NEESEN#WSWWNE" + "SCPFC.PCSCF - #WNEEES#NWSWNW", //rare crabs first bad crabs second + "SFCCPC.PCSCPF - #WSEENES#WWWNEEE", //good crabs first rare crabs second rare crabs third + "SCPFC.CCSSF - #NEESEN#WSWWNE" //good crabs ); private static final ImmutableList goodCrabsSecond = ImmutableList.of( "FSCCP.PCSCF - #WNWSWN#ESEENW", @@ -101,10 +101,10 @@ public class RaidsOverlay extends Overlay "SFCCS.PCPSF - #ENWWSW#ENESEN", "SPCFC.CSPCF - #WWNEEE#WSWNWS", "SPCFC.SCCPF - #ESENES#WWWNEE", - "SPSFP.CCCSF - #NWSWWN#ESEENW", - "SFCCPC.PCSCPF - #WSEENES#WWWNEEE", - "FSCCP.PCSCF - #ENWWWS#NEESEN", - "SCPFC.CCSSF - #NEESEN#WSWWNE" + "SPSFP.CCCSF - #NWSWWN#ESEENW", //bad crabs first good crabs second + "SFCCPC.PCSCPF - #WSEENES#WWWNEEE", //good crabs first rare crabs second rare crabs third + "FSCCP.PCSCF - #ENWWWS#NEESEN", //bad crabs first good crabs second + "SCPFC.CCSSF - #NEESEN#WSWWNE" //good crabs ); private final PanelComponent panelComponent = new PanelComponent(); private final ItemManager itemManager; @@ -164,6 +164,8 @@ public class RaidsOverlay extends Overlay return panelComponent.render(graphics); } + System.out.println(plugin.getRaid().getRotationString()); + Color color = Color.WHITE; String layout = plugin.getRaid().getLayout().toCodeString(); String displayLayout; @@ -279,10 +281,20 @@ public class RaidsOverlay extends Overlay scavsBeforeIceRooms.add(prev); } int lastScavs = scavRooms.get(scavRooms.size() - 1); - panelComponent.getChildren().add(TitleComponent.builder() - .text(displayLayout) - .color(color) - .build()); + if (!recordRaid()) + { + panelComponent.getChildren().add(TitleComponent.builder() + .text(displayLayout) + .color(color) + .build()); + } + else + { + panelComponent.getChildren().add(TitleComponent.builder() + .text("Record Raid") + .color(Color.GREEN) + .build()); + } TableComponent tableComponent = new TableComponent(); tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); @@ -480,16 +492,23 @@ public class RaidsOverlay extends Overlay private boolean crabHandler(String firstHalf, String secondHalf) { - if (firstHalf.contains("Crabs") && goodCrabsFirst.contains(plugin.getLayoutFullCode())) - { - return true; - } + return (firstHalf.contains("Crabs") && goodCrabsFirst.contains(plugin.getLayoutFullCode())) + || (secondHalf.contains("Crabs") && goodCrabsSecond.contains(plugin.getLayoutFullCode())); + } - if (secondHalf.contains("Crabs") && goodCrabsSecond.contains(plugin.getLayoutFullCode())) + boolean recordRaid() + { + Matcher firstMatcher = FIRST_HALF.matcher(plugin.getRaid().getFullRotationString()); + Matcher secondMatcher = SECOND_HALF.matcher(plugin.getRaid().getFullRotationString()); + if (plugin.getRaid().getRotationString().toLowerCase().equals("vasa,tekton,vespula") + && plugin.getRaid().getFullRotationString().toLowerCase().contains("crabs") + && plugin.getRaid().getFullRotationString().toLowerCase().contains("tightrope")) { - return true; + if (firstMatcher.find() && secondMatcher.find()) + { + return (crabHandler(firstMatcher.group(1), secondMatcher.group(1))); + } } - return false; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 9b6dc84c38..6c9651061e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -617,6 +617,25 @@ public class RaidsPlugin extends Plugin .append(raidData) .build()) .build()); + + if (overlay.recordRaid()) + { + chatMessageManager.queue(QueuedMessage.builder() + .type(ChatMessageType.FRIENDSCHATNOTIFICATION) + .runeLiteFormattedMessage(new ChatMessageBuilder() + .append(ChatColorType.HIGHLIGHT) + .append("You have scouted a record raid, whilst this is a very good raid to do you will probably end up profiting more by selling this raid to a team looking for it.") + .build()) + .build()); + + chatMessageManager.queue(QueuedMessage.builder() + .type(ChatMessageType.FRIENDSCHATNOTIFICATION) + .runeLiteFormattedMessage(new ChatMessageBuilder() + .append(ChatColorType.HIGHLIGHT) + .append("The following are some places you can sell this raid: Scout Trading in We do Raids discord, and Buying Cox Rotations in Oblivion discord") + .build()) + .build()); + } } private void updateInfoBoxState() From 602c843a80eb222fc548ae638f8af1713b3f4a07 Mon Sep 17 00:00:00 2001 From: Ganom Date: Tue, 18 Jun 2019 18:04:41 -0400 Subject: [PATCH 054/117] Fix up formatting. --- .../java/net/runelite/client/plugins/raids/RaidsPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java index 6c9651061e..a2d08ab61f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsPlugin.java @@ -632,7 +632,7 @@ public class RaidsPlugin extends Plugin .type(ChatMessageType.FRIENDSCHATNOTIFICATION) .runeLiteFormattedMessage(new ChatMessageBuilder() .append(ChatColorType.HIGHLIGHT) - .append("The following are some places you can sell this raid: Scout Trading in We do Raids discord, and Buying Cox Rotations in Oblivion discord") + .append("The following are some places you can sell this raid: Scout Trading in We do Raids discord, and Buying Cox Rotations in Oblivion discord.") .build()) .build()); } From f59c0be7f3d69df094c1bcfe157f3ecfb5fecdf8 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Mon, 17 Jun 2019 00:40:52 -0600 Subject: [PATCH 055/117] runelite-client: centralize item sprite dimensions --- .../src/main/java/net/runelite/api/Constants.java | 11 +++++++++++ .../java/net/runelite/client/game/ItemManager.java | 3 ++- .../client/plugins/banktags/tabs/TabInterface.java | 9 ++++++++- .../inventoryviewer/InventoryViewerOverlay.java | 6 +++--- .../client/plugins/itemstats/ItemStatPlugin.java | 5 +++-- .../plugins/timetracking/OverviewItemPanel.java | 3 ++- .../client/plugins/timetracking/TimeablePanel.java | 3 ++- 7 files changed, 31 insertions(+), 9 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Constants.java b/runelite-api/src/main/java/net/runelite/api/Constants.java index ffb2c1ba66..87e6fd65bb 100644 --- a/runelite-api/src/main/java/net/runelite/api/Constants.java +++ b/runelite-api/src/main/java/net/runelite/api/Constants.java @@ -97,4 +97,15 @@ public class Constants * All game-play actions operate within multiples of this duration. */ public static final int GAME_TICK_LENGTH = 600; + + /** + * Width of a standard item sprite + */ + public static final int ITEM_SPRITE_WIDTH = 36; + + /** + * Height of a standard item sprite + */ + public static final int ITEM_SPRITE_HEIGHT = 32; + } diff --git a/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java b/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java index 0f21a5b434..bbc07771c2 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java @@ -44,6 +44,7 @@ import javax.inject.Singleton; import lombok.Value; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; +import net.runelite.api.Constants; import static net.runelite.api.Constants.CLIENT_DEFAULT_ZOOM; import net.runelite.api.GameState; import net.runelite.api.ItemComposition; @@ -381,7 +382,7 @@ public class ItemManager */ private AsyncBufferedImage loadImage(int itemId, int quantity, boolean stackable) { - AsyncBufferedImage img = new AsyncBufferedImage(36, 32, BufferedImage.TYPE_INT_ARGB); + AsyncBufferedImage img = new AsyncBufferedImage(Constants.ITEM_SPRITE_WIDTH, Constants.ITEM_SPRITE_HEIGHT, BufferedImage.TYPE_INT_ARGB); clientThread.invoke(() -> { if (client.getGameState().ordinal() < GameState.LOGIN_SCREEN.ordinal()) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java index e0b1af23eb..24f6564ab1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banktags/tabs/TabInterface.java @@ -50,6 +50,7 @@ import javax.inject.Inject; import javax.inject.Singleton; import lombok.Getter; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemComposition; @@ -721,7 +722,13 @@ public class TabInterface if (tagTab.getIcon() == null) { - Widget icon = createGraphic(ColorUtil.wrapWithColorTag(tagTab.getTag(), HILIGHT_COLOR), -1, tagTab.getIconItemId(), 36, 32, bounds.x + 3, 1, false); + Widget icon = createGraphic( + ColorUtil.wrapWithColorTag(tagTab.getTag(), HILIGHT_COLOR), + -1, + tagTab.getIconItemId(), + Constants.ITEM_SPRITE_WIDTH, Constants.ITEM_SPRITE_HEIGHT, + bounds.x + 3, 1, + false); int clickmask = icon.getClickMask(); clickmask |= WidgetConfig.DRAG; clickmask |= WidgetConfig.DRAG_ON; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java index 7162be5290..f323b96afc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java @@ -30,6 +30,7 @@ import java.awt.Point; import java.awt.image.BufferedImage; import javax.inject.Inject; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemComposition; @@ -44,9 +45,8 @@ import net.runelite.client.ui.overlay.components.PanelComponent; class InventoryViewerOverlay extends Overlay { private static final int INVENTORY_SIZE = 28; - private static final int PLACEHOLDER_WIDTH = 36; - private static final int PLACEHOLDER_HEIGHT = 32; - private static final ImageComponent PLACEHOLDER_IMAGE = new ImageComponent(new BufferedImage(PLACEHOLDER_WIDTH, PLACEHOLDER_HEIGHT, BufferedImage.TYPE_4BYTE_ABGR)); + private static final ImageComponent PLACEHOLDER_IMAGE = new ImageComponent( + new BufferedImage(Constants.ITEM_SPRITE_WIDTH, Constants.ITEM_SPRITE_HEIGHT, BufferedImage.TYPE_4BYTE_ABGR)); private final Client client; private final ItemManager itemManager; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java index d8facce32a..4f244d844b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemstats/ItemStatPlugin.java @@ -35,6 +35,7 @@ import java.util.List; import java.util.Map; import java.util.Set; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.FontID; import net.runelite.api.InventoryID; import net.runelite.api.Item; @@ -236,8 +237,8 @@ public class ItemStatPlugin extends Plugin Widget icon = invContainer.createChild(-1, WidgetType.GRAPHIC); icon.setOriginalX(8); icon.setOriginalY(yPos); - icon.setOriginalWidth(36); - icon.setOriginalHeight(32); + icon.setOriginalWidth(Constants.ITEM_SPRITE_WIDTH); + icon.setOriginalHeight(Constants.ITEM_SPRITE_HEIGHT); icon.setItemId(id); icon.setItemQuantityMode(0); icon.setBorderType(1); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewItemPanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewItemPanel.java index 96cf62c6fc..47484a669d 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewItemPanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/OverviewItemPanel.java @@ -35,6 +35,7 @@ import javax.swing.ImageIcon; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; +import net.runelite.api.Constants; import net.runelite.client.game.ItemManager; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.FontManager; @@ -60,7 +61,7 @@ class OverviewItemPanel extends JPanel setBorder(new EmptyBorder(7, 7, 7, 7)); JLabel iconLabel = new JLabel(); - iconLabel.setMinimumSize(new Dimension(36, 32)); + iconLabel.setMinimumSize(new Dimension(Constants.ITEM_SPRITE_WIDTH, Constants.ITEM_SPRITE_HEIGHT)); itemManager.getImage(tab.getItemID()).addTo(iconLabel); add(iconLabel, BorderLayout.WEST); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeablePanel.java b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeablePanel.java index 8bbb5ae4ab..c01f770063 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeablePanel.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/timetracking/TimeablePanel.java @@ -33,6 +33,7 @@ import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.border.EmptyBorder; import lombok.Getter; +import net.runelite.api.Constants; import net.runelite.client.ui.ColorScheme; import net.runelite.client.ui.FontManager; import net.runelite.client.ui.components.ThinProgressBar; @@ -58,7 +59,7 @@ public class TimeablePanel extends JPanel topContainer.setLayout(new BorderLayout()); topContainer.setBackground(ColorScheme.DARKER_GRAY_COLOR); - icon.setMinimumSize(new Dimension(36, 32)); + icon.setMinimumSize(new Dimension(Constants.ITEM_SPRITE_WIDTH, Constants.ITEM_SPRITE_HEIGHT)); JPanel infoPanel = new JPanel(); infoPanel.setBackground(ColorScheme.DARKER_GRAY_COLOR); From a8b00c9989bcd2fc9122823bd948e536e395c504 Mon Sep 17 00:00:00 2001 From: Max Weber Date: Mon, 17 Jun 2019 04:16:58 -0600 Subject: [PATCH 056/117] runelite-client: Centralize the high alchemy multiplier --- runelite-api/src/main/java/net/runelite/api/Constants.java | 6 ++++++ .../src/main/java/net/runelite/api/ItemComposition.java | 2 ++ .../net/runelite/client/plugins/bank/BankCalculation.java | 4 ++-- .../client/plugins/chatcommands/ChatCommandsPlugin.java | 4 ++-- .../net/runelite/client/plugins/examine/ExaminePlugin.java | 4 ++-- .../client/plugins/grounditems/GroundItemsPlugin.java | 7 +++---- .../client/plugins/itemprices/ItemPricesOverlay.java | 6 ++---- 7 files changed, 19 insertions(+), 14 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Constants.java b/runelite-api/src/main/java/net/runelite/api/Constants.java index 87e6fd65bb..48ff3fc4bf 100644 --- a/runelite-api/src/main/java/net/runelite/api/Constants.java +++ b/runelite-api/src/main/java/net/runelite/api/Constants.java @@ -108,4 +108,10 @@ public class Constants */ public static final int ITEM_SPRITE_HEIGHT = 32; + /** + * High alchemy = shop price * HIGH_ALCHEMY_MULTIPLIER + * + * @see ItemComposition#getPrice + */ + public static final float HIGH_ALCHEMY_MULTIPLIER = .6f; } diff --git a/runelite-api/src/main/java/net/runelite/api/ItemComposition.java b/runelite-api/src/main/java/net/runelite/api/ItemComposition.java index eaaed4e2aa..7a9cf2257c 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemComposition.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemComposition.java @@ -87,6 +87,8 @@ public interface ItemComposition * alchemy values, respectively. * * @return the general store value of the item + * + * @see Constants#HIGH_ALCHEMY_MULTIPLIER */ int getPrice(); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankCalculation.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankCalculation.java index a93c2c409c..3388a6b4e1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankCalculation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankCalculation.java @@ -34,6 +34,7 @@ import javax.inject.Inject; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemComposition; @@ -47,7 +48,6 @@ import net.runelite.client.game.ItemManager; @Slf4j class BankCalculation { - private static final float HIGH_ALCHEMY_CONSTANT = 0.6f; private static final ImmutableList TAB_VARBITS = ImmutableList.of( Varbits.BANK_TAB_ONE_COUNT, Varbits.BANK_TAB_TWO_COUNT, @@ -157,7 +157,7 @@ class BankCalculation if (price > 0) { - haPrice += (long) Math.round(price * HIGH_ALCHEMY_CONSTANT) * + haPrice += (long) Math.round(price * Constants.HIGH_ALCHEMY_MULTIPLIER) * (long) quantity; } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 388ebb300a..141d72ab65 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -36,6 +36,7 @@ import lombok.Value; import lombok.extern.slf4j.Slf4j; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.Experience; import net.runelite.api.IconID; import net.runelite.api.ItemComposition; @@ -80,7 +81,6 @@ import org.apache.commons.text.WordUtils; @Slf4j public class ChatCommandsPlugin extends Plugin { - private static final float HIGH_ALCHEMY_CONSTANT = 0.6f; private static final Pattern KILLCOUNT_PATTERN = Pattern.compile("Your (.+) (?:kill|harvest) count is: (\\d+)"); private static final Pattern RAIDS_PATTERN = Pattern.compile("Your completed (.+) count is: (\\d+)"); private static final Pattern WINTERTODT_PATTERN = Pattern.compile("Your subdued Wintertodt count is: (\\d+)"); @@ -614,7 +614,7 @@ public class ChatCommandsPlugin extends Plugin ItemComposition itemComposition = itemManager.getItemComposition(itemId); if (itemComposition != null) { - int alchPrice = Math.round(itemComposition.getPrice() * HIGH_ALCHEMY_CONSTANT); + int alchPrice = Math.round(itemComposition.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER); builder .append(ChatColorType.NORMAL) .append(" HA value ") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java index 888a25c08e..900d2b86a2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java @@ -35,6 +35,7 @@ import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.ItemComposition; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameStateChanged; @@ -68,7 +69,6 @@ import net.runelite.http.api.examine.ExamineClient; @Slf4j public class ExaminePlugin extends Plugin { - private static final float HIGH_ALCHEMY_CONSTANT = 0.6f; private static final Pattern X_PATTERN = Pattern.compile("^\\d+ x "); private final Deque pending = new ArrayDeque<>(); @@ -319,7 +319,7 @@ public class ExaminePlugin extends Plugin quantity = Math.max(1, quantity); int itemCompositionPrice = itemComposition.getPrice(); final int gePrice = itemManager.getItemPrice(id); - final int alchPrice = itemCompositionPrice <= 0 ? 0 : Math.round(itemCompositionPrice * HIGH_ALCHEMY_CONSTANT); + final int alchPrice = itemCompositionPrice <= 0 ? 0 : Math.round(itemCompositionPrice * Constants.HIGH_ALCHEMY_MULTIPLIER); if (gePrice > 0 || alchPrice > 0) { diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java index 6bb50180df..cce5ab2fbd 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java @@ -46,6 +46,7 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.GameState; import net.runelite.api.Item; import net.runelite.api.ItemComposition; @@ -95,8 +96,6 @@ import net.runelite.client.util.Text; ) public class GroundItemsPlugin extends Plugin { - // Used when getting High Alchemy value - multiplied by general store price. - private static final float HIGH_ALCHEMY_CONSTANT = 0.6f; // ItemID for coins private static final int COINS = ItemID.COINS_995; // Ground item menu options @@ -369,7 +368,7 @@ public class GroundItemsPlugin extends Plugin final int itemId = item.getId(); final ItemComposition itemComposition = itemManager.getItemComposition(itemId); final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemId; - final int alchPrice = Math.round(itemComposition.getPrice() * HIGH_ALCHEMY_CONSTANT); + final int alchPrice = Math.round(itemComposition.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER); final GroundItem groundItem = GroundItem.builder() .id(itemId) @@ -481,7 +480,7 @@ public class GroundItemsPlugin extends Plugin final int realItemId = itemComposition.getNote() != -1 ? itemComposition.getLinkedNoteId() : itemComposition.getId(); final int itemPrice = itemManager.getItemPrice(realItemId); final int price = itemPrice <= 0 ? itemComposition.getPrice() : itemPrice; - final int haPrice = Math.round(itemComposition.getPrice() * HIGH_ALCHEMY_CONSTANT) * quantity; + final int haPrice = Math.round(itemComposition.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER) * quantity; final int gePrice = quantity * price; final Color hidden = getHidden(itemComposition.getName(), gePrice, haPrice, itemComposition.isTradeable()); final Color highlighted = getHighlighted(itemComposition.getName(), gePrice, haPrice); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java index 7c748a7702..e6f5f49ddc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java @@ -29,6 +29,7 @@ import java.awt.Dimension; import java.awt.Graphics2D; import javax.inject.Inject; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemComposition; @@ -48,9 +49,6 @@ import net.runelite.client.util.StackFormatter; class ItemPricesOverlay extends Overlay { - // Used when getting High Alchemy value - multiplied by general store price. - private static final float HIGH_ALCHEMY_CONSTANT = 0.6f; - private static final int INVENTORY_ITEM_WIDGETID = WidgetInfo.INVENTORY.getPackedId(); private static final int BANK_INVENTORY_ITEM_WIDGETID = WidgetInfo.BANK_INVENTORY_ITEMS_CONTAINER.getPackedId(); private static final int BANK_ITEM_WIDGETID = WidgetInfo.BANK_ITEM_CONTAINER.getPackedId(); @@ -204,7 +202,7 @@ class ItemPricesOverlay extends Overlay } if (config.showHAValue()) { - haPrice = Math.round(itemDef.getPrice() * HIGH_ALCHEMY_CONSTANT); + haPrice = Math.round(itemDef.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER); } if (gePrice > 0 && haPrice > 0 && config.showAlchProfit()) { From 8312c33a888de65ff8ccfe39d9fd7a01b5ca4561 Mon Sep 17 00:00:00 2001 From: TheStonedTurtle Date: Mon, 17 Jun 2019 20:34:10 -0700 Subject: [PATCH 057/117] Add scroll price to Magic shortbow (i) and Row (i) --- .../src/main/java/net/runelite/client/game/ItemMapping.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java b/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java index aee270096f..20382fd235 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemMapping.java @@ -144,10 +144,12 @@ public enum ItemMapping // Bounty hunter ITEM_GRANITE_MAUL(GRANITE_MAUL, GRANITE_MAUL_12848), ITEM_MAGIC_SHORTBOW(MAGIC_SHORTBOW, MAGIC_SHORTBOW_I), + ITEM_MAGIC_SHORTBOW_SCROLL(MAGIC_SHORTBOW_SCROLL, MAGIC_SHORTBOW_I), ITEM_SARADOMINS_BLESSED_SWORD(SARADOMINS_TEAR, SARADOMINS_BLESSED_SWORD), // Jewellery with charges ITEM_RING_OF_WEALTH(RING_OF_WEALTH, RING_OF_WEALTH_I, RING_OF_WEALTH_1, RING_OF_WEALTH_I1, RING_OF_WEALTH_2, RING_OF_WEALTH_I2, RING_OF_WEALTH_3, RING_OF_WEALTH_I3, RING_OF_WEALTH_4, RING_OF_WEALTH_I4, RING_OF_WEALTH_I5), + ITEM_RING_OF_WEALTH_SCROLL(RING_OF_WEALTH_SCROLL, RING_OF_WEALTH_I, RING_OF_WEALTH_I1, RING_OF_WEALTH_I2, RING_OF_WEALTH_I3, RING_OF_WEALTH_I4, RING_OF_WEALTH_I5), ITEM_AMULET_OF_GLORY(AMULET_OF_GLORY, AMULET_OF_GLORY1, AMULET_OF_GLORY2, AMULET_OF_GLORY3, AMULET_OF_GLORY5), ITEM_AMULET_OF_GLORY_T(AMULET_OF_GLORY_T, AMULET_OF_GLORY_T1, AMULET_OF_GLORY_T2, AMULET_OF_GLORY_T3, AMULET_OF_GLORY_T5), ITEM_SKILLS_NECKLACE(SKILLS_NECKLACE, SKILLS_NECKLACE1, SKILLS_NECKLACE2, SKILLS_NECKLACE3, SKILLS_NECKLACE5), From e5de331df54b054c0d81eec2b21162bd7eb63c42 Mon Sep 17 00:00:00 2001 From: TheStonedTurtle Date: Mon, 17 Jun 2019 13:41:16 -0600 Subject: [PATCH 058/117] runelite-client: add items kept on death plugin This enhances the default items kept on death interface to show what you keep, what breaks, and how long you have to return to it once you die. It also adds toggles to see what is lost in certain situations such as skulled, low and high wildy. Co-authored-by: Adam Co-authored-by: Max Weber --- .../main/java/net/runelite/api/ScriptID.java | 10 + .../net/runelite/api/widgets/WidgetID.java | 13 + .../net/runelite/api/widgets/WidgetInfo.java | 11 +- .../itemskeptondeath/AlwaysLostItem.java | 65 ++ .../itemskeptondeath/BrokenOnDeathItem.java | 111 +++ .../itemskeptondeath/FixedPriceItem.java | 91 +++ .../ItemsKeptOnDeathPlugin.java | 610 +++++++++++++++++ .../client/plugins/itemskeptondeath/Pets.java | 99 +++ .../itemskeptondeath/WidgetButton.java | 163 +++++ .../src/main/scripts/DeathkeepBuild.hash | 1 + .../src/main/scripts/DeathkeepBuild.rs2asm | 634 ++++++++++++++++++ 11 files changed, 1807 insertions(+), 1 deletion(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/AlwaysLostItem.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/BrokenOnDeathItem.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/FixedPriceItem.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/Pets.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/WidgetButton.java create mode 100644 runelite-client/src/main/scripts/DeathkeepBuild.hash create mode 100644 runelite-client/src/main/scripts/DeathkeepBuild.rs2asm diff --git a/runelite-api/src/main/java/net/runelite/api/ScriptID.java b/runelite-api/src/main/java/net/runelite/api/ScriptID.java index 7f33380f28..56f29fb073 100644 --- a/runelite-api/src/main/java/net/runelite/api/ScriptID.java +++ b/runelite-api/src/main/java/net/runelite/api/ScriptID.java @@ -95,6 +95,16 @@ public final class ScriptID */ public static final int CHAT_PROMPT_INIT = 223; + /** + * Displays the game messages when clicking on an item inside the Items Kept on Death interface + *
    + *
  • int (boolean) Item kept on death
  • + *
  • int Item Quantity
  • + *
  • String Item Name
  • + *
+ */ + public static final int DEATH_KEEP_ITEM_EXAMINE = 1603; + /** * Checks the state of the given stash unit. *
    diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index 63d2260be8..a91f295588 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -140,6 +140,7 @@ public class WidgetID public static final int BEGINNER_CLUE_MAP_NORTH_OF_FALADOR = 351; public static final int BEGINNER_CLUE_MAP_WIZARDS_TOWER = 356; public static final int SEED_BOX_GROUP_ID = 128; + public static final int ITEMS_KEPT_ON_DEATH_GROUP_ID = 4; static class WorldMap { @@ -806,4 +807,16 @@ public class WidgetID static final int ANSWER3_CONTAINER = 16; static final int ANSWER3 = 17; } + + static class KeptOnDeath + { + static final int KEPT_ITEMS_TEXT = 17; + static final int KEPT_ITEMS_CONTAINER = 18; + static final int LOST_ITEMS_TEXT = 20; + static final int LOST_ITEMS_CONTAINER = 21; + static final int LOST_ITEMS_VALUE = 23; + static final int INFORMATION_CONTAINER = 29; + static final int MAX_ITEMS_KEPT_ON_DEATH = 30; + static final int SAFE_ZONE_CONTAINER = 31; + } } diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java index 78bb2832b4..6173fd2f83 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetInfo.java @@ -482,7 +482,16 @@ public enum WidgetInfo QUESTLIST_MEMBERS_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.MEMBERS_CONTAINER), QUESTLIST_MINIQUEST_CONTAINER(WidgetID.QUESTLIST_GROUP_ID, WidgetID.QuestList.MINIQUEST_CONTAINER), - QUESTTAB_QUEST_TAB(WidgetID.QUESTTAB_GROUP_ID, WidgetID.QuestTab.QUEST_TAB); + QUESTTAB_QUEST_TAB(WidgetID.QUESTTAB_GROUP_ID, WidgetID.QuestTab.QUEST_TAB), + + ITEMS_KEPT_ON_DEATH_TEXT(WidgetID.ITEMS_KEPT_ON_DEATH_GROUP_ID, WidgetID.KeptOnDeath.KEPT_ITEMS_TEXT), + ITEMS_KEPT_ON_DEATH_CONTAINER(WidgetID.ITEMS_KEPT_ON_DEATH_GROUP_ID, WidgetID.KeptOnDeath.KEPT_ITEMS_CONTAINER), + ITEMS_LOST_ON_DEATH_TEXT(WidgetID.ITEMS_KEPT_ON_DEATH_GROUP_ID, WidgetID.KeptOnDeath.LOST_ITEMS_TEXT), + ITEMS_LOST_ON_DEATH_CONTAINER(WidgetID.ITEMS_KEPT_ON_DEATH_GROUP_ID, WidgetID.KeptOnDeath.LOST_ITEMS_CONTAINER), + ITEMS_KEPT_INFORMATION_CONTAINER(WidgetID.ITEMS_KEPT_ON_DEATH_GROUP_ID, WidgetID.KeptOnDeath.INFORMATION_CONTAINER), + ITEMS_KEPT_SAFE_ZONE_CONTAINER(WidgetID.ITEMS_KEPT_ON_DEATH_GROUP_ID, WidgetID.KeptOnDeath.SAFE_ZONE_CONTAINER), + ITEMS_LOST_VALUE(WidgetID.ITEMS_KEPT_ON_DEATH_GROUP_ID, WidgetID.KeptOnDeath.LOST_ITEMS_VALUE), + ITEMS_KEPT_MAX(WidgetID.ITEMS_KEPT_ON_DEATH_GROUP_ID, WidgetID.KeptOnDeath.MAX_ITEMS_KEPT_ON_DEATH); private final int groupId; private final int childId; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/AlwaysLostItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/AlwaysLostItem.java new file mode 100644 index 0000000000..37066622bc --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/AlwaysLostItem.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2018, TheStonedTurtle + * 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.itemskeptondeath; + +import com.google.common.collect.ImmutableMap; +import lombok.AllArgsConstructor; +import lombok.Getter; +import net.runelite.api.ItemID; + +/** + * Certain Items receive a white outline by Jagex as they are always lost on death. This is sometimes incorrectly + * added to Items by Jagex as the item is actually kept in non-pvp areas of the game, such as the Rune Pouch. + * + * The white outline will be added to these items when they are lost on death. + */ +@AllArgsConstructor +@Getter +enum AlwaysLostItem +{ + RUNE_POUCH(ItemID.RUNE_POUCH, true), + LOOTING_BAG(ItemID.LOOTING_BAG, false), + CLUE_BOX(ItemID.CLUE_BOX, false); + + private final int itemID; + private final boolean keptOutsideOfWilderness; + + private static final ImmutableMap ID_MAP; + + static + { + final ImmutableMap.Builder map = ImmutableMap.builder(); + for (final AlwaysLostItem p : values()) + { + map.put(p.itemID, p); + } + ID_MAP = map.build(); + } + + static AlwaysLostItem getByItemID(final int itemID) + { + return ID_MAP.get(itemID); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/BrokenOnDeathItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/BrokenOnDeathItem.java new file mode 100644 index 0000000000..9f1fd5c95e --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/BrokenOnDeathItem.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2018, TheStonedTurtle + * 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.itemskeptondeath; + +import com.google.common.collect.ImmutableSet; +import lombok.AllArgsConstructor; +import net.runelite.api.ItemID; + +/** + * Some non tradeable items are kept on death inside low level wilderness (1-20) but are turned into a broken variant. + * + * The non-broken variant will be shown inside the interface. + */ +@AllArgsConstructor +enum BrokenOnDeathItem +{ + // Capes + FIRE_CAPE(ItemID.FIRE_CAPE), + FIRE_MAX_CAPE(ItemID.FIRE_MAX_CAPE), + INFERNAL_CAPE(ItemID.INFERNAL_CAPE), + INFERNAL_MAX_CAPE(ItemID.INFERNAL_MAX_CAPE), + AVAS_ASSEMBLER(ItemID.AVAS_ASSEMBLER), + ASSEMBLER_MAX_CAPE(ItemID.ASSEMBLER_MAX_CAPE), + + // Defenders + BRONZE_DEFENDER(ItemID.BRONZE_DEFENDER), + IRON_DEFENDER(ItemID.IRON_DEFENDER), + STEEL_DEFENDER(ItemID.STEEL_DEFENDER), + BLACK_DEFENDER(ItemID.BLACK_DEFENDER), + MITHRIL_DEFENDER(ItemID.MITHRIL_DEFENDER), + ADAMANT_DEFENDER(ItemID.ADAMANT_DEFENDER), + RUNE_DEFENDER(ItemID.RUNE_DEFENDER), + DRAGON_DEFENDER(ItemID.DRAGON_DEFENDER), + AVERNIC_DEFENDER(ItemID.AVERNIC_DEFENDER), + + // Void + VOID_MAGE_HELM(ItemID.VOID_MAGE_HELM), + VOID_RANGER_HELM(ItemID.VOID_RANGER_HELM), + VOID_MELEE_HELM(ItemID.VOID_MELEE_HELM), + VOID_KNIGHT_TOP(ItemID.VOID_KNIGHT_TOP), + VOID_KNIGHT_ROBE(ItemID.VOID_KNIGHT_ROBE), + VOID_KNIGHT_GLOVES(ItemID.VOID_KNIGHT_GLOVES), + VOID_KNIGHT_MACE(ItemID.VOID_KNIGHT_MACE), + ELITE_VOID_TOP(ItemID.ELITE_VOID_TOP), + ELITE_VOID_ROBE(ItemID.ELITE_VOID_ROBE), + + // Barb Assault + FIGHTER_HAT(ItemID.FIGHTER_HAT), + RANGER_HAT(ItemID.RANGER_HAT), + HEALER_HAT(ItemID.HEALER_HAT), + FIGHTER_TORSO(ItemID.FIGHTER_TORSO), + PENANCE_SKIRT(ItemID.PENANCE_SKIRT), + + // Castle Wars + SARADOMIN_HALO(ItemID.SARADOMIN_HALO), + ZAMORAK_HALO(ItemID.ZAMORAK_HALO), + GUTHIX_HALO(ItemID.GUTHIX_HALO), + DECORATIVE_MAGIC_HAT(ItemID.DECORATIVE_ARMOUR_11898), + DECORATIVE_MAGIC_ROBE_TOP(ItemID.DECORATIVE_ARMOUR_11896), + DECORATIVE_MAGIC_ROBE_LEGS(ItemID.DECORATIVE_ARMOUR_11897), + DECORATIVE_RANGE_TOP(ItemID.DECORATIVE_ARMOUR_11899), + DECORATIVE_RANGE_BOTTOM(ItemID.DECORATIVE_ARMOUR_11900), + DECORATIVE_RANGE_QUIVER(ItemID.DECORATIVE_ARMOUR_11901), + GOLD_DECORATIVE_HELM(ItemID.DECORATIVE_HELM_4511), + GOLD_DECORATIVE_BODY(ItemID.DECORATIVE_ARMOUR_4509), + GOLD_DECORATIVE_LEGS(ItemID.DECORATIVE_ARMOUR_4510), + GOLD_DECORATIVE_SKIRT(ItemID.DECORATIVE_ARMOUR_11895), + GOLD_DECORATIVE_SHIELD(ItemID.DECORATIVE_SHIELD_4512), + GOLD_DECORATIVE_SWORD(ItemID.DECORATIVE_SWORD_4508); + + private final int itemID; + + private static final ImmutableSet ID_SET; + + static + { + final ImmutableSet.Builder set = new ImmutableSet.Builder<>(); + for (final BrokenOnDeathItem p : values()) + { + set.add(p.itemID); + } + ID_SET = set.build(); + } + + static boolean isBrokenOnDeath(final int itemID) + { + return ID_SET.contains(itemID); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/FixedPriceItem.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/FixedPriceItem.java new file mode 100644 index 0000000000..a40851dc65 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/FixedPriceItem.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2019, Adam + * Copyright (c) 2019, TheStonedTurtle + * 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.itemskeptondeath; + +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import javax.annotation.Nullable; +import lombok.AllArgsConstructor; +import lombok.Getter; +import net.runelite.api.ItemID; + +/** + * Some items have a fixed price that is added to its default value when calculating death prices. + * These are typically imbued items, such as Berserker ring (i), to help it protect over the non-imbued variants. + */ +@AllArgsConstructor +@Getter +enum FixedPriceItem +{ + IMBUED_BLACK_MASK_I(ItemID.BLACK_MASK_I, 5000), + IMBUED_BLACK_MASK_1_I(ItemID.BLACK_MASK_1_I, 5000), + IMBUED_BLACK_MASK_2_I(ItemID.BLACK_MASK_2_I, 5000), + IMBUED_BLACK_MASK_3_I(ItemID.BLACK_MASK_3_I, 5000), + IMBUED_BLACK_MASK_4_I(ItemID.BLACK_MASK_4_I, 5000), + IMBUED_BLACK_MASK_5_I(ItemID.BLACK_MASK_5_I, 5000), + IMBUED_BLACK_MASK_6_I(ItemID.BLACK_MASK_6_I, 5000), + IMBUED_BLACK_MASK_7_I(ItemID.BLACK_MASK_7_I, 5000), + IMBUED_BLACK_MASK_8_I(ItemID.BLACK_MASK_8_I, 5000), + IMBUED_BLACK_MASK_9_I(ItemID.BLACK_MASK_9_I, 5000), + IMBUED_BLACK_MASK_10_I(ItemID.BLACK_MASK_10_I, 5000), + + IMBUED_SLAYER_HELMET_I(ItemID.SLAYER_HELMET_I, 1000), + IMBUED_BLACK_SLAYER_HELMET_I(ItemID.BLACK_SLAYER_HELMET_I, 1000), + IMBUED_PURPLE_SLAYER_HELMET_I(ItemID.PURPLE_SLAYER_HELMET_I, 1000), + IMBUED_RED_SLAYER_HELMET_I(ItemID.RED_SLAYER_HELMET_I, 1000), + IMBUED_GREEN_SLAYER_HELMET_I(ItemID.GREEN_SLAYER_HELMET_I, 1000), + IMBUED_TURQUOISE_SLAYER_HELMET_I(ItemID.TURQUOISE_SLAYER_HELMET_I, 1000), + IMBUED_HYDRA_SLAYER_HELMET_I(ItemID.HYDRA_SLAYER_HELMET_I, 1000), + + IMBUED_ARCHERS_RING_I(ItemID.ARCHERS_RING_I, 2000), + IMBUED_BERSERKER_RING_I(ItemID.BERSERKER_RING_I, 2000), + IMBUED_SEERS_RING_I(ItemID.SEERS_RING_I, 2000), + + IMBUED_RING_OF_THE_GODS_I(ItemID.RING_OF_THE_GODS_I, 2000), + IMBUED_TREASONOUS_RING_I(ItemID.TREASONOUS_RING_I, 2000), + IMBUED_TYRANNICAL_RING_I(ItemID.TYRANNICAL_RING_I, 2000); + + private final int itemId; + private final int offset; + + private static final Map FIXED_ITEMS; + + static + { + final ImmutableMap.Builder map = ImmutableMap.builder(); + for (final FixedPriceItem p : values()) + { + map.put(p.itemId, p); + } + FIXED_ITEMS = map.build(); + } + + @Nullable + static FixedPriceItem find(int itemId) + { + return FIXED_ITEMS.get(itemId); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java new file mode 100644 index 0000000000..dd9a5403e5 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java @@ -0,0 +1,610 @@ +/* + * Copyright (c) 2018, TheStonedTurtle + * Copyright (c) 2019, Adam + * 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.itemskeptondeath; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.EnumSet; +import java.util.List; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import javax.inject.Inject; +import lombok.extern.slf4j.Slf4j; +import net.runelite.api.Client; +import net.runelite.api.Constants; +import net.runelite.api.FontID; +import net.runelite.api.InventoryID; +import net.runelite.api.Item; +import net.runelite.api.ItemComposition; +import net.runelite.api.ItemContainer; +import net.runelite.api.ItemID; +import net.runelite.api.ScriptID; +import net.runelite.api.SkullIcon; +import net.runelite.api.SpriteID; +import net.runelite.api.Varbits; +import net.runelite.api.WorldType; +import net.runelite.api.events.ScriptCallbackEvent; +import net.runelite.api.vars.AccountType; +import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetInfo; +import net.runelite.api.widgets.WidgetType; +import net.runelite.client.eventbus.Subscribe; +import net.runelite.client.game.ItemManager; +import net.runelite.client.plugins.Plugin; +import net.runelite.client.plugins.PluginDescriptor; +import net.runelite.client.util.StackFormatter; + +@PluginDescriptor( + name = "Items Kept on Death", + description = "Updates the Items Kept on Death interface to be more accurate", + enabledByDefault = false +) +@Slf4j +public class ItemsKeptOnDeathPlugin extends Plugin +{ + private static final int DEEP_WILDY = 20; + private static final Pattern WILDERNESS_LEVEL_PATTERN = Pattern.compile("^Level: (\\d+).*"); + + // Item Container helpers + private static final int MAX_ROW_ITEMS = 8; + private static final int ITEM_X_OFFSET = 5; + private static final int ITEM_Y_OFFSET = 25; + private static final int ITEM_X_STRIDE = 38; + private static final int ITEM_Y_STRIDE = 38; + private static final int ORIGINAL_LOST_HEIGHT = 209; + private static final int ORIGINAL_LOST_Y = 107; + + // Information panel text helpers + private static final String LINE_BREAK = "
    "; + private static final int INFORMATION_CONTAINER_HEIGHT = 183; + private static final int FONT_COLOR = 0xFF981F; + + // Button Images + private static final int PROTECT_ITEM_SPRITE_ID = SpriteID.PRAYER_PROTECT_ITEM; + private static final int SKULL_SPRITE_ID = SpriteID.PLAYER_KILLER_SKULL_523; + private static final int SWORD_SPRITE_ID = SpriteID.MULTI_COMBAT_ZONE_CROSSED_SWORDS; + private static final int SKULL_2_SPRITE_ID = SpriteID.FIGHT_PITS_WINNER_SKULL_RED; + + @Inject + private Client client; + + @Inject + private ItemManager itemManager; + + private WidgetButton deepWildyButton; + private WidgetButton lowWildyButton; + + private boolean isSkulled; + private boolean protectingItem; + private int wildyLevel; + + @Subscribe + public void onScriptCallbackEvent(ScriptCallbackEvent event) + { + if (event.getEventName().equals("itemsKeptOnDeath")) + { + // The script in charge of building the Items Kept on Death interface has finished running. + // Make all necessary changes now. + + // Players inside Safe Areas (POH/Clan Wars) or playing DMM see the default interface + if (isInSafeArea() || client.getWorldType().contains(WorldType.DEADMAN)) + { + return; + } + + syncSettings(); + createWidgetButtons(); + rebuildItemsKeptOnDeathInterface(); + + final Widget keptText = client.getWidget(WidgetInfo.ITEMS_KEPT_ON_DEATH_TEXT); + keptText.setText("Items you will keep on death:"); + + final Widget lostText = client.getWidget(WidgetInfo.ITEMS_LOST_ON_DEATH_TEXT); + lostText.setText("Items you will lose on death:"); + } + } + + // Sync user settings + private void syncSettings() + { + final SkullIcon s = client.getLocalPlayer().getSkullIcon(); + // Ultimate iron men deaths are treated like they are always skulled + isSkulled = s == SkullIcon.SKULL || isUltimateIronman(); + protectingItem = client.getVar(Varbits.PRAYER_PROTECT_ITEM) == 1; + syncWildernessLevel(); + } + + private void syncWildernessLevel() + { + if (client.getVar(Varbits.IN_WILDERNESS) != 1) + { + // if they are in a PvP world and not in a safe zone act like in lvl 1 wildy + if (isInPvpWorld() && !isInPvPSafeZone()) + { + wildyLevel = 1; + return; + } + wildyLevel = -1; + return; + } + + final Widget wildernessLevelWidget = client.getWidget(WidgetInfo.PVP_WILDERNESS_LEVEL); + if (wildernessLevelWidget == null) + { + wildyLevel = -1; + return; + } + + final String wildernessLevelText = wildernessLevelWidget.getText(); + final Matcher m = WILDERNESS_LEVEL_PATTERN.matcher(wildernessLevelText); + if (!m.matches()) + { + wildyLevel = -1; + return; + } + + wildyLevel = Integer.parseInt(m.group(1)); + } + + private boolean isInPvpWorld() + { + final EnumSet world = client.getWorldType(); + return world.contains(WorldType.PVP); + } + + private boolean isProtectItemAllowed() + { + return !client.getWorldType().contains(WorldType.HIGH_RISK) + && !isUltimateIronman(); + } + + private boolean isInPvPSafeZone() + { + final Widget w = client.getWidget(WidgetInfo.PVP_WORLD_SAFE_ZONE); + return w != null && !w.isHidden(); + } + + private boolean isInSafeArea() + { + final Widget w = client.getWidget(WidgetInfo.ITEMS_KEPT_SAFE_ZONE_CONTAINER); + return w != null && !w.isHidden(); + } + + private boolean isUltimateIronman() + { + return client.getAccountType() == AccountType.ULTIMATE_IRONMAN; + } + + private int getDefaultItemsKept() + { + final int count = isSkulled ? 0 : 3; + return count + (protectingItem ? 1 : 0); + } + + private void rebuildItemsKeptOnDeathInterface() + { + final Widget lost = client.getWidget(WidgetInfo.ITEMS_LOST_ON_DEATH_CONTAINER); + final Widget kept = client.getWidget(WidgetInfo.ITEMS_KEPT_ON_DEATH_CONTAINER); + if (lost == null || kept == null) + { + return; + } + + lost.deleteAllChildren(); + kept.deleteAllChildren(); + + // Grab all items on player + final ItemContainer inventory = client.getItemContainer(InventoryID.INVENTORY); + final Item[] inv = inventory == null ? new Item[0] : inventory.getItems(); + final ItemContainer equipment = client.getItemContainer(InventoryID.EQUIPMENT); + final Item[] equip = equipment == null ? new Item[0] : equipment.getItems(); + + final List items = new ArrayList<>(); + Collections.addAll(items, inv); + Collections.addAll(items, equip); + + // Sort by item price + items.sort(Comparator.comparing(this::getDeathPrice).reversed()); + + boolean hasAlwaysLost = false; + int keepCount = getDefaultItemsKept(); + + final List keptItems = new ArrayList<>(); + final List lostItems = new ArrayList<>(); + for (final Item i : items) + { + final int id = i.getId(); + int itemQuantity = i.getQuantity(); + + if (id == -1) + { + continue; + } + + final ItemComposition c = itemManager.getItemComposition(i.getId()); + + // Bonds are always kept and do not count towards the limit. + if (id == ItemID.OLD_SCHOOL_BOND || id == ItemID.OLD_SCHOOL_BOND_UNTRADEABLE) + { + final Widget itemWidget = createItemWidget(kept, itemQuantity, c); + itemWidget.setOnOpListener(ScriptID.DEATH_KEEP_ITEM_EXAMINE, 1, itemQuantity, c.getName()); + keptItems.add(itemWidget); + continue; + } + + // Certain items are always lost on death and have a white outline which we need to add + final AlwaysLostItem alwaysLostItem = AlwaysLostItem.getByItemID(i.getId()); + if (alwaysLostItem != null) + { + // Some of these items are kept on death (outside wildy), like the Rune pouch. Ignore them + if (!alwaysLostItem.isKeptOutsideOfWilderness() || wildyLevel > 0) + { + final Widget itemWidget = createItemWidget(lost, itemQuantity, c); + itemWidget.setOnOpListener(ScriptID.DEATH_KEEP_ITEM_EXAMINE, 0, itemQuantity, c.getName()); + itemWidget.setBorderType(2); // white outline + lostItems.add(itemWidget); + hasAlwaysLost = true; + continue; + } + // the rune pouch is "always lost" but its kept outside of pvp, and does not count towards your keep count + } + else if (keepCount > 0) + { + // Keep most valuable items regardless of trade-ability. + if (i.getQuantity() > keepCount) + { + final Widget itemWidget = createItemWidget(kept, keepCount, c); + itemWidget.setOnOpListener(ScriptID.DEATH_KEEP_ITEM_EXAMINE, 1, keepCount, c.getName()); + keptItems.add(itemWidget); + itemQuantity -= keepCount; + keepCount = 0; + // Fall through to below to drop the rest of the stack + } + else + { + final Widget itemWidget = createItemWidget(kept, itemQuantity, c); + itemWidget.setOnOpListener(ScriptID.DEATH_KEEP_ITEM_EXAMINE, 1, itemQuantity, c.getName()); + keptItems.add(itemWidget); + keepCount -= i.getQuantity(); + continue; + } + } + + // Items are kept if: + // 1) is not tradeable + // 2) is under the deep wilderness line + // 3) is outside of the wilderness, or item has a broken form + if (!Pets.isPet(id) + && !isTradeable(c) && wildyLevel <= DEEP_WILDY + && (wildyLevel <= 0 || BrokenOnDeathItem.isBrokenOnDeath(i.getId()))) + { + final Widget itemWidget = createItemWidget(kept, itemQuantity, c); + itemWidget.setOnOpListener(ScriptID.DEATH_KEEP_ITEM_EXAMINE, 1, itemQuantity, c.getName()); + keptItems.add(itemWidget); + } + else + { + // Otherwise, the item is lost + final Widget itemWidget = createItemWidget(lost, itemQuantity, c); + itemWidget.setOnOpListener(ScriptID.DEATH_KEEP_ITEM_EXAMINE, 0, itemQuantity, c.getName()); + lostItems.add(itemWidget); + } + } + + int rows = (keptItems.size() + MAX_ROW_ITEMS - 1) / MAX_ROW_ITEMS; + // Show an empty row if there isn't anything + if (rows > 0) + { + // ORIGINAL_LOST_Y/HEIGHT includes a row already + rows--; + } + // Adjust items lost container position if new rows were added to kept items container + lost.setOriginalY(ORIGINAL_LOST_Y + (rows * ITEM_Y_STRIDE)); + lost.setOriginalHeight(ORIGINAL_LOST_HEIGHT - (rows * ITEM_Y_STRIDE)); + positionWidgetItems(kept, keptItems); + positionWidgetItems(lost, lostItems); + + updateKeptWidgetInfoText(hasAlwaysLost, keptItems, lostItems); + } + + /** + * Get the price of an item + * @param item + * @return + */ + private int getDeathPrice(Item item) + { + int itemId = item.getId(); + // Unnote/unplaceholder item + int canonicalizedItemId = itemManager.canonicalize(itemId); + int exchangePrice = itemManager.getItemPrice(canonicalizedItemId); + if (exchangePrice == 0) + { + final ItemComposition c1 = itemManager.getItemComposition(canonicalizedItemId); + exchangePrice = c1.getPrice(); + } + else + { + // Some items have artifically applied death prices - such as ring imbues + // which are +2k over the non imbues. Check if the item has a fixed price. + FixedPriceItem fixedPrice = FixedPriceItem.find(canonicalizedItemId); + if (fixedPrice != null) + { + // Apply fixed price offset + exchangePrice += fixedPrice.getOffset(); + } + } + return exchangePrice; + } + + /** + * Position a list of widget items in the parent container + */ + private static void positionWidgetItems(final Widget parent, final List widgets) + { + int startingIndex = 0; + for (final Widget w : widgets) + { + final int originalX = ITEM_X_OFFSET + ((startingIndex % MAX_ROW_ITEMS) * ITEM_X_STRIDE); + final int originalY = ITEM_Y_OFFSET + ((startingIndex / MAX_ROW_ITEMS) * ITEM_Y_STRIDE); + + w.setOriginalX(originalX); + w.setOriginalY(originalY); + w.revalidate(); + + ++startingIndex; + } + + parent.revalidate(); + } + + /** + * Creates the text to be displayed in the right side of the interface based on current selections + */ + private String getInfoText(final boolean hasAlwaysLost) + { + final StringBuilder sb = new StringBuilder(); + if (isUltimateIronman()) + { + sb.append("You are an UIM which means 0 items are protected by default"); + } + else + { + sb.append("3 items protected by default"); + + if (isSkulled) + { + sb.append(LINE_BREAK) + .append("PK skull -3"); + } + + if (protectingItem) + { + sb.append(LINE_BREAK) + .append("Protect Item prayer +1"); + } + + sb.append(LINE_BREAK) + .append(String.format("Actually protecting %s items", getDefaultItemsKept())); + } + + + if (wildyLevel < 1) + { + sb.append(LINE_BREAK) + .append(LINE_BREAK) + .append("You will have 1 hour to retrieve your lost items."); + } + + if (hasAlwaysLost) + { + sb.append(LINE_BREAK) + .append(LINE_BREAK) + .append("Items with a white outline will always be lost."); + } + + sb.append(LINE_BREAK) + .append(LINE_BREAK) + .append("Untradeable items are kept on death in non-pvp scenarios."); + + return sb.toString(); + } + + /** + * Updates the information panel based on the item containers + */ + private void updateKeptWidgetInfoText(final boolean hasAlwaysLost, final List keptItems, final List lostItems) + { + // Add Information text widget + final Widget textWidget = findOrCreateInfoText(); + textWidget.setText(getInfoText(hasAlwaysLost)); + textWidget.revalidate(); + + // Update Items lost total value + long total = 0; + for (final Widget w : lostItems) + { + int cid = itemManager.canonicalize(w.getItemId()); + int price = itemManager.getItemPrice(cid); + if (price == 0) + { + // Default to alch price + price = (int) (itemManager.getItemComposition(cid).getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER); + } + total += (long) price * w.getItemQuantity(); + } + final Widget lostValue = client.getWidget(WidgetInfo.ITEMS_LOST_VALUE); + lostValue.setText(StackFormatter.quantityToStackSize(total) + " gp"); + + // Update Max items kept + final Widget max = client.getWidget(WidgetInfo.ITEMS_KEPT_MAX); + final int keptQty = keptItems.stream().mapToInt(Widget::getItemQuantity).sum(); + max.setText(String.format("Max items kept on death:

    ~ %d ~", keptQty)); + } + + /** + * Check if an item is tradeable to another player + * + * @param c The item + * @return + */ + private static boolean isTradeable(final ItemComposition c) + { + // ItemComposition:: isTradeable checks if they are traded on the grand exchange, some items are trade-able but not via GE + if (c.getNote() != -1 + || c.getLinkedNoteId() != -1 + || c.isTradeable()) + { + return true; + } + + final int id = c.getId(); + switch (id) + { + case ItemID.COINS_995: + case ItemID.PLATINUM_TOKEN: + return true; + default: + return false; + } + } + + private Widget findOrCreateInfoText() + { + // The text was on the ITEMS_KEPT_INFORMATION_CONTAINER widget - but now that it is a layer, + // we need to create a child widget to hold the text + final Widget parent = client.getWidget(WidgetInfo.ITEMS_KEPT_INFORMATION_CONTAINER); + + // Use the text TEXT widget if it already exists. It should be the last child of the parent + final Widget[] children = parent.getChildren(); + if (children != null && children.length > 0) + { + final Widget w = parent.getChild(children.length - 1); + if (w != null && w.getType() == WidgetType.TEXT) + { + log.debug("Reusing old text widget"); + return w; + } + } + + log.debug("Creating new text widget"); + + final Widget w = parent.createChild(-1, WidgetType.TEXT); + // Position under buttons taking remaining space + w.setOriginalWidth(parent.getOriginalWidth()); + w.setOriginalHeight(INFORMATION_CONTAINER_HEIGHT - parent.getOriginalHeight()); + w.setOriginalY(parent.getOriginalHeight()); + + w.setFontId(FontID.PLAIN_11); + w.setTextShadowed(true); + w.setTextColor(FONT_COLOR); + + // Need to adjust parent height so text is visible + parent.setOriginalHeight(INFORMATION_CONTAINER_HEIGHT); + parent.revalidate(); + + return w; + } + + private void createWidgetButtons() + { + final Widget parent = client.getWidget(WidgetInfo.ITEMS_KEPT_INFORMATION_CONTAINER); + // Change the information container from a text widget to a layer + parent.setType(WidgetType.LAYER); + parent.deleteAllChildren(); + + // Ultimate Iron men are always skulled and can't use the protect item prayer + WidgetButton protectItemButton = isProtectItemAllowed() + ? new WidgetButton(parent, "Protect Item Prayer", PROTECT_ITEM_SPRITE_ID, protectingItem, selected -> + { + protectingItem = selected; + rebuildItemsKeptOnDeathInterface(); + }) : null; + + WidgetButton skulledButton = !isUltimateIronman() + ? new WidgetButton(parent, "Skulled", SKULL_SPRITE_ID, isSkulled, selected -> + { + isSkulled = selected; + rebuildItemsKeptOnDeathInterface(); + }) : null; + + lowWildyButton = new WidgetButton(parent, "Low Wildy (1-20)", SWORD_SPRITE_ID, wildyLevel > 0 && wildyLevel <= DEEP_WILDY, selected -> + { + if (!selected) + { + syncWildernessLevel(); + } + else + { + wildyLevel = 1; + deepWildyButton.setSelected(false); + } + + rebuildItemsKeptOnDeathInterface(); + }); + + deepWildyButton = new WidgetButton(parent, "Deep Wildy (21+)", SKULL_2_SPRITE_ID, wildyLevel > DEEP_WILDY, selected -> + { + if (!selected) + { + syncWildernessLevel(); + } + else + { + wildyLevel = DEEP_WILDY + 1; + lowWildyButton.setSelected(false); + } + + rebuildItemsKeptOnDeathInterface(); + }); + + parent.revalidate(); + WidgetButton.layoutButtonsToContainer(parent, protectItemButton, skulledButton, lowWildyButton, deepWildyButton); + } + + /** + * Creates an Item Widget for use inside the Kept on Death Interface + * + * @param qty Amount of item + * @param c Items Composition + * @return + */ + private static Widget createItemWidget(final Widget parent, final int qty, final ItemComposition c) + { + final Widget itemWidget = parent.createChild(-1, WidgetType.GRAPHIC); + itemWidget.setItemId(c.getId()); + itemWidget.setItemQuantity(qty); + itemWidget.setHasListener(true); + itemWidget.setOriginalWidth(Constants.ITEM_SPRITE_WIDTH); + itemWidget.setOriginalHeight(Constants.ITEM_SPRITE_HEIGHT); + itemWidget.setBorderType(1); + + itemWidget.setAction(1, String.format("Item: %s", c.getName())); + + return itemWidget; + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/Pets.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/Pets.java new file mode 100644 index 0000000000..de2b0edcb7 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/Pets.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2018 Abex + * 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.itemskeptondeath; + +import com.google.common.collect.ImmutableSet; +import java.util.Set; +import static net.runelite.api.ItemID.*; + +final class Pets +{ + private Pets() + { + } + + private static final Set PETS = ImmutableSet.of( + BABY_MOLE, + PRINCE_BLACK_DRAGON, + PET_CORPOREAL_CRITTER, PET_DARK_CORE, + JALNIBREK, TZREKZUK, + KALPHITE_PRINCESS, KALPHITE_PRINCESS_12654, + LIL_ZIK, + SKOTOS, + PET_SNAKELING, PET_SNAKELING_12939, PET_SNAKELING_12940, + TZREKJAD, + VORKI, + + OLMLET, PUPPADILE, TEKTINY, VANGUARD, VASA_MINIRIO, VESPINA, + + PET_DAGANNOTH_PRIME, PET_DAGANNOTH_REX, PET_DAGANNOTH_SUPREME, + + PET_GENERAL_GRAARDOR, PET_KRIL_TSUTSAROTH, PET_KREEARRA, PET_ZILYANA, + + ABYSSAL_ORPHAN, + HELLPUPPY, + PET_KRAKEN, + MIDNIGHT, NOON, + PET_SMOKE_DEVIL, PET_SMOKE_DEVIL_22663, + IKKLE_HYDRA, IKKLE_HYDRA_22748, IKKLE_HYDRA_22750, IKKLE_HYDRA_22752, + + CALLISTO_CUB, + PET_CHAOS_ELEMENTAL, + SCORPIAS_OFFSPRING, + VENENATIS_SPIDERLING, + VETION_JR, VETION_JR_13180, + + BABY_CHINCHOMPA, BABY_CHINCHOMPA_13324, BABY_CHINCHOMPA_13325, BABY_CHINCHOMPA_13326, + BEAVER, + GIANT_SQUIRREL, + HERON, + RIFT_GUARDIAN, RIFT_GUARDIAN_20667, RIFT_GUARDIAN_20669, RIFT_GUARDIAN_20671, RIFT_GUARDIAN_20673, RIFT_GUARDIAN_20675, + RIFT_GUARDIAN_20677, RIFT_GUARDIAN_20679, RIFT_GUARDIAN_20681, RIFT_GUARDIAN_20683, RIFT_GUARDIAN_20685, RIFT_GUARDIAN_20687, + RIFT_GUARDIAN_20689, RIFT_GUARDIAN_20691, RIFT_GUARDIAN_21990, + ROCK_GOLEM, ROCK_GOLEM_21187, ROCK_GOLEM_21188, ROCK_GOLEM_21189, ROCK_GOLEM_21190, ROCK_GOLEM_21191, ROCK_GOLEM_21192, + ROCK_GOLEM_21193, ROCK_GOLEM_21194, ROCK_GOLEM_21195, ROCK_GOLEM_21196, ROCK_GOLEM_21197, ROCK_GOLEM_21340, ROCK_GOLEM_21358, + ROCK_GOLEM_21359, ROCK_GOLEM_21360, + ROCKY, + TANGLEROOT, + + PET_KITTEN, PET_KITTEN_1556, PET_KITTEN_1557, PET_KITTEN_1558, PET_KITTEN_1559, PET_KITTEN_1560, + PET_CAT, PET_CAT_1562, PET_CAT_1563, PET_CAT_1564, PET_CAT_1565, PET_CAT_1566, PET_CAT_1567, PET_CAT_1568, PET_CAT_1569, + PET_CAT_1570, PET_CAT_1571, PET_CAT_1572, + LAZY_CAT, LAZY_CAT_6550, LAZY_CAT_6551, LAZY_CAT_6552, LAZY_CAT_6553, LAZY_CAT_6554, + WILY_CAT, WILY_CAT_6556, WILY_CAT_6557, WILY_CAT_6558, WILY_CAT_6559, WILY_CAT_6560, + OVERGROWN_HELLCAT, HELL_CAT, HELLKITTEN, LAZY_HELL_CAT, WILY_HELLCAT, + + BLOODHOUND, + CHOMPY_CHICK, + HERBI, + PET_PENANCE_QUEEN, + PHOENIX + ); + + public static boolean isPet(int id) + { + return PETS.contains(id); + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/WidgetButton.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/WidgetButton.java new file mode 100644 index 0000000000..93cb27e41c --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/WidgetButton.java @@ -0,0 +1,163 @@ +/* + * Copyright (c) 2018, TheStonedTurtle + * 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.itemskeptondeath; + +import net.runelite.api.ScriptEvent; +import net.runelite.api.SpriteID; +import net.runelite.api.widgets.JavaScriptCallback; +import net.runelite.api.widgets.Widget; +import net.runelite.api.widgets.WidgetType; + +class WidgetButton +{ + private static final int ICON_HEIGHT = 26; + private static final int ICON_WIDTH = 26; + private static final int BACKGROUND_HEIGHT = 32; + private static final int BACKGROUND_WIDTH = 32; + private static final int PADDING = 5; + private static final int ICON_PADDING = (BACKGROUND_HEIGHT - ICON_HEIGHT) / 2; + + private static final int BACKGROUND_SPRITE_ID = SpriteID.EQUIPMENT_SLOT_TILE; + private static final int SELECTED_BACKGROUND_SPRITE_ID = SpriteID.EQUIPMENT_SLOT_SELECTED; + + @FunctionalInterface + public interface WidgetButtonCallback + { + void run(boolean newState); + } + + private final Widget parent; + private final String name; + private final int spriteID; + private boolean selected; + private final WidgetButtonCallback callback; + + private Widget icon; + private Widget background; + + WidgetButton( + final Widget parent, + final String name, + final int spriteID, + final boolean selectedStartState, + final WidgetButtonCallback callback) + { + this.parent = parent; + this.name = name; + this.spriteID = spriteID; + this.selected = selectedStartState; + this.callback = callback; + createBackgroundWidget(); + createIconWidget(); + } + + private void createBackgroundWidget() + { + background = createWidget(); + background.setOriginalWidth(BACKGROUND_WIDTH); + background.setOriginalHeight(BACKGROUND_HEIGHT); + syncBackgroundSprite(); + } + + private void createIconWidget() + { + icon = createWidget(); + icon.setAction(1, "Toggle:"); + icon.setOnOpListener((JavaScriptCallback) this::onButtonClicked); + icon.setOnMouseRepeatListener((JavaScriptCallback) e -> e.getSource().setOpacity(120)); + icon.setOnMouseLeaveListener((JavaScriptCallback) e -> e.getSource().setOpacity(0)); + icon.setHasListener(true); + icon.setSpriteId(spriteID); + } + + private Widget createWidget() + { + final Widget w = parent.createChild(-1, WidgetType.GRAPHIC); + w.setOriginalWidth(ICON_WIDTH); + w.setOriginalHeight(ICON_HEIGHT); + w.setName("" + this.name); + return w; + } + + public void setSelected(boolean selected) + { + this.selected = selected; + syncBackgroundSprite(); + } + + private void syncBackgroundSprite() + { + background.setSpriteId(selected ? SELECTED_BACKGROUND_SPRITE_ID : BACKGROUND_SPRITE_ID); + } + + /** + * Adds the collection of WidgetButtons to the container overriding any existing children. + * + * @param container Widget to add buttons too + * @param buttons buttons to add + */ + static void layoutButtonsToContainer(final Widget container, final WidgetButton... buttons) + { + // Each button has two widgets, Icon and Background + final int xIncrement = BACKGROUND_WIDTH + PADDING; + final int yIncrement = BACKGROUND_HEIGHT + PADDING; + int maxRowItems = container.getWidth() / xIncrement; + // Ensure at least 1 button per row + maxRowItems = maxRowItems < 1 ? 1 : maxRowItems; + + int index = 0; + for (final WidgetButton w : buttons) + { + if (w == null) + { + continue; + } + + final int originalX = ((index % maxRowItems) * xIncrement); + final int originalY = ((index / maxRowItems) * yIncrement); + w.background.setOriginalX(originalX); + w.background.setOriginalY(originalY); + w.background.revalidate(); + + // Icon must be padded to center inside image + w.icon.setOriginalX(originalX + ICON_PADDING); + w.icon.setOriginalY(originalY + ICON_PADDING); + w.icon.revalidate(); + + index++; + } + + final int numButtons = index; + final int rows = 1 + (numButtons > maxRowItems ? numButtons / maxRowItems : 0); + container.setOriginalHeight(yIncrement * rows); + container.revalidate(); + } + + private void onButtonClicked(ScriptEvent scriptEvent) + { + setSelected(!selected); + callback.run(selected); + } +} diff --git a/runelite-client/src/main/scripts/DeathkeepBuild.hash b/runelite-client/src/main/scripts/DeathkeepBuild.hash new file mode 100644 index 0000000000..18f92dce5c --- /dev/null +++ b/runelite-client/src/main/scripts/DeathkeepBuild.hash @@ -0,0 +1 @@ +15F58F5939D9311F3D76FA2F0F3441B7B0DA1E8EAE23C654948095A7D51E07F0 \ No newline at end of file diff --git a/runelite-client/src/main/scripts/DeathkeepBuild.rs2asm b/runelite-client/src/main/scripts/DeathkeepBuild.rs2asm new file mode 100644 index 0000000000..75ade43db2 --- /dev/null +++ b/runelite-client/src/main/scripts/DeathkeepBuild.rs2asm @@ -0,0 +1,634 @@ +.id 1601 +.int_stack_count 4 +.string_stack_count 2 +.int_var_count 14 +.string_var_count 3 +; callback "itemsKeptOnDeath" +; Used by the ItemsKepthOnDeath plugin to edit the interface +; Put a rune pouch in your inventory and it shouldn't have a white outline +; in the Items kept on death screen + sload 1 + iconst 262167 + if_settext + iconst 0 + istore 4 + iconst 0 + istore 5 + iconst -1 + istore 6 + iconst 0 + istore 7 + sconst "" + sstore 2 + iconst 0 + istore 8 + iconst 0 + istore 9 + iconst 0 + istore 10 + iconst 0 + istore 11 + iload 1 + define_array 111 + iconst 0 + istore 12 + iconst 0 + istore 13 + iload 0 + iconst 0 + if_icmpeq LABEL31 + jump LABEL525 +LABEL31: + iconst 93 + iconst 13190 + inv_total + iconst 0 + if_icmpgt LABEL42 + iconst 93 + iconst 13192 + inv_total + iconst 0 + if_icmpgt LABEL42 + jump LABEL44 +LABEL42: + iconst 1 + istore 9 +LABEL44: + iload 10 + iload 1 + if_icmplt LABEL48 + jump LABEL88 +LABEL48: + iconst 584 + iload 11 + inv_getobj + istore 6 + iload 6 + iconst -1 + if_icmpne LABEL56 + jump LABEL85 +LABEL56: + iconst 584 + iload 11 + inv_getnum + istore 7 +LABEL60: + iload 10 + iload 1 + if_icmplt LABEL64 + jump LABEL80 +LABEL64: + iload 7 + iconst 0 + if_icmpgt LABEL68 + jump LABEL80 +LABEL68: + iload 10 + iload 6 + set_array_int + iload 7 + iconst 1 + sub + istore 7 + iload 10 + iconst 1 + add + istore 10 + jump LABEL60 +LABEL80: + iload 11 + iconst 1 + add + istore 11 + jump LABEL87 +LABEL85: + iload 1 + istore 10 +LABEL87: + jump LABEL44 +LABEL88: + iload 4 + iload 1 + if_icmplt LABEL92 + jump LABEL147 +LABEL92: + iconst 262162 + iconst 5 + iload 4 + cc_create + iconst 36 + iconst 32 + iconst 0 + iconst 0 + cc_setsize + iconst 5 + iload 4 + iconst 40 + multiply + add + iconst 25 + iconst 0 + iconst 0 + cc_setposition + iload 4 + get_array_int + istore 6 + iload 6 + iconst -1 + if_icmpne LABEL117 + jump LABEL144 +LABEL117: + iload 6 + iconst 1 + cc_setobject + sconst "" + iload 6 + oc_name + join_string 2 + cc_setopbase + iconst 1 + sconst "Item:" + cc_setop + iconst 1603 + iconst 1 + iconst 1 + iload 6 + oc_name + sconst "1is" + cc_setonop + iconst 1118481 + cc_setgraphicshadow + iconst 1 + cc_setoutline + iload 4 + iconst 1 + add + istore 4 + jump LABEL146 +LABEL144: + iload 1 + istore 4 +LABEL146: + jump LABEL88 +LABEL147: + iconst 0 + istore 4 +LABEL149: + iload 4 + iconst 468 + inv_size + if_icmplt LABEL154 + jump LABEL350 +LABEL154: + iconst 468 + iload 4 + inv_getobj + istore 6 + iload 6 + iconst -1 + if_icmpne LABEL162 + jump LABEL345 +LABEL162: + iconst 262165 + iconst 5 + iload 5 + cc_create + iconst 36 + iconst 32 + iconst 0 + iconst 0 + cc_setsize + iconst 5 + iload 5 + iconst 8 + mod + iconst 38 + multiply + add + iconst 25 + iconst 38 + iload 5 + iconst 8 + div + multiply + add + iconst 0 + iconst 0 + cc_setposition + iload 6 + iconst 468 + iload 4 + inv_getnum + cc_setobject + sconst "" + iload 6 + oc_name + join_string 2 + cc_setopbase + iconst 1 + sconst "Item:" + cc_setop + iconst 1603 + iconst 0 + iconst 468 + iload 4 + inv_getnum + iload 6 + oc_name + sconst "1is" + cc_setonop + iconst 1118481 + cc_setgraphicshadow + iconst 111 + iconst 49 + iconst 879 + iload 6 + oc_uncert + enum + iconst 1 + if_icmpeq LABEL221 + jump LABEL226 +LABEL221: + iconst 2 + cc_setoutline + iconst 1 + istore 8 + jump LABEL228 +LABEL226: + iconst 1 + cc_setoutline +LABEL228: + iload 5 + iconst 1 + add + istore 5 + iload 6 + oc_stackable + iconst 1 + if_icmpeq LABEL237 + jump LABEL345 +LABEL237: + iconst 0 + istore 10 + iconst 0 + istore 13 +LABEL241: + iload 10 + iload 1 + if_icmplt LABEL245 + jump LABEL259 +LABEL245: + iload 10 + get_array_int + iload 6 + if_icmpeq LABEL250 + jump LABEL254 +LABEL250: + iload 13 + iconst 1 + add + istore 13 +LABEL254: + iload 10 + iconst 1 + add + istore 10 + jump LABEL241 +LABEL259: + iconst 2147483647 + iconst 94 + iload 6 + inv_total + sub + iconst 93 + iload 6 + inv_total + sub + iload 13 + add + istore 12 + iconst 0 + iload 12 + sub + istore 12 + iload 12 + iconst 0 + if_icmpgt LABEL279 + jump LABEL345 +LABEL279: + iconst 262165 + iconst 5 + iload 5 + cc_create + iconst 36 + iconst 32 + iconst 0 + iconst 0 + cc_setsize + iconst 5 + iload 5 + iconst 8 + mod + iconst 38 + multiply + add + iconst 25 + iconst 38 + iload 5 + iconst 8 + div + multiply + add + iconst 0 + iconst 0 + cc_setposition + iload 6 + iload 12 + cc_setobject + sconst "" + iload 6 + oc_name + join_string 2 + cc_setopbase + iconst 1 + sconst "Item:" + cc_setop + iconst 1603 + iconst 0 + iload 12 + iload 6 + oc_name + sconst "1is" + cc_setonop + iconst 1118481 + cc_setgraphicshadow + iconst 111 + iconst 49 + iconst 879 + iload 6 + oc_uncert + enum + iconst 1 + if_icmpeq LABEL334 + jump LABEL339 +LABEL334: + iconst 2 + cc_setoutline + iconst 1 + istore 8 + jump LABEL341 +LABEL339: + iconst 1 + cc_setoutline +LABEL341: + iload 5 + iconst 1 + add + istore 5 +LABEL345: + iload 4 + iconst 1 + add + istore 4 + jump LABEL149 +LABEL350: + sconst "The normal amount of items kept is " + sconst "three" + sconst "." + sconst "
    " + sconst "
    " + join_string 5 + sstore 2 + iload 3 + iconst 1 + if_icmpeq LABEL361 + jump LABEL371 +LABEL361: + sload 2 + sconst "You're an " + sconst "" + sconst "Ultimate Iron Man" + sconst "" + sconst ", so you will always keep zero items." + join_string 5 + append + sstore 2 + jump LABEL434 +LABEL371: + iload 1 + iconst 0 + if_icmpeq LABEL375 + jump LABEL387 +LABEL375: + sload 2 + sconst "You're marked with a " + sconst "" + sconst "PK skull" + sconst "" + sconst ". This reduces the items you keep from " + sconst "three" + sconst " to zero!" + join_string 7 + append + sstore 2 + jump LABEL434 +LABEL387: + iload 1 + iconst 1 + if_icmpeq LABEL391 + jump LABEL410 +LABEL391: + sload 2 + sconst "You're marked with a " + sconst "" + sconst "PK skull" + sconst "" + sconst ". This reduces the items you keep from " + sconst "three" + sconst " to zero!" + sconst "
    " + sconst "
    " + sconst "However, you also have the " + sconst "" + sconst "Protect Items" + sconst "" + sconst " prayer active, which saves you one extra item!" + join_string 14 + append + sstore 2 + jump LABEL434 +LABEL410: + iload 1 + iconst 3 + if_icmpeq LABEL414 + jump LABEL419 +LABEL414: + sload 2 + sconst "You have no factors affecting the items you keep." + append + sstore 2 + jump LABEL434 +LABEL419: + iload 1 + iconst 3 + iconst 1 + add + if_icmpeq LABEL425 + jump LABEL434 +LABEL425: + sload 2 + sconst "You have the " + sconst "" + sconst "Protect Items" + sconst "" + sconst " prayer active, which saves you one extra item!" + join_string 5 + append + sstore 2 +LABEL434: + iload 8 + iconst 1 + if_icmpeq LABEL441 + iload 9 + iconst 1 + if_icmpeq LABEL441 + jump LABEL492 +LABEL441: + iload 8 + iconst 1 + if_icmpeq LABEL445 + jump LABEL466 +LABEL445: + iload 9 + iconst 1 + if_icmpeq LABEL449 + jump LABEL466 +LABEL449: + sload 2 + sconst "
    " + sconst "
    " + sconst "Items with a " + sconst "" + sconst "white outline" + sconst "" + sconst " will always be lost." + sconst "
    " + sconst "" + sconst "Bonds" + sconst "" + sconst " are always protected." + join_string 12 + append + sstore 2 + jump LABEL492 +LABEL466: + iload 8 + iconst 1 + if_icmpeq LABEL470 + jump LABEL482 +LABEL470: + sload 2 + sconst "
    " + sconst "
    " + sconst "Items with a " + sconst "" + sconst "white outline" + sconst "" + sconst " will always be lost." + join_string 7 + append + sstore 2 + jump LABEL492 +LABEL482: + sload 2 + sconst "
    " + sconst "
    " + sconst "" + sconst "Bonds" + sconst "" + sconst " are always protected, so are not shown here." + join_string 6 + append + sstore 2 +LABEL492: + sload 2 + iconst 262173 + if_settext + sconst "" + sconst "Max items kept on death :" + sconst "
    " + sconst "
    " + sconst "" + sconst "~ " + iload 1 + tostring + sconst " ~" + join_string 8 + iconst 262174 + if_settext + iload 2 + iconst 0 + if_icmpgt LABEL511 + jump LABEL518 +LABEL511: + sconst "Items you will keep on death:" + iconst 262161 + if_settext + sconst "Items you will lose on death:" + iconst 262164 + if_settext + jump LABEL524 +LABEL518: + sconst "Items you will keep on death if not skulled:" + iconst 262161 + if_settext + sconst "Items you will lose on death if not skulled:" + iconst 262164 + if_settext +LABEL524: + jump LABEL565 +LABEL525: + iconst 1 + iconst 262165 + if_sethide + iconst 1 + iconst 262162 + if_sethide + iconst 0 + iconst 262175 + if_sethide + sload 0 + iconst 262176 + if_settext + sconst "The normal amount of items kept is " + sconst "three" + sconst "." + sconst "
    " + sconst "
    " + join_string 5 + sstore 2 + sload 2 + sconst "You're in a " + sconst "" + sconst "safe area" + sconst "" + sconst ". See information to the left for a more detailed description." + join_string 5 + append + sstore 2 + sload 2 + iconst 262173 + if_settext + sconst "" + sconst "Max items kept on death :" + sconst "
    " + sconst "
    " + sconst "" + sconst "All items!" + join_string 6 + iconst 262174 + if_settext +LABEL565: + sconst "itemsKeptOnDeath" ; push event name + runelite_callback ; invoke callback + return From 6c3080307da1d1ec9e1d029fb1b559d4216d340d Mon Sep 17 00:00:00 2001 From: Ganom Date: Tue, 18 Jun 2019 18:22:23 -0400 Subject: [PATCH 059/117] Add overlay highlight for record raids --- .../java/net/runelite/client/plugins/raids/RaidsOverlay.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java index 6174f7a9e0..956a521827 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java @@ -294,6 +294,7 @@ public class RaidsOverlay extends Overlay .text("Record Raid") .color(Color.GREEN) .build()); + panelComponent.setBackgroundColor(new Color(0,255,0,10)); } TableComponent tableComponent = new TableComponent(); From 940a404ec60cf1948325ed913d4e2970aa6b19ef Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 15 Jun 2019 14:40:38 +0100 Subject: [PATCH 060/117] api: implement resetHealthBarCaches and getHealthBarFrontSpriteId Remove getHealthBarCache --- runelite-api/src/main/java/net/runelite/api/Client.java | 2 +- .../src/main/java/net/runelite/api/HealthBar.java | 2 ++ .../plugins/interfacestyles/InterfaceStylesPlugin.java | 7 ++----- .../src/main/java/net/runelite/mixins/RSClientMixin.java | 8 ++++++++ .../src/main/java/net/runelite/rs/api/RSClient.java | 4 +++- .../src/main/java/net/runelite/rs/api/RSHealthBar.java | 4 ++++ 6 files changed, 20 insertions(+), 7 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index cfc24df818..9930ccbed4 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1639,5 +1639,5 @@ public interface Client extends GameEngine void draw2010Menu(); - NodeCache getHealthBarCache(); + void resetHealthBarCaches(); } diff --git a/runelite-api/src/main/java/net/runelite/api/HealthBar.java b/runelite-api/src/main/java/net/runelite/api/HealthBar.java index 2ffeedca28..5c15f71727 100644 --- a/runelite-api/src/main/java/net/runelite/api/HealthBar.java +++ b/runelite-api/src/main/java/net/runelite/api/HealthBar.java @@ -30,5 +30,7 @@ public interface HealthBar SpritePixels getHealthBarBackSprite(); + int getHealthBarFrontSpriteId(); + void setPadding(int padding); } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java index de15266d70..f54404b8e1 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java @@ -33,7 +33,6 @@ import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.HealthBar; import net.runelite.api.HealthBarOverride; -import net.runelite.api.NodeCache; import net.runelite.api.SpriteID; import net.runelite.api.SpritePixels; import net.runelite.api.events.BeforeMenuRender; @@ -94,8 +93,7 @@ public class InterfaceStylesPlugin extends Plugin removeGameframe(); healthBarOverride = null; client.setHealthBarOverride(null); - NodeCache heathBarCache = client.getHealthBarCache(); - heathBarCache.reset(); // invalidate healthbar cache so padding resets + client.resetHealthBarCaches(); // invalidate healthbar cache so padding resets }); } @@ -273,8 +271,7 @@ public class InterfaceStylesPlugin extends Plugin private void overrideHealthBars() { // Reset health bar cache to reset applied padding - NodeCache healthBarCache = client.getHealthBarCache(); - healthBarCache.reset(); + client.resetHealthBarCaches(); if (config.hdHealthBars()) { diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index 7c934a265d..b212ac9d82 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -1550,4 +1550,12 @@ public abstract class RSClientMixin implements RSClient enumCache.put(id, rsEnum); return rsEnum; } + + @Inject + @Override + public void resetHealthBarCaches() + { + getHealthBarCache().reset(); + getHealthBarSpriteCache().reset(); + } } \ No newline at end of file diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index 96b3333df4..7fff3d232d 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -982,6 +982,8 @@ public interface RSClient extends RSGameEngine, Client void RasterizerDrawCircle(int x, int y, int r, int rgb); @Import("healthbarCache") - @Override RSNodeCache getHealthBarCache(); + + @Import("healthBarSpriteCache") + RSNodeCache getHealthBarSpriteCache(); } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBar.java b/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBar.java index 758bf8cb83..ca9ff1419f 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBar.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBar.java @@ -32,6 +32,10 @@ public interface RSHealthBar extends RSCacheableNode, HealthBar @Import("healthScale") int getHealthScale(); + @Import("healthBarFrontSpriteId") + @Override + int getHealthBarFrontSpriteId(); + @Import("getHealthBarFrontSprite") @Override RSSpritePixels getHealthBarFrontSprite(); From 381ffdabf6bb62df3d776d2c3da206f7560078bd Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 15 Jun 2019 14:43:26 +0100 Subject: [PATCH 061/117] api: remove unneeded Health Bar Override code --- .../main/java/net/runelite/api/Client.java | 8 --- .../net/runelite/api/HealthBarOverride.java | 37 ----------- .../InterfaceStylesPlugin.java | 1 - .../net/runelite/mixins/RSClientMixin.java | 11 ---- .../net/runelite/mixins/RSHealthBarMixin.java | 63 ------------------- 5 files changed, 120 deletions(-) delete mode 100644 runelite-api/src/main/java/net/runelite/api/HealthBarOverride.java diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 9930ccbed4..a8ed2fba3a 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -1503,14 +1503,6 @@ public interface Client extends GameEngine */ NodeCache getWidgetSpriteCache(); - /** - * Overrides health bar sprites with the sprites from the specified override. - * Pass in {@code null} to revert the health bars back to their default. - * - * @param override the health bar override - */ - void setHealthBarOverride(HealthBarOverride override); - /** * Gets the current server tick count. * diff --git a/runelite-api/src/main/java/net/runelite/api/HealthBarOverride.java b/runelite-api/src/main/java/net/runelite/api/HealthBarOverride.java deleted file mode 100644 index b53b480518..0000000000 --- a/runelite-api/src/main/java/net/runelite/api/HealthBarOverride.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2019, Lotto - * 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 HOLDER 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.api; - -import lombok.Data; - -@Data -public class HealthBarOverride -{ - public final SpritePixels frontSprite; - public final SpritePixels backSprite; - public final SpritePixels frontSpriteLarge; - public final SpritePixels backSpriteLarge; -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java index f54404b8e1..6d47cec72a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java @@ -32,7 +32,6 @@ import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.HealthBar; -import net.runelite.api.HealthBarOverride; import net.runelite.api.SpriteID; import net.runelite.api.SpritePixels; import net.runelite.api.events.BeforeMenuRender; diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index b212ac9d82..2c9050ff2b 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -42,7 +42,6 @@ import net.runelite.api.GameState; import net.runelite.api.GrandExchangeOffer; import net.runelite.api.GraphicsObject; import net.runelite.api.HashTable; -import net.runelite.api.HealthBarOverride; import net.runelite.api.HintArrowType; import net.runelite.api.Ignore; import net.runelite.api.IndexDataBase; @@ -190,9 +189,6 @@ public abstract class RSClientMixin implements RSClient .maximumSize(64) .build(); - @Inject - private static HealthBarOverride healthBarOverride; - @Inject public RSClientMixin() { @@ -1253,13 +1249,6 @@ public abstract class RSClientMixin implements RSClient client.getCallbacks().post(new UsernameChanged()); } - @Inject - @Override - public void setHealthBarOverride(HealthBarOverride override) - { - healthBarOverride = override; - } - @Override @Inject public int getTickCount() diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarMixin.java index 4e35a52c49..ee80620f2e 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarMixin.java @@ -24,84 +24,21 @@ */ package net.runelite.mixins; -import net.runelite.api.HealthBarOverride; import net.runelite.api.events.PostHealthBar; -import net.runelite.api.mixins.Copy; import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.MethodHook; import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Replace; import net.runelite.api.mixins.Shadow; import net.runelite.rs.api.RSBuffer; import net.runelite.rs.api.RSClient; import net.runelite.rs.api.RSHealthBar; -import net.runelite.rs.api.RSSpritePixels; @Mixin(RSHealthBar.class) public abstract class RSHealthBarMixin implements RSHealthBar { - // Larger values are used for bosses like Corporeal Beast - private static final int DEFAULT_HEALTH_SCALE = 30; - @Shadow("clientInstance") private static RSClient client; - @Shadow("healthBarOverride") - private static HealthBarOverride healthBarOverride; - - @Copy("getHealthBarBackSprite") - abstract RSSpritePixels rs$getHealthBarBackSprite(); - - @Replace("getHealthBarBackSprite") - public RSSpritePixels rl$getHealthBarBackSprite() - { - /* - * If this combat info already uses sprites for health bars, - * use those instead, and don't override. - */ - RSSpritePixels pixels = rs$getHealthBarBackSprite(); - if (pixels != null) - { - return pixels; - } - - if (healthBarOverride == null) - { - return null; - } - - return getHealthScale() == DEFAULT_HEALTH_SCALE - ? (RSSpritePixels) healthBarOverride.backSprite - : (RSSpritePixels) healthBarOverride.backSpriteLarge; - } - - @Copy("getHealthBarFrontSprite") - abstract RSSpritePixels rs$getHealthBarFrontSprite(); - - @Replace("getHealthBarFrontSprite") - public RSSpritePixels rl$getHealthBarFrontSprite() - { - /* - * If this combat info already uses sprites for health bars, - * use those instead, and don't override. - */ - RSSpritePixels pixels = rs$getHealthBarFrontSprite(); - if (pixels != null) - { - return pixels; - } - - if (healthBarOverride == null) - { - return null; - } - - // 30 is the default size, large is for bosses like Corporeal Beast - return getHealthScale() == DEFAULT_HEALTH_SCALE - ? (RSSpritePixels) healthBarOverride.frontSprite - : (RSSpritePixels) healthBarOverride.frontSpriteLarge; - } - @MethodHook(value = "read", end = true) @Inject public void onRead(RSBuffer buffer) From d8c19a0ec7ad10ad249e11b7831cfb68b0731832 Mon Sep 17 00:00:00 2001 From: Hydrox6 Date: Sat, 15 Jun 2019 14:47:44 +0100 Subject: [PATCH 062/117] interface styles: update HD Health bar to work with new sprites --- .../main/java/net/runelite/api/SpriteID.java | 19 ++++ .../interfacestyles/HealthbarOverride.java | 87 ++++++++++++++++++ .../InterfaceStylesPlugin.java | 40 +++----- .../healthbar/{back.png => back_30px.png} | Bin .../{back_large.png => back_90px.png} | Bin .../healthbar/{front.png => front_30px.png} | Bin .../{front_large.png => front_90px.png} | Bin 7 files changed, 121 insertions(+), 25 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/HealthbarOverride.java rename runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/{back.png => back_30px.png} (100%) rename runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/{back_large.png => back_90px.png} (100%) rename runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/{front.png => front_30px.png} (100%) rename runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/{front_large.png => front_90px.png} (100%) diff --git a/runelite-api/src/main/java/net/runelite/api/SpriteID.java b/runelite-api/src/main/java/net/runelite/api/SpriteID.java index e707854c12..c9f2f1e7db 100644 --- a/runelite-api/src/main/java/net/runelite/api/SpriteID.java +++ b/runelite-api/src/main/java/net/runelite/api/SpriteID.java @@ -1564,6 +1564,25 @@ public final class SpriteID public static final int MOBILE_FUNCTION_MODE_DISABLED = 1624; public static final int MOBILE_YELLOW_TOUCH_ANIMATION_1 = 1625; public static final int MOBILE_YELLOW_TOUCH_ANIMATION_2 = 1626; + /* Unmapped: 1627~1707 */ public static final int TAB_MAGIC_SPELLBOOK_ARCEUUS_UNUSED = 1708; + /* Unmapped: 1709, 1710 */ public static final int TAB_MAGIC_SPELLBOOK_ARCEUUS = 1711; + /* Unmapped: 1712~2175 */ + public static final int HEALTHBAR_DEFAULT_FRONT_30PX = 2176; + public static final int HEALTHBAR_DEFAULT_BACK_30PX = 2177; + public static final int HEALTHBAR_DEFAULT_FRONT_50PX = 2178; + public static final int HEALTHBAR_DEFAULT_BACK_50PX = 2179; + public static final int HEALTHBAR_DEFAULT_FRONT_60PX = 2180; + public static final int HEALTHBAR_DEFAULT_BACK_60PX = 2181; + public static final int HEALTHBAR_DEFAULT_FRONT_80PX = 2182; + public static final int HEALTHBAR_DEFAULT_BACK_80PX = 2183; + public static final int HEALTHBAR_DEFAULT_FRONT_100PX = 2184; + public static final int HEALTHBAR_DEFAULT_BACK_100PX = 2185; + public static final int HEALTHBAR_DEFAULT_FRONT_120PX = 2186; + public static final int HEALTHBAR_DEFAULT_BACK_120PX = 2187; + public static final int HEALTHBAR_DEFAULT_FRONT_140PX = 2188; + public static final int HEALTHBAR_DEFAULT_BACK_140PX = 2189; + public static final int HEALTHBAR_DEFAULT_FRONT_160PX = 2190; + public static final int HEALTHBAR_DEFAULT_BACK_160PX = 2191; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/HealthbarOverride.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/HealthbarOverride.java new file mode 100644 index 0000000000..c0e844939a --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/HealthbarOverride.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2019 Hydrox6 + * 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.interfacestyles; + +import com.google.common.collect.ImmutableMap; +import java.util.Map; +import lombok.Getter; +import lombok.RequiredArgsConstructor; +import static net.runelite.api.SpriteID.*; +import net.runelite.client.game.SpriteOverride; + +@RequiredArgsConstructor +enum HealthbarOverride implements SpriteOverride +{ + BACK_30PX(HEALTHBAR_DEFAULT_BACK_30PX, "back_30px.png"), + BACK_50PX(HEALTHBAR_DEFAULT_BACK_50PX, "back_30px.png"), + BACK_60PX(HEALTHBAR_DEFAULT_BACK_60PX, "back_30px.png"), + BACK_80PX(HEALTHBAR_DEFAULT_BACK_80PX, "back_90px.png"), + BACK_100PX(HEALTHBAR_DEFAULT_BACK_100PX, "back_90px.png"), + BACK_120PX(HEALTHBAR_DEFAULT_BACK_120PX, "back_90px.png"), + BACK_140PX(HEALTHBAR_DEFAULT_BACK_140PX, "back_90px.png"), + BACK_160PX(HEALTHBAR_DEFAULT_BACK_160PX, "back_90px.png"), + + FRONT_30PX(HEALTHBAR_DEFAULT_FRONT_30PX, "front_30px.png"), + FRONT_50PX(HEALTHBAR_DEFAULT_FRONT_50PX, "front_30px.png"), + FRONT_60PX(HEALTHBAR_DEFAULT_FRONT_60PX, "front_30px.png"), + FRONT_80PX(HEALTHBAR_DEFAULT_FRONT_80PX, "front_90px.png"), + FRONT_100PX(HEALTHBAR_DEFAULT_FRONT_100PX, "front_90px.png"), + FRONT_120PX(HEALTHBAR_DEFAULT_FRONT_120PX, "front_90px.png"), + FRONT_140PX(HEALTHBAR_DEFAULT_FRONT_140PX, "front_90px.png"), + FRONT_160PX(HEALTHBAR_DEFAULT_FRONT_160PX, "front_90px.png"); + + @Getter + private final int spriteId; + + private final String fileName; + + @Getter + private int padding = 1; + + private static final Map MAP; + + static + { + ImmutableMap.Builder builder = new ImmutableMap.Builder<>(); + + for (HealthbarOverride override : values()) + { + builder.put(override.spriteId, override); + } + + MAP = builder.build(); + } + + static HealthbarOverride get(int spriteID) + { + return MAP.get(spriteID); + } + + @Override + public String getFileName() + { + return Skin.AROUND_2010.toString() + "/healthbar/" + this.fileName; + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java index 6d47cec72a..cdadf60320 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/interfacestyles/InterfaceStylesPlugin.java @@ -69,8 +69,6 @@ public class InterfaceStylesPlugin extends Plugin @Inject private SpriteManager spriteManager; - private HealthBarOverride healthBarOverride; - @Provides InterfaceStylesConfig provideConfig(ConfigManager configManager) { @@ -90,9 +88,7 @@ public class InterfaceStylesPlugin extends Plugin { restoreWidgetDimensions(); removeGameframe(); - healthBarOverride = null; - client.setHealthBarOverride(null); - client.resetHealthBarCaches(); // invalidate healthbar cache so padding resets + restoreHealthBars(); }); } @@ -114,19 +110,19 @@ public class InterfaceStylesPlugin extends Plugin @Subscribe public void onPostHealthBar(PostHealthBar postHealthBar) { - if (healthBarOverride == null || !config.hdHealthBars()) + if (!config.hdHealthBars()) { return; } HealthBar healthBar = postHealthBar.getHealthBar(); - SpritePixels frontSprite = healthBar.getHealthBarFrontSprite(); + HealthbarOverride override = HealthbarOverride.get(healthBar.getHealthBarFrontSpriteId()); // Check if this is the health bar we are replacing - if (frontSprite == healthBarOverride.getFrontSprite() || frontSprite == healthBarOverride.getFrontSpriteLarge()) + if (override != null) { // Increase padding to show some more green at very low hp percentages - healthBar.setPadding(1); + healthBar.setPadding(override.getPadding()); } } @@ -269,30 +265,24 @@ public class InterfaceStylesPlugin extends Plugin private void overrideHealthBars() { - // Reset health bar cache to reset applied padding - client.resetHealthBarCaches(); - if (config.hdHealthBars()) { - String fileBase = Skin.AROUND_2010.toString() + "/healthbar/"; - - SpritePixels frontSprite = getFileSpritePixels(fileBase + "front.png"); - SpritePixels backSprite = getFileSpritePixels(fileBase + "back.png"); - - SpritePixels frontSpriteLarge = getFileSpritePixels(fileBase + "front_large.png"); - SpritePixels backSpriteLarge = getFileSpritePixels(fileBase + "back_large.png"); - - HealthBarOverride override = new HealthBarOverride(frontSprite, backSprite, frontSpriteLarge, backSpriteLarge); - healthBarOverride = override; - client.setHealthBarOverride(override); + spriteManager.addSpriteOverrides(HealthbarOverride.values()); + // Reset health bar caches to apply the override + clientThread.invokeLater(client::resetHealthBarCaches); } else { - healthBarOverride = null; - client.setHealthBarOverride(null); + restoreHealthBars(); } } + private void restoreHealthBars() + { + spriteManager.removeSpriteOverrides(HealthbarOverride.values()); + clientThread.invokeLater(client::resetHealthBarCaches); + } + private void restoreWidgetDimensions() { for (WidgetOffset widgetOffset : WidgetOffset.values()) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_30px.png similarity index 100% rename from runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back.png rename to runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_30px.png diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_large.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_90px.png similarity index 100% rename from runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_large.png rename to runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/back_90px.png diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_30px.png similarity index 100% rename from runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front.png rename to runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_30px.png diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_large.png b/runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_90px.png similarity index 100% rename from runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_large.png rename to runelite-client/src/main/resources/net/runelite/client/plugins/interfacestyles/2010/healthbar/front_90px.png From 3b7780bcb1344734014e3f1ac88eb980511e2dfe Mon Sep 17 00:00:00 2001 From: Ganom Date: Tue, 18 Jun 2019 18:51:29 -0400 Subject: [PATCH 063/117] Add New Features to Cox Scouter --- .../java/net/runelite/client/plugins/raids/RaidsOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java index 956a521827..4f7d7436f7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java @@ -294,7 +294,7 @@ public class RaidsOverlay extends Overlay .text("Record Raid") .color(Color.GREEN) .build()); - panelComponent.setBackgroundColor(new Color(0,255,0,10)); + panelComponent.setBackgroundColor(new Color(0, 255, 0, 10)); } TableComponent tableComponent = new TableComponent(); From 65c9b973b516090637bf1714f026a47b0aed9ff9 Mon Sep 17 00:00:00 2001 From: Ganom Date: Tue, 18 Jun 2019 18:54:32 -0400 Subject: [PATCH 064/117] Remove Debug Output --- .../java/net/runelite/client/plugins/raids/RaidsOverlay.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java index 4f7d7436f7..b65e380c1b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java @@ -164,8 +164,6 @@ public class RaidsOverlay extends Overlay return panelComponent.render(graphics); } - System.out.println(plugin.getRaid().getRotationString()); - Color color = Color.WHITE; String layout = plugin.getRaid().getLayout().toCodeString(); String displayLayout; From d956c6b3ac51c15141861a70bb9a07fcd023b114 Mon Sep 17 00:00:00 2001 From: William Collishaw Date: Tue, 18 Jun 2019 18:29:22 -0600 Subject: [PATCH 065/117] Fix 'GROTESQUE_GUARDIAN' typo in SlayerUnlock enum --- .../src/main/java/net/runelite/api/vars/SlayerUnlock.java | 2 +- .../java/net/runelite/client/plugins/slayer/SlayerPlugin.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/vars/SlayerUnlock.java b/runelite-api/src/main/java/net/runelite/api/vars/SlayerUnlock.java index 72733d768d..de37ff244a 100644 --- a/runelite-api/src/main/java/net/runelite/api/vars/SlayerUnlock.java +++ b/runelite-api/src/main/java/net/runelite/api/vars/SlayerUnlock.java @@ -79,7 +79,7 @@ public enum SlayerUnlock RUNE_DRAGON_EXTEND(41), VORKATH_SLAYER_HELM(42), FOSSIL_ISLAND_WYVERN_DISABLE(43, Varbits.FOSSIL_ISLAND_WYVERN_DISABLE), - GROTESQUE_GARDIAN_DOUBLE_COUNT(44); + GROTESQUE_GUARDIAN_DOUBLE_COUNT(44); private Varbits toggleVarbit; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java index 1b87aa769a..808f830d24 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/slayer/SlayerPlugin.java @@ -587,7 +587,7 @@ public class SlayerPlugin extends Plugin private boolean doubleTroubleExtraKill() { return WorldPoint.fromLocalInstance(client, client.getLocalPlayer().getLocalLocation()).getRegionID() == GROTESQUE_GUARDIANS_REGION && - SlayerUnlock.GROTESQUE_GARDIAN_DOUBLE_COUNT.isEnabled(client); + SlayerUnlock.GROTESQUE_GUARDIAN_DOUBLE_COUNT.isEnabled(client); } private boolean isTarget(NPC npc) From 30c0a22aeaac90db0d50f439f20d31df4ea9ebd2 Mon Sep 17 00:00:00 2001 From: William Collishaw Date: Tue, 18 Jun 2019 18:40:43 -0600 Subject: [PATCH 066/117] Fix 'ABERRANT_SPECTRE' typo in SlayerUnlock and CannonSpot enums --- .../src/main/java/net/runelite/api/vars/SlayerUnlock.java | 2 +- .../java/net/runelite/client/plugins/cannon/CannonSpots.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/vars/SlayerUnlock.java b/runelite-api/src/main/java/net/runelite/api/vars/SlayerUnlock.java index 72733d768d..265ec51f75 100644 --- a/runelite-api/src/main/java/net/runelite/api/vars/SlayerUnlock.java +++ b/runelite-api/src/main/java/net/runelite/api/vars/SlayerUnlock.java @@ -56,7 +56,7 @@ public enum SlayerUnlock TZHARR_ENABLE(18), BOSS_ENABLE(19), BLOODVELD_EXTEND(20), - ABBERANT_SPECTRE_EXTEND(21), + ABERRANT_SPECTRE_EXTEND(21), AVIANSIES_EXTEND(22), MITHRIL_DRAGON_EXTEND(23), CAVE_HORROR_EXTEND(24), diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonSpots.java b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonSpots.java index 7ebaed9c2b..ea145942ac 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonSpots.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/cannon/CannonSpots.java @@ -35,7 +35,7 @@ public enum CannonSpots BLOODVELDS(new WorldPoint(2439, 9821, 0), new WorldPoint(2448, 9821, 0), new WorldPoint(2472, 9833, 0), new WorldPoint(2453, 9817, 0)), FIRE_GIANTS(new WorldPoint(2393, 9782, 0), new WorldPoint(2412, 9776, 0), new WorldPoint(2401, 9780, 0)), - ABBERANT_SPECTRES(new WorldPoint(2456, 9791, 0)), + ABERRANT_SPECTRES(new WorldPoint(2456, 9791, 0)), HELLHOUNDS(new WorldPoint(2431, 9776, 0), new WorldPoint(2413, 9786, 0), new WorldPoint(2783, 9686, 0), new WorldPoint(3198, 10071, 0)), BLACK_DEMONS(new WorldPoint(2859, 9778, 0), new WorldPoint(2841, 9791, 0)), ELVES(new WorldPoint(2044, 4635, 0)), From b05835fb320c4ba9b9ef62c04b676f44e4994fee Mon Sep 17 00:00:00 2001 From: gregg1494 Date: Tue, 18 Jun 2019 19:56:08 -0600 Subject: [PATCH 067/117] itemprices: fix showing high alch profit with show ha value disabled Co-authored-by: Adam --- .../client/plugins/itemprices/ItemPricesOverlay.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java index e6f5f49ddc..5682a6f2b2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemprices/ItemPricesOverlay.java @@ -195,6 +195,7 @@ class ItemPricesOverlay extends Overlay int gePrice = 0; int haPrice = 0; int haProfit = 0; + final int itemHaPrice = Math.round(itemDef.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER); if (config.showGEPrice()) { @@ -202,11 +203,11 @@ class ItemPricesOverlay extends Overlay } if (config.showHAValue()) { - haPrice = Math.round(itemDef.getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER); + haPrice = itemHaPrice; } - if (gePrice > 0 && haPrice > 0 && config.showAlchProfit()) + if (gePrice > 0 && itemHaPrice > 0 && config.showAlchProfit()) { - haProfit = calculateHAProfit(haPrice, gePrice); + haProfit = calculateHAProfit(itemHaPrice, gePrice); } if (gePrice > 0 || haPrice > 0) From 4750322c104b721d51549d5f87889146f8e74cda Mon Sep 17 00:00:00 2001 From: Adelaidian <51854706+Adelaidian@users.noreply.github.com> Date: Wed, 19 Jun 2019 12:11:23 +0930 Subject: [PATCH 068/117] mining plugin: add ash piles --- .../main/java/net/runelite/client/plugins/mining/Rock.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java b/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java index 5f8ba42a67..19207b7fd6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/mining/Rock.java @@ -49,6 +49,7 @@ import static net.runelite.api.ObjectID.ROCKS_11376; import static net.runelite.api.ObjectID.ROCKS_11377; import static net.runelite.api.ObjectID.ROCKS_11386; import static net.runelite.api.ObjectID.ROCKS_11387; +import static net.runelite.api.ObjectID.ASH_PILE; enum Rock { @@ -99,7 +100,8 @@ enum Rock } }, ORE_VEIN(Duration.ofSeconds(MiningOverlay.ORE_VEIN_MAX_RESPAWN_TIME), 150), - AMETHYST(Duration.ofSeconds(75), 120); + AMETHYST(Duration.ofSeconds(75), 120), + ASH_VEIN(Duration.ofSeconds(30), 0, ASH_PILE); private static final Map ROCKS; From f7c3c74d8bfb5c06da2c30293f27f9b0efa217d0 Mon Sep 17 00:00:00 2001 From: zeruth Date: Wed, 19 Jun 2019 00:37:47 -0400 Subject: [PATCH 069/117] Fix BlackJack / Live Update --- bootstrap.json | 293 ++++++++++++++++++ .../java/net/runelite/client/RuneLite.java | 2 +- .../plugins/blackjack/BlackjackPlugin.java | 9 +- .../client/util/bootstrap/Bootstrap.java | 2 + 4 files changed, 300 insertions(+), 6 deletions(-) create mode 100644 bootstrap.json diff --git a/bootstrap.json b/bootstrap.json new file mode 100644 index 0000000000..6c1ab35484 --- /dev/null +++ b/bootstrap.json @@ -0,0 +1,293 @@ +{ + "buildCommit": "c554ab2400dc04a619b36695da2107648c9c87b3", + "artifacts": [ + { + "hash": "b12331da8683e5f107d294adeebb83ecf9124abc1db533554d2a8d3c62832d75", + "name": "asm-all-6.0_BETA.jar", + "path": "https://mvn.runelite.net/org/ow2/asm/asm-all/6.0_BETA/asm-all-6.0_BETA.jar", + "size": "265176" + }, + { + "hash": "37abf0103ce5318bfda004fabc004c75ed0dc6d392a8459175692ab7eac97083", + "name": "naturalmouse-2.0.0.jar", + "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/artifacts/naturalmouse-2.0.0.jar", + "size": "3168921" + }, + { + "hash": "50d1e07f11827672249dee9ce8a23691fc59f663deed084bb7b52a4f778d5fbc", + "name": "jcl-core-2.9-SNAPSHOT.jar", + "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/artifacts/jcl-core-2.9-SNAPSHOT.jar", + "size": "3168921" + }, + { + "hash": "43ab86508a0d8f944470ad5fcae6b9997eb9c640f72371f587e721e29588fa24", + "name": "client-1.5.27-SNAPSHOT.jar", + "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/client-1.5.27-SNAPSHOT.jar", + "size": "5841971" + }, + { + "hash": "18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79", + "name": "slf4j-api-1.7.25.jar", + "path": "https://mvn.runelite.net/org/slf4j/slf4j-api/1.7.25/slf4j-api-1.7.25.jar", + "size": "41203" + }, + { + "hash": "fb53f8539e7fcb8f093a56e138112056ec1dc809ebb020b59d8a36a5ebac37e0", + "name": "logback-classic-1.2.3.jar", + "path": "https://mvn.runelite.net/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar", + "size": "290339" + }, + { + "hash": "5946d837fe6f960c02a53eda7a6926ecc3c758bbdd69aa453ee429f858217f22", + "name": "logback-core-1.2.3.jar", + "path": "https://mvn.runelite.net/ch/qos/logback/logback-core/1.2.3/logback-core-1.2.3.jar", + "size": "471901" + }, + { + "hash": "9f0c8d50fa4b79b6ff1502dbec8502179d6b9497cacbe17a13074001aed537ec", + "name": "jopt-simple-5.0.1.jar", + "path": "https://mvn.runelite.net/net/sf/jopt-simple/jopt-simple/5.0.1/jopt-simple-5.0.1.jar", + "size": "78826" + }, + { + "hash": "5be9a7d05ba0ccd74708bc8018ae412255f85843c0b92302e9b9befa6ed52564", + "name": "guava-23.2-jre.jar", + "path": "https://mvn.runelite.net/com/google/guava/guava/23.2-jre/guava-23.2-jre.jar", + "size": "2649860" + }, + { + "hash": "905721a0eea90a81534abb7ee6ef4ea2e5e645fa1def0a5cd88402df1b46c9ed", + "name": "jsr305-1.3.9.jar", + "path": "https://mvn.runelite.net/com/google/code/findbugs/jsr305/1.3.9/jsr305-1.3.9.jar", + "size": "33015" + }, + { + "hash": "cb4cfad870bf563a07199f3ebea5763f0dec440fcda0b318640b1feaa788656b", + "name": "error_prone_annotations-2.0.18.jar", + "path": "https://mvn.runelite.net/com/google/errorprone/error_prone_annotations/2.0.18/error_prone_annotations-2.0.18.jar", + "size": "12078" + }, + { + "hash": "2994a7eb78f2710bd3d3bfb639b2c94e219cedac0d4d084d516e78c16dddecf6", + "name": "j2objc-annotations-1.1.jar", + "path": "https://mvn.runelite.net/com/google/j2objc/j2objc-annotations/1.1/j2objc-annotations-1.1.jar", + "size": "8782" + }, + { + "hash": "2068320bd6bad744c3673ab048f67e30bef8f518996fa380033556600669905d", + "name": "animal-sniffer-annotations-1.14.jar", + "path": "https://mvn.runelite.net/org/codehaus/mojo/animal-sniffer-annotations/1.14/animal-sniffer-annotations-1.14.jar", + "size": "3482" + }, + { + "hash": "9264c6931c431e928dc64adc842584d5f57d17b2f3aff29221f2b3fdea673dad", + "name": "guice-4.1.0-no_aop.jar", + "path": "https://mvn.runelite.net/com/google/inject/guice/4.1.0/guice-4.1.0-no_aop.jar", + "size": "428603" + }, + { + "hash": "91c77044a50c481636c32d916fd89c9118a72195390452c81065080f957de7ff", + "name": "javax.inject-1.jar", + "path": "https://mvn.runelite.net/javax/inject/javax.inject/1/javax.inject-1.jar", + "size": "2497" + }, + { + "hash": "0addec670fedcd3f113c5c8091d783280d23f75e3acb841b61a9cdb079376a08", + "name": "aopalliance-1.0.jar", + "path": "https://mvn.runelite.net/aopalliance/aopalliance/1.0/aopalliance-1.0.jar", + "size": "4467" + }, + { + "hash": "233a0149fc365c9f6edbd683cfe266b19bdc773be98eabdaf6b3c924b48e7d81", + "name": "gson-2.8.5.jar", + "path": "https://mvn.runelite.net/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar", + "size": "241622" + }, + { + "hash": "0467d25f408428824d5c9c09ec60ee1f0bc341d9bf48971a77fd14939a826c83", + "name": "substance-8.0.02.jar", + "path": "https://repo.runelite.net/net/runelite/pushingpixels/substance/8.0.02/substance-8.0.02.jar", + "size": "1589195" + }, + { + "hash": "3214e1c23d549d5d67c91da4da1ef33c5248470bb824f91cbe8f9e0beea59eef", + "name": "trident-1.5.00.jar", + "path": "https://repo.runelite.net/net/runelite/pushingpixels/trident/1.5.00/trident-1.5.00.jar", + "size": "79726" + }, + { + "hash": "d4a57bbc1627da7c391308fd0fe910b83170fb66afd117236a5b111d2db1590b", + "name": "commons-text-1.2.jar", + "path": "https://mvn.runelite.net/org/apache/commons/commons-text/1.2/commons-text-1.2.jar", + "size": "136544" + }, + { + "hash": "6e8dc31e046508d9953c96534edf0c2e0bfe6f468966b5b842b3f87e43b6a847", + "name": "commons-lang3-3.7.jar", + "path": "https://mvn.runelite.net/org/apache/commons/commons-lang3/3.7/commons-lang3-3.7.jar", + "size": "499634" + }, + { + "hash": "e74603dc77b4183f108480279dbbf7fed3ac206069478636406c1fb45e83b31a", + "name": "jogl-all-2.3.2.jar", + "path": "https://mvn.runelite.net/org/jogamp/jogl/jogl-all/2.3.2/jogl-all-2.3.2.jar", + "size": "3414448" + }, + { + "hash": "8c53b1884cef19309d34fd10a94b010136d9d6de9a88c386f46006fb47acab5d", + "name": "jogl-all-2.3.2-natives-windows-amd64.jar", + "path": "https://mvn.runelite.net/org/jogamp/jogl/jogl-all/2.3.2/jogl-all-2.3.2-natives-windows-amd64.jar", + "size": "240721" + }, + { + "hash": "507a0e6bd1ee4e81c3dfb287783af93775864eec742988d4162f98ce0cbac9d6", + "name": "jogl-all-2.3.2-natives-windows-i586.jar", + "path": "https://mvn.runelite.net/org/jogamp/jogl/jogl-all/2.3.2/jogl-all-2.3.2-natives-windows-i586.jar", + "size": "209445" + }, + { + "hash": "82637302ae9effdf7d6f302e1050ad6aee3b13019914ddda5b502b9faa980216", + "name": "jogl-all-2.3.2-natives-linux-amd64.jar", + "path": "https://mvn.runelite.net/org/jogamp/jogl/jogl-all/2.3.2/jogl-all-2.3.2-natives-linux-amd64.jar", + "size": "224010" + }, + { + "hash": "f474ef2ef01be24ec811d3858b0f4bc5659076975f4a58ddd79abd787e9305c7", + "name": "jogl-all-2.3.2-natives-linux-i586.jar", + "path": "https://mvn.runelite.net/org/jogamp/jogl/jogl-all/2.3.2/jogl-all-2.3.2-natives-linux-i586.jar", + "size": "217274" + }, + { + "hash": "084844543b18f7ff71b4c0437852bd22f0cb68d7e44c2c611c1bbea76f8c6fdf", + "name": "gluegen-rt-2.3.2.jar", + "path": "https://mvn.runelite.net/org/jogamp/gluegen/gluegen-rt/2.3.2/gluegen-rt-2.3.2.jar", + "size": "345605" + }, + { + "hash": "3474017422eff384db466bdb56c96c61220c43133a9da6329cf1781bea16c6b6", + "name": "gluegen-rt-2.3.2-natives-windows-amd64.jar", + "path": "https://mvn.runelite.net/org/jogamp/gluegen/gluegen-rt/2.3.2/gluegen-rt-2.3.2-natives-windows-amd64.jar", + "size": "8159" + }, + { + "hash": "4eeed9fc2ebea5b9dc48a342b9478d127e989a2e1aa7129b512a98ec75cde338", + "name": "gluegen-rt-2.3.2-natives-windows-i586.jar", + "path": "https://mvn.runelite.net/org/jogamp/gluegen/gluegen-rt/2.3.2/gluegen-rt-2.3.2-natives-windows-i586.jar", + "size": "7577" + }, + { + "hash": "f2dfd1800202059cf7e0294db5d57755147304e6eb220a9277526dbe6842bde2", + "name": "gluegen-rt-2.3.2-natives-linux-amd64.jar", + "path": "https://mvn.runelite.net/org/jogamp/gluegen/gluegen-rt/2.3.2/gluegen-rt-2.3.2-natives-linux-amd64.jar", + "size": "4149" + }, + { + "hash": "1365d463f98c0abec92f3ad6b35aa4b53a9599a517800cf99fdabea6712ca7ec", + "name": "gluegen-rt-2.3.2-natives-linux-i586.jar", + "path": "https://mvn.runelite.net/org/jogamp/gluegen/gluegen-rt/2.3.2/gluegen-rt-2.3.2-natives-linux-i586.jar", + "size": "4130" + }, + { + "hash": "7b7ae00e2aa98c3b2b5ac76e793e2c9b752bf51c86c54654dbd473843a25f1aa", + "name": "jbsdiff-1.0.jar", + "path": "https://mvn.runelite.net/io/sigpipe/jbsdiff/1.0/jbsdiff-1.0.jar", + "size": "24589" + }, + { + "hash": "55bbfe26cee9296fd5b7c0d47ce6a00ea4dd572e235b63e9bb4eaf6f802315e4", + "name": "commons-compress-1.5.jar", + "path": "https://mvn.runelite.net/org/apache/commons/commons-compress/1.5/commons-compress-1.5.jar", + "size": "256241" + }, + { + "hash": "fbc9de96a0cc193a125b4008dbc348e9ed54e5e13fc67b8ed40e645d303cc51b", + "name": "jna-4.5.1.jar", + "path": "https://mvn.runelite.net/net/java/dev/jna/jna/4.5.1/jna-4.5.1.jar", + "size": "1440662" + }, + { + "hash": "84c8667555ee8dd91fef44b451419f6f16f71f727d5fc475a10c2663eba83abb", + "name": "jna-platform-4.5.1.jar", + "path": "https://mvn.runelite.net/net/java/dev/jna/jna-platform/4.5.1/jna-platform-4.5.1.jar", + "size": "2327547" + }, + { + "hash": "38d569278eb8cbd1ea875522d3df2befd14d90f395655f78e60f947050119303", + "name": "runelite-api-1.5.27-SNAPSHOT.jar", + "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/runelite-api-1.5.27-SNAPSHOT.jar", + "size": "1019722" + }, + { + "hash": "aa7cbacf941b1b12c0d083688c5da272db0a21ee2ef31e5a59ea659b323d139c", + "name": "runescape-api-1.5.27-SNAPSHOT.jar", + "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/runescape-api-1.5.27-SNAPSHOT.jar", + "size": "56056" + }, + { + "hash": "6a2a6b860c4ea1bbeb4cf483f9c0b97a065a2ea93327a3ed28dce8d3a3f5f305", + "name": "http-api-1.5.27-SNAPSHOT.jar", + "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/http-api-1.5.27-SNAPSHOT.jar", + "size": "101785" + }, + { + "hash": "f55abda036da75e1af45bd43b9dfa79b2a3d90905be9cb38687c6621597a8165", + "name": "okhttp-3.7.0.jar", + "path": "https://mvn.runelite.net/com/squareup/okhttp3/okhttp/3.7.0/okhttp-3.7.0.jar", + "size": "394987" + }, + { + "hash": "bfe7dfe483c37137966a1690f0c7d0b448ba217902c1fed202aaffdbba3291ae", + "name": "okio-1.12.0.jar", + "path": "https://mvn.runelite.net/com/squareup/okio/okio/1.12.0/okio-1.12.0.jar", + "size": "81088" + }, + { + "hash": "9d4924588d6280c7516db3a4b7298306db5b6f0d1cdf568ce738309b5660f008", + "name": "commons-csv-1.4.jar", + "path": "https://mvn.runelite.net/org/apache/commons/commons-csv/1.4/commons-csv-1.4.jar", + "size": "39978" + }, + { + "hash": "7e26a8d043418f2f22d5f6a3083a9a131817009ee8cd72c004e83b50d1849a7c", + "name": "discord-1.1.jar", + "path": "https://repo.runelite.net/net/runelite/discord/1.1/discord-1.1.jar", + "size": "617294" + } + ], + "client": { + "artifactId": "client", + "classifier": "", + "extension": "jar", + "groupId": "net.runelite", + "properties": "", + "version": "1.5.27" + }, + "clientJvm9Arguments": [ + "-XX:+DisableAttachMechanism", + "-Xmx512m", + "-Xss2m", + "-XX:CompileThreshold=1500", + "-Djna.nosys=true" + ], + "clientJvmArguments": [ + "-XX:+DisableAttachMechanism", + "-Xmx512m", + "-Xss2m", + "-XX:CompileThreshold=1500", + "-Xincgc", + "-XX:+UseConcMarkSweepGC", + "-XX:+UseParNewGC", + "-Djna.nosys=true" + ], + "launcherArguments": [ + "-XX:+DisableAttachMechanism", + "-Drunelite.launcher.nojvm=true", + "-Xmx512m", + "-Xss2m", + "-XX:CompileThreshold=1500", + "-Xincgc", + "-XX:+UseConcMarkSweepGC", + "-XX:+UseParNewGC", + "-Djna.nosys=true" + ] +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/RuneLite.java b/runelite-client/src/main/java/net/runelite/client/RuneLite.java index c79acfb86a..f4626b10a0 100644 --- a/runelite-client/src/main/java/net/runelite/client/RuneLite.java +++ b/runelite-client/src/main/java/net/runelite/client/RuneLite.java @@ -83,7 +83,7 @@ import org.slf4j.LoggerFactory; @Slf4j public class RuneLite { - public static final String RUNELIT_VERSION = "2.0.0"; + public static final String RUNELIT_VERSION = "2.0.1-1"; public static final File RUNELITE_DIR = new File(System.getProperty("user.home"), ".runelite"); public static final File PROFILES_DIR = new File(RUNELITE_DIR, "profiles"); public static final File PLUGIN_DIR = new File(RUNELITE_DIR, "plugins"); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackPlugin.java index 41586719fa..498971094a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackPlugin.java @@ -40,6 +40,7 @@ import net.runelite.client.menus.MenuManager; import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginType; +import net.runelite.client.util.MenuUtil; import net.runelite.client.util.Text; import org.apache.commons.lang3.RandomUtils; @@ -58,13 +59,11 @@ import org.apache.commons.lang3.RandomUtils; @Slf4j public class BlackjackPlugin extends Plugin { + private static final int POLLNIVNEACH_REGION = 13358; @Inject private Client client; - @Inject private MenuManager menuManager; - - private static final int POLLNIVNEACH_REGION = 13358; private boolean isKnockedOut = false; private long nextKnockOutTick = 0; @@ -82,11 +81,11 @@ public class BlackjackPlugin extends Plugin String target = Text.removeTags(event.getTarget().toLowerCase()); if (isKnockedOut && nextKnockOutTick >= client.getTickCount()) { - menuManager.addSwap("", target, "pickpocket", target, false, false); + MenuUtil.swap(client, "pickpocket", option, target); } else { - menuManager.addSwap("", target, "knock-out", target, false, false); + MenuUtil.swap(client, "knock-out", option, target); } } diff --git a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java index b6e3acde55..6892d31f75 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java +++ b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java @@ -14,6 +14,8 @@ import net.runelite.http.api.RuneLiteAPI; public class Bootstrap { + + String buildCommit = "c554ab2400dc04a619b36695da2107648c9c87b3"; Artifact[] artifacts = getArtifacts(); Client client = new Client(); String[] clientJvm9Arguments = new String[]{ From 94e013d81d1f91d1272e8ea0bcc88ebfea745f03 Mon Sep 17 00:00:00 2001 From: Justin Date: Wed, 19 Jun 2019 18:20:54 +1000 Subject: [PATCH 070/117] Stopped default red names for non-clan members (#657) somehow this config check was missed --- .../client/plugins/playerindicators/PlayerIndicatorsPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsPlugin.java index 6b3dfc3d4e..2bf360fdc2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/playerindicators/PlayerIndicatorsPlugin.java @@ -281,7 +281,7 @@ public class PlayerIndicatorsPlugin extends Plugin { color = config.getTeamMemberColor(); } - else if (!player.isClanMember() && !player.isFriend() && !PvPUtil.isAttackable(client, player)) + else if (config.highlightNonClanMembers() && !player.isClanMember() && !player.isFriend() && !PvPUtil.isAttackable(client, player)) { color = config.getNonClanMemberColor(); } From 906e8ad5096cd65937d4596ccd1d3ef086ac69b0 Mon Sep 17 00:00:00 2001 From: Twiglet1022 <29353990+Twiglet1022@users.noreply.github.com> Date: Sun, 9 Jun 2019 21:06:56 +0100 Subject: [PATCH 071/117] notifier: add customisation to flash notification --- .../java/net/runelite/client/Notifier.java | 47 +++++++++++++++---- .../client/config/FlashNotification.java | 47 +++++++++++++++++++ .../client/config/RuneLiteConfig.java | 8 ++-- 3 files changed, 89 insertions(+), 13 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/config/FlashNotification.java diff --git a/runelite-client/src/main/java/net/runelite/client/Notifier.java b/runelite-client/src/main/java/net/runelite/client/Notifier.java index d1423f168e..b8f0b6f592 100644 --- a/runelite-client/src/main/java/net/runelite/client/Notifier.java +++ b/runelite-client/src/main/java/net/runelite/client/Notifier.java @@ -46,11 +46,13 @@ import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; +import net.runelite.api.Constants; import net.runelite.api.GameState; import net.runelite.client.chat.ChatColorType; import net.runelite.client.chat.ChatMessageBuilder; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.chat.QueuedMessage; +import net.runelite.client.config.FlashNotification; import net.runelite.client.config.RuneLiteConfig; import net.runelite.client.ui.ClientUI; import net.runelite.client.util.OSType; @@ -68,7 +70,8 @@ public class Notifier // Notifier properties private static final Color FLASH_COLOR = new Color(255, 0, 0, 70); - private static final int FLASH_DURATION = 2000; + private static final int MINIMUM_FLASH_DURATION_MILLIS = 2000; + private static final int MINIMUM_FLASH_DURATION_TICKS = MINIMUM_FLASH_DURATION_MILLIS / Constants.CLIENT_TICK_LENGTH; private final Client client; private final String appName; @@ -79,6 +82,7 @@ public class Notifier private final Path notifyIconPath; private final boolean terminalNotifierAvailable; private Instant flashStart; + private long mouseLastPressedMillis; @Inject private Notifier( @@ -146,9 +150,10 @@ public class Notifier .build()); } - if (runeLiteConfig.enableFlashNotification()) + if (runeLiteConfig.flashNotification() != FlashNotification.DISABLED) { flashStart = Instant.now(); + mouseLastPressedMillis = client.getMouseLastPressedMillis(); } log.debug(message); @@ -156,24 +161,48 @@ public class Notifier public void processFlash(final Graphics2D graphics) { - if (flashStart == null || client.getGameCycle() % 40 >= 20) - { - return; - } - else if (client.getGameState() != GameState.LOGGED_IN) + if (flashStart == null || client.getGameState() != GameState.LOGGED_IN) { flashStart = null; return; } + FlashNotification flashNotification = runeLiteConfig.flashNotification(); + + if (client.getGameCycle() % 40 >= 20 + // For solid colour, fall through every time. + && (flashNotification == FlashNotification.FLASH_TWO_SECONDS + || flashNotification == FlashNotification.FLASH_UNTIL_CANCELLED)) + { + return; + } + final Color color = graphics.getColor(); graphics.setColor(FLASH_COLOR); graphics.fill(new Rectangle(client.getCanvas().getSize())); graphics.setColor(color); - if (Instant.now().minusMillis(FLASH_DURATION).isAfter(flashStart)) + if (!Instant.now().minusMillis(MINIMUM_FLASH_DURATION_MILLIS).isAfter(flashStart)) { - flashStart = null; + return; + } + + switch (flashNotification) + { + case FLASH_TWO_SECONDS: + case SOLID_TWO_SECONDS: + flashStart = null; + break; + case SOLID_UNTIL_CANCELLED: + case FLASH_UNTIL_CANCELLED: + // Any interaction with the client since the notification started will cancel it after the minimum duration + if (client.getMouseIdleTicks() < MINIMUM_FLASH_DURATION_TICKS + || client.getKeyboardIdleTicks() < MINIMUM_FLASH_DURATION_TICKS + || client.getMouseLastPressedMillis() > mouseLastPressedMillis) + { + flashStart = null; + } + break; } } diff --git a/runelite-client/src/main/java/net/runelite/client/config/FlashNotification.java b/runelite-client/src/main/java/net/runelite/client/config/FlashNotification.java new file mode 100644 index 0000000000..f90ce26ad2 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/config/FlashNotification.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2019, Twiglet1022 + * 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.config; + +import lombok.Getter; +import lombok.RequiredArgsConstructor; + +@Getter +@RequiredArgsConstructor +public enum FlashNotification +{ + DISABLED("Off"), + FLASH_TWO_SECONDS("Flash for 2 seconds"), + SOLID_TWO_SECONDS("Solid for 2 seconds"), + FLASH_UNTIL_CANCELLED("Flash until cancelled"), + SOLID_UNTIL_CANCELLED("Solid until cancelled"); + + private final String type; + + @Override + public String toString() + { + return type; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java b/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java index 546f7e77bc..13b1f5dee6 100644 --- a/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/config/RuneLiteConfig.java @@ -175,14 +175,14 @@ public interface RuneLiteConfig extends Config } @ConfigItem( - keyName = "notificationFlash", - name = "Enable flash notification", + keyName = "flashNotification", + name = "Flash notification", description = "Flashes the game frame as a notification", position = 24 ) - default boolean enableFlashNotification() + default FlashNotification flashNotification() { - return false; + return FlashNotification.DISABLED; } @ConfigItem( From 6b5863d3639f85aec8cf918f7a9de5f33c3c848e Mon Sep 17 00:00:00 2001 From: vanni <43923017+gazivodag@users.noreply.github.com> Date: Wed, 19 Jun 2019 18:53:00 -0400 Subject: [PATCH 072/117] Blackjack update (#656) * (More) efficient blackjacking isKnockedOut is no longer being used to swap menu entrys. So it was removed Added other message to trigger knockout tick. This pickpockets the bandit when he aggros you preventing trading damage and better xp/h * Pickpocket toggle and changes Toggleable pickpocket on aggro to save food which means less trips Made both strings static and global --- .../plugins/blackjack/BlackjackConfig.java | 43 +++++++++++++++++++ .../plugins/blackjack/BlackjackPlugin.java | 36 ++++++++++------ 2 files changed, 67 insertions(+), 12 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackConfig.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackConfig.java new file mode 100644 index 0000000000..803d19a662 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackConfig.java @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2019, gazivodag + * 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.blackjack; + +import net.runelite.client.config.Config; +import net.runelite.client.config.ConfigGroup; +import net.runelite.client.config.ConfigItem; + +@ConfigGroup("blackjack") +public interface BlackjackConfig extends Config +{ + @ConfigItem( + keyName = "pickpocketOnAggro", + name = "Pickpocket when aggro\'d", + description = "Switches to \"Pickpocket\" when bandit is aggro\'d. Saves food at the cost of slight xp/h." + ) + default boolean pickpocketOnAggro() + { + return false; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackPlugin.java index 498971094a..b5d6c2f635 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/blackjack/BlackjackPlugin.java @@ -26,6 +26,7 @@ */ package net.runelite.client.plugins.blackjack; +import com.google.inject.Provides; import javax.inject.Inject; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; @@ -35,6 +36,7 @@ import net.runelite.api.GameState; import net.runelite.api.Varbits; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.MenuEntryAdded; +import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; import net.runelite.client.menus.MenuManager; import net.runelite.client.plugins.Plugin; @@ -48,38 +50,49 @@ import org.apache.commons.lang3.RandomUtils; * Authors gazivodag longstreet */ @PluginDescriptor( - name = "Blackjack", - description = "Allows for one-click blackjacking, both knocking out and pickpocketing", - tags = {"blackjack", "thieving"}, - type = PluginType.SKILLING, - enabledByDefault = false + name = "Blackjack", + description = "Allows for one-click blackjacking, both knocking out and pickpocketing", + tags = {"blackjack", "thieving"}, + type = PluginType.SKILLING, + enabledByDefault = false ) @Singleton @Slf4j public class BlackjackPlugin extends Plugin { + private static final String SUCCESS_BLACKJACK = "You smack the bandit over the head and render them unconscious."; + private static final String FAILED_BLACKJACK = "Your blow only glances off the bandit's head."; private static final int POLLNIVNEACH_REGION = 13358; + private long nextKnockOutTick = 0; @Inject private Client client; @Inject private MenuManager menuManager; - private boolean isKnockedOut = false; - private long nextKnockOutTick = 0; + @Inject + private BlackjackConfig config; + + + @Provides + BlackjackConfig getConfig(ConfigManager configManager) + { + return configManager.getConfig(BlackjackConfig.class); + } + @Subscribe public void onMenuEntryAdded(MenuEntryAdded event) { if (client.getGameState() != GameState.LOGGED_IN || - client.getVar(Varbits.QUEST_THE_FEUD) < 13 || - client.getLocalPlayer().getWorldLocation().getRegionID() != POLLNIVNEACH_REGION) + client.getVar(Varbits.QUEST_THE_FEUD) < 13 || + client.getLocalPlayer().getWorldLocation().getRegionID() != POLLNIVNEACH_REGION) { return; } String option = Text.removeTags(event.getOption().toLowerCase()); String target = Text.removeTags(event.getTarget().toLowerCase()); - if (isKnockedOut && nextKnockOutTick >= client.getTickCount()) + if (nextKnockOutTick >= client.getTickCount()) { MenuUtil.swap(client, "pickpocket", option, target); } @@ -94,9 +107,8 @@ public class BlackjackPlugin extends Plugin { if (event.getType() == ChatMessageType.SPAM) { - if (event.getMessage().equals("You smack the bandit over the head and render them unconscious.")) + if (event.getMessage().equals(SUCCESS_BLACKJACK) ^ (event.getMessage().equals(FAILED_BLACKJACK) && config.pickpocketOnAggro())) { - isKnockedOut = true; nextKnockOutTick = client.getTickCount() + RandomUtils.nextInt(3, 4); } } From 2a0bf66e3b58b8d3818662214b8d9ebbadc67c68 Mon Sep 17 00:00:00 2001 From: Ganom Date: Wed, 19 Jun 2019 19:25:11 -0400 Subject: [PATCH 073/117] Fix Combat Counter Tables (#663) * Fix Alignments * Fix Alignment --- .../client/plugins/combatcounter/CombatOverlay.java | 10 +++++++--- .../client/plugins/combatcounter/DamageOverlay.java | 8 +++++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatOverlay.java index 7b0c039e44..7f97d6ab42 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/CombatOverlay.java @@ -38,6 +38,7 @@ import net.runelite.client.ui.overlay.OverlayMenuEntry; 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.TableAlignment; import net.runelite.client.ui.overlay.components.table.TableComponent; import net.runelite.client.util.ColorUtil; @@ -66,8 +67,6 @@ class CombatOverlay extends Overlay getMenuEntries().add(new OverlayMenuEntry(RUNELITE_OVERLAY_CONFIG, OPTION_CONFIGURE, "Tick Counter")); } - - @Override public Dimension render(Graphics2D graphics) { @@ -77,12 +76,15 @@ class CombatOverlay extends Overlay Player local = client.getLocalPlayer(); if (local == null || local.getName() == null) + { return null; + } panelComponent.setBackgroundColor(config.bgColor()); panelComponent.getChildren().add(TitleComponent.builder().text("Tick Counter").color(config.titleColor()).build()); int total = 0; TableComponent tableComponent = new TableComponent(); + tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); if (plugin.getCounter().isEmpty()) { @@ -92,7 +94,9 @@ class CombatOverlay extends Overlay { Map map = this.plugin.getCounter(); if (map == null) + { return null; + } for (String name : map.keySet()) { @@ -127,4 +131,4 @@ class CombatOverlay extends Overlay return null; } } -} \ No newline at end of file +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/DamageOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/DamageOverlay.java index 47f5839a59..998246ccf2 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/DamageOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/combatcounter/DamageOverlay.java @@ -37,6 +37,7 @@ import net.runelite.client.ui.overlay.OverlayMenuEntry; 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.TableAlignment; import net.runelite.client.ui.overlay.components.table.TableComponent; import net.runelite.client.util.ColorUtil; @@ -76,11 +77,14 @@ class DamageOverlay extends Overlay Player local = client.getLocalPlayer(); if (local == null || local.getName() == null) + { return null; + } panelComponent.setBackgroundColor(config.bgColor()); panelComponent.getChildren().add(TitleComponent.builder().text("Damage Counter").color(config.titleColor()).build()); TableComponent tableComponent = new TableComponent(); + tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); if (plugin.getCounter().isEmpty()) { @@ -90,7 +94,9 @@ class DamageOverlay extends Overlay { Map map = this.plugin.playerDamage; if (map == null) + { return null; + } for (String name : map.keySet()) { @@ -123,4 +129,4 @@ class DamageOverlay extends Overlay return null; } } -} \ No newline at end of file +} From cdd272b2a6c2b7cb34cd420a9c507b1ec1c3696b Mon Sep 17 00:00:00 2001 From: ThatGamerBlue Date: Thu, 20 Jun 2019 00:25:43 +0100 Subject: [PATCH 074/117] Make whale watchers overlay moveable (#661) --- .../client/plugins/whalewatchers/WhaleWatchersOverlay.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersOverlay.java index 6158d791b6..5ea462699b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/whalewatchers/WhaleWatchersOverlay.java @@ -47,8 +47,8 @@ public class WhaleWatchersOverlay extends Overlay this.plugin = plugin; setLayer(OverlayLayer.ABOVE_WIDGETS); setPriority(OverlayPriority.HIGHEST); - setPosition(OverlayPosition.DYNAMIC); - this.setPreferredPosition(OverlayPosition.TOP_CENTER); + setPosition(OverlayPosition.TOP_LEFT); + this.setPreferredPosition(OverlayPosition.TOP_LEFT); panelComponent = new PanelComponent(); } From 72c3963215af1a274ca7584e8696d8ab322fae04 Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Thu, 20 Jun 2019 00:31:11 +0100 Subject: [PATCH 075/117] Questcape menuentry (#658) * Update MenuEntrySwapperPlugin.java * Create QuestCapeMode.java * Update MenuEntrySwapperConfig.java * Update QuestCapeMode.java rip * Update MenuEntrySwapperPlugin.java --- .../MenuEntrySwapperConfig.java | 28 +++++++++++++++++++ .../MenuEntrySwapperPlugin.java | 7 +++++ .../menuentryswapper/util/QuestCapeMode.java | 20 +++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/QuestCapeMode.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java index 7d13fc6408..d4fd2aabf4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperConfig.java @@ -41,12 +41,14 @@ import net.runelite.client.plugins.menuentryswapper.util.MaxCapeMode; import net.runelite.client.plugins.menuentryswapper.util.NecklaceOfPassageMode; import net.runelite.client.plugins.menuentryswapper.util.ObeliskMode; import net.runelite.client.plugins.menuentryswapper.util.OccultAltarMode; +import net.runelite.client.plugins.menuentryswapper.util.QuestCapeMode; import net.runelite.client.plugins.menuentryswapper.util.RingOfWealthMode; import net.runelite.client.plugins.menuentryswapper.util.SkillsNecklaceMode; import net.runelite.client.plugins.menuentryswapper.util.SlayerRingMode; import net.runelite.client.plugins.menuentryswapper.util.XericsTalismanMode; + @ConfigGroup("menuentryswapper") public interface MenuEntrySwapperConfig extends Config { @@ -293,6 +295,32 @@ public interface MenuEntrySwapperConfig extends Config { return true; } + + @ConfigItem( + keyName = "swapQuestCape", + name = "Swap Quest Cape", + description = "Enables swapping Quest cape options in worn interface.", + position = 19, + group = "Equipment swapper" + ) + default boolean swapQuestCape() + { + return false; + } + + @ConfigItem( + keyName = "questCapeMode", + name = "Mode", + description = "", + position = 20, + group = "Equipment swapper", + hidden = true, + unhide = "swapQuestCape" + ) + default QuestCapeMode questCapeMode() + { + return QuestCapeMode.TELEPORT; + } //------------------------------------------------------------// diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java index dac8fd8c09..31af4a8239 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/MenuEntrySwapperPlugin.java @@ -1428,6 +1428,10 @@ public class MenuEntrySwapperPlugin extends Plugin { menuManager.addSwap("remove", "max cape", config.maxMode().toString()); } + if (config.swapQuestCape()) + { + menuManager.addSwap("remove", "quest point cape", config.questCapeMode().toString()); + } } private void removeSwaps() @@ -1444,6 +1448,9 @@ public class MenuEntrySwapperPlugin extends Plugin menuManager.removeSwaps("slayer ring"); menuManager.removeSwaps("xeric's talisman"); menuManager.removeSwaps("ring of wealth"); + menuManager.removeSwaps("max cape"); + menuManager.removeSwaps("quest point cape"); + } private void delete(int target) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/QuestCapeMode.java b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/QuestCapeMode.java new file mode 100644 index 0000000000..813787bd10 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/menuentryswapper/util/QuestCapeMode.java @@ -0,0 +1,20 @@ +package net.runelite.client.plugins.menuentryswapper.util; + +public enum QuestCapeMode +{ + TRIM("Trim"), + TELEPORT ("Teleport"); + + private final String name; + + QuestCapeMode(String name) + { + this.name = name; + } + + @Override + public String toString() + { + return name; + } +} From 4fbc35de962d73ec1809b79bf3b44722a9af56f9 Mon Sep 17 00:00:00 2001 From: pklite <46624825+pklite@users.noreply.github.com> Date: Thu, 20 Jun 2019 04:41:15 -0400 Subject: [PATCH 076/117] Adds an overlay for the local player counter (#669) * Adds an overlay for friendly/enemy player count from PvP tools Signed-off-by: PKLite * Prevents local player from being added to count Signed-off-by: PKLite --- .../plugins/pvptools/PlayerCountOverlay.java | 63 +++++++++++++++++++ .../plugins/pvptools/PvpToolsPlugin.java | 29 ++++++--- 2 files changed, 83 insertions(+), 9 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PlayerCountOverlay.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PlayerCountOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PlayerCountOverlay.java new file mode 100644 index 0000000000..1cb2079421 --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PlayerCountOverlay.java @@ -0,0 +1,63 @@ +/* + * ****************************************************************************** + * * Copyright (c) 2019 RuneLitePlus + * * Redistributions and modifications of this software are permitted as long as this notice remains in its original unmodified state at the top of this file. + * * If there are any questions comments, or feedback about this software, please direct all inquiries directly to the file authors: + * * ST0NEWALL#9112 + * * RuneLitePlus Discord: https://discord.gg/Q7wFtCe + * * RuneLitePlus website: https://runelitepl.us + * ***************************************************************************** + */ + +package net.runelite.client.plugins.pvptools; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics2D; +import java.util.Arrays; +import javax.inject.Inject; +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.OverlayPriority; +import net.runelite.client.ui.overlay.components.table.TableComponent; +import net.runelite.client.ui.overlay.components.table.TableElement; +import net.runelite.client.ui.overlay.components.table.TableRow; + +public class PlayerCountOverlay extends Overlay +{ + + private final PvpToolsPlugin pvpToolsPlugin; + private final PvpToolsConfig config; + + @Inject + public PlayerCountOverlay(PvpToolsPlugin pvpToolsPlugin, PvpToolsConfig pvpToolsConfig) + { + this.pvpToolsPlugin = pvpToolsPlugin; + this.config = pvpToolsConfig; + setLayer(OverlayLayer.ABOVE_WIDGETS); + setPriority(OverlayPriority.HIGHEST); + setPosition(OverlayPosition.TOP_LEFT); + this.setPreferredPosition(OverlayPosition.TOP_LEFT); + } + + @Override + public Dimension render(Graphics2D graphics) + { + if (config.countPlayers()) + { + TableComponent tableComponent = new TableComponent(); + TableElement[] firstRowElements = { + TableElement.builder().content("Friendly").color(Color.GREEN).build(), + TableElement.builder().content(String.valueOf(pvpToolsPlugin.getFriendlyPlayerCount())).build()}; + TableRow firstRow = TableRow.builder().elements(Arrays.asList(firstRowElements)).build(); + TableElement[] secondRowElements = { + TableElement.builder().content("Enemy").color(Color.RED).build(), + TableElement.builder().content(String.valueOf(pvpToolsPlugin.getEnemyPlayerCount())).build()}; + TableRow secondRow = TableRow.builder().elements(Arrays.asList(secondRowElements)).build(); + tableComponent.addRows(firstRow, secondRow); + return tableComponent.render(graphics); + } + return null; + } +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPlugin.java index 1b9856210d..39ed25ccda 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PvpToolsPlugin.java @@ -78,6 +78,9 @@ public class PvpToolsPlugin extends Plugin @Inject PvpToolsOverlay pvpToolsOverlay; + @Inject + PlayerCountOverlay playerCountOverlay; + boolean fallinHelperEnabled = false; private PvpToolsPanel panel; private MissingPlayersJFrame missingPlayersJFrame; @@ -185,6 +188,10 @@ public class PvpToolsPlugin extends Plugin private int[] overheadCount = new int[]{0, 0, 0}; private List ignoredSpells = new ArrayList(); + @Getter + private int enemyPlayerCount = 0; + @Getter + private int friendlyPlayerCount = 0; private List getMissingMembers() { @@ -241,6 +248,7 @@ public class PvpToolsPlugin extends Plugin protected void startUp() throws Exception { overlayManager.add(pvpToolsOverlay); + overlayManager.add(playerCountOverlay); keyManager.registerKeyListener(fallinHotkeyListener); keyManager.registerKeyListener(renderselfHotkeyListener); @@ -278,6 +286,7 @@ public class PvpToolsPlugin extends Plugin protected void shutDown() throws Exception { overlayManager.remove(pvpToolsOverlay); + overlayManager.remove(playerCountOverlay); keyManager.unregisterKeyListener(fallinHotkeyListener); keyManager.unregisterKeyListener(renderselfHotkeyListener); clientToolbar.removeNavigation(navButton); @@ -534,35 +543,37 @@ public class PvpToolsPlugin extends Plugin panel.numMeleeJLabel.repaint(); } - /** - * - */ + private void updatePlayers() { + friendlyPlayerCount = 0; + enemyPlayerCount = 0; if (config.countPlayers()) { - int cc = 0; - int other = 0; for (Player p : client.getPlayers()) { if (Objects.nonNull(p)) { + if (p.equals(client.getLocalPlayer())) + { + continue; + } if (PvPUtil.isAttackable(client, p)) { if (p.isClanMember()) { - cc++; + friendlyPlayerCount++; } else { - other++; + enemyPlayerCount++; } } } } - panel.numOther.setText(htmlLabel("Other Player Count: ", String.valueOf(other))); - panel.numCC.setText(htmlLabel("Friendly Player Count: ", String.valueOf(cc))); + panel.numOther.setText(htmlLabel("Other Player Count: ", String.valueOf(enemyPlayerCount))); + panel.numCC.setText(htmlLabel("Friendly Player Count: ", String.valueOf(friendlyPlayerCount))); panel.numCC.repaint(); panel.numOther.repaint(); } From 850ebe30fd2cc88fbc17644e2c44d594a86a8c9f Mon Sep 17 00:00:00 2001 From: pklite <46624825+pklite@users.noreply.github.com> Date: Thu, 20 Jun 2019 04:41:54 -0400 Subject: [PATCH 077/117] Adds an overlay for the local player counter (#669) * Adds an overlay for friendly/enemy player count from PvP tools Signed-off-by: PKLite * Prevents local player from being added to count Signed-off-by: PKLite From 1e18bc9c65402e07bacc5aee0726065a8a959c4c Mon Sep 17 00:00:00 2001 From: pklite <46624825+pklite@users.noreply.github.com> Date: Thu, 20 Jun 2019 06:30:42 -0400 Subject: [PATCH 078/117] Adds an overlay for the local player counter (#669) * Adds an overlay for friendly/enemy player count from PvP tools Signed-off-by: PKLite * Prevents local player from being added to count Signed-off-by: PKLite From 11883a9d01ad8e77029d130756b76302584fd388 Mon Sep 17 00:00:00 2001 From: Ganom Date: Thu, 20 Jun 2019 06:31:01 -0400 Subject: [PATCH 079/117] Accurate Tick Timers for Aoe Warnings (#667) * Udate Aoe Warnings to include Tick Timings. * Remove Debug Output * Remove Tick Timers for certain projectiles, as they would be useless. --- .../plugins/aoewarnings/AoeProjectile.java | 35 +-- .../plugins/aoewarnings/AoeWarningConfig.java | 215 +++++++++++++----- .../aoewarnings/AoeWarningOverlay.java | 55 ++++- .../plugins/aoewarnings/AoeWarningPlugin.java | 36 ++- 4 files changed, 244 insertions(+), 97 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectile.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectile.java index 956f8f74e6..a00d79e403 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectile.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeProjectile.java @@ -28,40 +28,17 @@ package net.runelite.client.plugins.aoewarnings; import java.time.Instant; +import lombok.AllArgsConstructor; +import lombok.Getter; import net.runelite.api.coords.LocalPoint; +@Getter +@AllArgsConstructor class AoeProjectile { private final Instant startTime; private final LocalPoint targetPoint; private final AoeProjectileInfo aoeProjectileInfo; private final int projectileLifetime; - - AoeProjectile(Instant startTime, LocalPoint targetPoint, AoeProjectileInfo aoeProjectileInfo, int projectileLifetime) - { - this.startTime = startTime; - this.targetPoint = targetPoint; - this.aoeProjectileInfo = aoeProjectileInfo; - this.projectileLifetime = projectileLifetime; - } - - Instant getStartTime() - { - return startTime; - } - - LocalPoint getTargetPoint() - { - return targetPoint; - } - - AoeProjectileInfo getAoeProjectileInfo() - { - return aoeProjectileInfo; - } - - int getProjectileLifetime() - { - return projectileLifetime; - } -} + private final int finalTick; +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java index 486316f39c..38d0798ab7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningConfig.java @@ -27,14 +27,36 @@ package net.runelite.client.plugins.aoewarnings; import java.awt.Color; +import java.awt.Font; +import lombok.AllArgsConstructor; +import lombok.Getter; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import net.runelite.client.config.Range; import net.runelite.client.config.Stub; @ConfigGroup("aoe") public interface AoeWarningConfig extends Config { + @Getter + @AllArgsConstructor + public enum FontStyle + { + BOLD("Bold", Font.BOLD), + ITALIC("Italic", Font.ITALIC), + PLAIN("Plain", Font.PLAIN); + + private String name; + private int font; + + @Override + public String toString() + { + return getName(); + } + } + @ConfigItem( keyName = "aoeNotifyAll", name = "Notify for all AoE warnings", @@ -105,11 +127,82 @@ public interface AoeWarningConfig extends Config return true; } + @ConfigItem( + keyName = "tickTimers", + name = "Tick Timers", + description = "Configures whether or not AoE Projectile Warnings has tick timers overlaid as well.", + parent = "overlayStub", + position = 6 + ) + default boolean tickTimers() + { + return true; + } + + @ConfigItem( + position = 7, + keyName = "text", + name = "Text", + description = "", + hidden = true, + unhide = "tickTimers" + ) + default Stub text() + { + return new Stub(); + } + + @ConfigItem( + position = 8, + keyName = "fontStyle", + name = "Font Style", + description = "Bold/Italics/Plain", + parent = "text", + hidden = true, + unhide = "tickTimers" + ) + default FontStyle fontStyle() + { + return FontStyle.BOLD; + } + + @Range( + min = 20, + max = 40 + ) + @ConfigItem( + position = 9, + keyName = "textSize", + name = "Text Size", + description = "Text Size for Timers.", + parent = "text", + hidden = true, + unhide = "tickTimers" + ) + default int textSize() + { + return 32; + } + + @ConfigItem( + position = 10, + keyName = "shadows", + name = "Shadows", + description = "Adds Shadows to text.", + parent = "text", + hidden = true, + unhide = "tickTimers" + ) + default boolean shadows() + { + return true; + } + @ConfigItem( keyName = "npcStub", name = "NPC's", description = "", - position = 6 + position = 11 ) default Stub npcStub() { @@ -120,7 +213,7 @@ public interface AoeWarningConfig extends Config keyName = "lizardmanaoeStub", name = "Lizardman Shamans", description = "", - position = 7, + position = 12, parent = "npcStub" ) default Stub lizardmanaoeStub() @@ -133,7 +226,7 @@ public interface AoeWarningConfig extends Config name = "Lizardman Shamans", description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans is displayed", parent = "lizardmanaoeStub", - position = 8 + position = 13 ) default boolean isShamansEnabled() { @@ -145,7 +238,7 @@ public interface AoeWarningConfig extends Config name = "Lizardman Shamans Notify", description = "Configures whether or not AoE Projectile Warnings for Lizardman Shamans should trigger a notification", parent = "lizardmanaoeStub", - position = 9, + position = 14, hide = "aoeNotifyAll" ) default boolean isShamansNotifyEnabled() @@ -157,7 +250,7 @@ public interface AoeWarningConfig extends Config keyName = "archaeologistaoeStub", name = "Crazy Archaeologist", description = "", - position = 10, + position = 15, parent = "npcStub" ) default Stub archaeologistaoeStub() @@ -170,7 +263,7 @@ public interface AoeWarningConfig extends Config name = "Crazy Archaeologist", description = "Configures whether or not AoE Projectile Warnings for Archaeologist is displayed", parent = "archaeologistaoeStub", - position = 11 + position = 16 ) default boolean isArchaeologistEnabled() { @@ -182,7 +275,7 @@ public interface AoeWarningConfig extends Config name = "Crazy Archaeologist Notify", description = "Configures whether or not AoE Projectile Warnings for Crazy Archaeologist should trigger a notification", parent = "archaeologistaoeStub", - position = 12, + position = 17, hide = "aoeNotifyAll" ) default boolean isArchaeologistNotifyEnabled() @@ -194,7 +287,7 @@ public interface AoeWarningConfig extends Config keyName = "icedemonStub", name = "Ice Demon", description = "", - position = 13, + position = 18, parent = "npcStub" ) default Stub icedemonStub() @@ -207,7 +300,7 @@ public interface AoeWarningConfig extends Config name = "Ice Demon", description = "Configures whether or not AoE Projectile Warnings for Ice Demon is displayed", parent = "icedemonStub", - position = 14 + position = 19 ) default boolean isIceDemonEnabled() { @@ -219,7 +312,7 @@ public interface AoeWarningConfig extends Config name = "Ice Demon Notify", description = "Configures whether or not AoE Projectile Warnings for Ice Demon should trigger a notification", parent = "icedemonStub", - position = 15, + position = 20, hide = "aoeNotifyAll" ) default boolean isIceDemonNotifyEnabled() @@ -231,7 +324,7 @@ public interface AoeWarningConfig extends Config keyName = "vasaStub", name = "Vasa", description = "", - position = 16, + position = 21, parent = "npcStub" ) default Stub vasaStub() @@ -244,7 +337,7 @@ public interface AoeWarningConfig extends Config name = "Vasa", description = "Configures whether or not AoE Projectile Warnings for Vasa is displayed", parent = "vasaStub", - position = 17 + position = 22 ) default boolean isVasaEnabled() { @@ -256,7 +349,7 @@ public interface AoeWarningConfig extends Config name = "Vasa Notify", description = "Configures whether or not AoE Projectile Warnings for Vasa should trigger a notification", parent = "vasaStub", - position = 18, + position = 23, hide = "aoeNotifyAll" ) default boolean isVasaNotifyEnabled() @@ -268,7 +361,7 @@ public interface AoeWarningConfig extends Config keyName = "tektonStub", name = "Tekton", description = "", - position = 19, + position = 24, parent = "npcStub" ) default Stub tektonStub() @@ -281,7 +374,7 @@ public interface AoeWarningConfig extends Config name = "Tekton", description = "Configures whether or not AoE Projectile Warnings for Tekton is displayed", parent = "tektonStub", - position = 20 + position = 25 ) default boolean isTektonEnabled() { @@ -293,7 +386,7 @@ public interface AoeWarningConfig extends Config name = "Tekton Notify", description = "Configures whether or not AoE Projectile Warnings for Tekton should trigger a notification", parent = "tektonStub", - position = 21, + position = 26, hide = "aoeNotifyAll" ) default boolean isTektonNotifyEnabled() @@ -305,7 +398,7 @@ public interface AoeWarningConfig extends Config keyName = "vorkathStub", name = "Vorkath", description = "", - position = 22, + position = 27, parent = "npcStub" ) default Stub vorkathStub() @@ -318,7 +411,7 @@ public interface AoeWarningConfig extends Config name = "Vorkath", description = "Configures whether or not AoE Projectile Warnings for Vorkath are displayed", parent = "vorkathStub", - position = 23 + position = 28 ) default boolean isVorkathEnabled() { @@ -330,7 +423,7 @@ public interface AoeWarningConfig extends Config name = "Vorkath Notify", description = "Configures whether or not AoE Projectile Warnings for Vorkath should trigger a notification", parent = "vorkathStub", - position = 24, + position = 29, hide = "aoeNotifyAll" ) default boolean isVorkathNotifyEnabled() @@ -342,7 +435,7 @@ public interface AoeWarningConfig extends Config keyName = "galvekStub", name = "Galvek", description = "", - position = 25, + position = 30, parent = "npcStub" ) default Stub galvekStub() @@ -355,7 +448,7 @@ public interface AoeWarningConfig extends Config name = "Galvek", description = "Configures whether or not AoE Projectile Warnings for Galvek are displayed", parent = "galvekStub", - position = 26 + position = 31 ) default boolean isGalvekEnabled() { @@ -367,7 +460,7 @@ public interface AoeWarningConfig extends Config name = "Galvek Notify", description = "Configures whether or not AoE Projectile Warnings for Galvek should trigger a notification", parent = "galvekStub", - position = 27, + position = 32, hide = "aoeNotifyAll" ) default boolean isGalvekNotifyEnabled() @@ -379,7 +472,7 @@ public interface AoeWarningConfig extends Config keyName = "gargbossStub", name = "Gargoyle Boss", description = "", - position = 28, + position = 33, parent = "npcStub" ) default Stub gargbossStub() @@ -392,7 +485,7 @@ public interface AoeWarningConfig extends Config name = "Gargoyle Boss", description = "Configs whether or not AoE Projectile Warnings for Dawn/Dusk are displayed", parent = "gargbossStub", - position = 29 + position = 34 ) default boolean isGargBossEnabled() { @@ -404,7 +497,7 @@ public interface AoeWarningConfig extends Config name = "Gargoyle Boss Notify", description = "Configures whether or not AoE Projectile Warnings for Gargoyle Bosses should trigger a notification", parent = "gargbossStub", - position = 30, + position = 35, hide = "aoeNotifyAll" ) default boolean isGargBossNotifyEnabled() @@ -416,7 +509,7 @@ public interface AoeWarningConfig extends Config keyName = "vetionStub", name = "Vet'ion", description = "", - position = 31, + position = 36, parent = "npcStub" ) default Stub vetionStub() @@ -429,7 +522,7 @@ public interface AoeWarningConfig extends Config name = "Vet'ion", description = "Configures whether or not AoE Projectile Warnings for Vet'ion are displayed", parent = "vetionStub", - position = 32 + position = 37 ) default boolean isVetionEnabled() { @@ -441,7 +534,7 @@ public interface AoeWarningConfig extends Config name = "Vet'ion Notify", description = "Configures whether or not AoE Projectile Warnings for Vet'ion should trigger a notification", parent = "vetionStub", - position = 33, + position = 38, hide = "aoeNotifyAll" ) default boolean isVetionNotifyEnabled() @@ -453,7 +546,7 @@ public interface AoeWarningConfig extends Config keyName = "chaosfanaticStub", name = "Chaos Fanatic", description = "", - position = 34, + position = 39, parent = "npcStub" ) default Stub chaosfanaticStub() @@ -466,7 +559,7 @@ public interface AoeWarningConfig extends Config name = "Chaos Fanatic", description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic are displayed", parent = "chaosfanaticStub", - position = 35 + position = 40 ) default boolean isChaosFanaticEnabled() { @@ -478,7 +571,7 @@ public interface AoeWarningConfig extends Config name = "Chaos Fanatic Notify", description = "Configures whether or not AoE Projectile Warnings for Chaos Fanatic should trigger a notification", parent = "chaosfanaticStub", - position = 36, + position = 41, hide = "aoeNotifyAll" ) default boolean isChaosFanaticNotifyEnabled() @@ -490,7 +583,7 @@ public interface AoeWarningConfig extends Config keyName = "olmStub", name = "Olm", description = "", - position = 37, + position = 42, parent = "npcStub" ) default Stub olmStub() @@ -503,7 +596,7 @@ public interface AoeWarningConfig extends Config name = "Olm", description = "Configures whether or not AoE Projectile Warnings for The Great Olm are displayed", parent = "olmStub", - position = 38 + position = 43 ) default boolean isOlmEnabled() { @@ -515,7 +608,7 @@ public interface AoeWarningConfig extends Config name = "Olm Notify", description = "Configures whether or not AoE Projectile Warnings for Olm should trigger a notification", parent = "olmStub", - position = 39, + position = 44, hide = "aoeNotifyAll" ) default boolean isOlmNotifyEnabled() @@ -527,7 +620,7 @@ public interface AoeWarningConfig extends Config keyName = "olmBombStub", name = "Bombs", description = "", - position = 40, + position = 45, parent = "olmStub" ) default Stub olmBombsStub() @@ -540,7 +633,7 @@ public interface AoeWarningConfig extends Config name = "Olm Bombs", description = "Display a timer and colour-coded AoE for Olm's crystal-phase bombs.", parent = "olmBombStub", - position = 41 + position = 46 ) default boolean bombDisplay() { @@ -552,7 +645,7 @@ public interface AoeWarningConfig extends Config name = "Olm Bombs Notify", description = "Configures whether or not AoE Projectile Warnings for Olm Bombs should trigger a notification", parent = "olmBombStub", - position = 42, + position = 47, hide = "aoeNotifyAll" ) default boolean bombDisplayNotifyEnabled() @@ -564,7 +657,7 @@ public interface AoeWarningConfig extends Config keyName = "olmlightningStub", name = "Lightning Trails", description = "", - position = 43, + position = 48, parent = "olmStub" ) default Stub olmlightningStub() @@ -577,7 +670,7 @@ public interface AoeWarningConfig extends Config name = "Olm Lightning Trails", description = "Show Lightning Trails", parent = "olmlightningStub", - position = 44 + position = 49 ) default boolean LightningTrail() { @@ -589,7 +682,7 @@ public interface AoeWarningConfig extends Config name = "Olm Lightning Trails Notify", description = "Configures whether or not AoE Projectile Warnings for Olm Lightning Trails should trigger a notification", parent = "olmlightningStub", - position = 45, + position = 50, hide = "aoeNotifyAll" ) default boolean LightningTrailNotifyEnabled() @@ -601,7 +694,7 @@ public interface AoeWarningConfig extends Config keyName = "corpStub", name = "Corporeal Beast", description = "", - position = 46, + position = 51, parent = "npcStub" ) default Stub corpStub() @@ -614,7 +707,7 @@ public interface AoeWarningConfig extends Config name = "Corporeal Beast", description = "Configures whether or not AoE Projectile Warnings for the Corporeal Beast are displayed", parent = "corpStub", - position = 47 + position = 52 ) default boolean isCorpEnabled() { @@ -626,7 +719,7 @@ public interface AoeWarningConfig extends Config name = "Corporeal Beast Notify", description = "Configures whether or not AoE Projectile Warnings for Corporeal Beast should trigger a notification", parent = "corpStub", - position = 48, + position = 53, hide = "aoeNotifyAll" ) default boolean isCorpNotifyEnabled() @@ -638,7 +731,7 @@ public interface AoeWarningConfig extends Config keyName = "wintertodtStub", name = "Wintertodt", description = "", - position = 49, + position = 54, parent = "npcStub" ) default Stub wintertodtStub() @@ -651,7 +744,7 @@ public interface AoeWarningConfig extends Config name = "Wintertodt Snow Fall", description = "Configures whether or not AOE Projectile Warnings for the Wintertodt snow fall are displayed", parent = "wintertodtStub", - position = 50 + position = 55 ) default boolean isWintertodtEnabled() { @@ -663,7 +756,7 @@ public interface AoeWarningConfig extends Config name = "Wintertodt Snow Fall Notify", description = "Configures whether or not AoE Projectile Warnings for Wintertodt Snow Fall Notify should trigger a notification", parent = "wintertodtStub", - position = 51, + position = 56, hide = "aoeNotifyAll" ) default boolean isWintertodtNotifyEnabled() @@ -675,7 +768,7 @@ public interface AoeWarningConfig extends Config keyName = "xarpusStub", name = "Xarpus", description = "", - position = 52, + position = 57, parent = "npcStub" ) default Stub xarpusStub() @@ -688,7 +781,7 @@ public interface AoeWarningConfig extends Config name = "Xarpus", description = "Configures whether or not AOE Projectile Warnings for Xarpus are displayed", parent = "xarpusStub", - position = 53 + position = 58 ) default boolean isXarpusEnabled() { @@ -700,7 +793,7 @@ public interface AoeWarningConfig extends Config name = "Xarpus Notify", description = "Configures whether or not AoE Projectile Warnings for Xarpus should trigger a notification", parent = "xarpusStub", - position = 54, + position = 59, hide = "aoeNotifyAll" ) default boolean isXarpusNotifyEnabled() @@ -712,7 +805,7 @@ public interface AoeWarningConfig extends Config keyName = "addyDragsStub", name = "Addy Drags", description = "", - position = 55, + position = 60, parent = "npcStub" ) default Stub addyDragsStub() @@ -725,7 +818,7 @@ public interface AoeWarningConfig extends Config name = "Addy Drags", description = "Show Bad Areas", parent = "addyDragsStub", - position = 56 + position = 61 ) default boolean addyDrags() { @@ -737,7 +830,7 @@ public interface AoeWarningConfig extends Config name = "Addy Drags Notify", description = "Configures whether or not AoE Projectile Warnings for Addy Dragons should trigger a notification", parent = "addyDragsStub", - position = 57, + position = 62, hide = "aoeNotifyAll" ) default boolean addyDragsNotifyEnabled() @@ -749,7 +842,7 @@ public interface AoeWarningConfig extends Config keyName = "drakeStub", name = "Drakes", description = "", - position = 58, + position = 63, parent = "npcStub" ) default Stub drakeStub() @@ -762,7 +855,7 @@ public interface AoeWarningConfig extends Config name = "Drakes Breath", description = "Configures if Drakes Breath tile markers are displayed", parent = "drakeStub", - position = 59 + position = 64 ) default boolean isDrakeEnabled() { @@ -774,7 +867,7 @@ public interface AoeWarningConfig extends Config name = "Drakes Breath Notify", description = "Configures whether or not AoE Projectile Warnings for Drakes Breath should trigger a notification", parent = "drakeStub", - position = 60, + position = 65, hide = "aoeNotifyAll" ) default boolean isDrakeNotifyEnabled() @@ -786,7 +879,7 @@ public interface AoeWarningConfig extends Config keyName = "cerberusStub", name = "Cerberus", description = "", - position = 61, + position = 66, parent = "npcStub" ) default Stub cerberusStub() @@ -799,7 +892,7 @@ public interface AoeWarningConfig extends Config name = "Cerberus Fire", description = "Configures if Cerberus fire tile markers are displayed", parent = "cerberusStub", - position = 62 + position = 67 ) default boolean isCerbFireEnabled() { @@ -811,7 +904,7 @@ public interface AoeWarningConfig extends Config name = "Cerberus Fire Notify", description = "Configures whether or not AoE Projectile Warnings for Cerberus his fire should trigger a notification", parent = "cerberusStub", - position = 63, + position = 68, hide = "aoeNotifyAll" ) default boolean isCerbFireNotifyEnabled() @@ -823,7 +916,7 @@ public interface AoeWarningConfig extends Config keyName = "demonicGorillaStub", name = "Demonic Gorilla", description = "", - position = 64, + position = 69, parent = "npcStub" ) default Stub demonicGorillaStub() @@ -836,7 +929,7 @@ public interface AoeWarningConfig extends Config name = "Demonic Gorilla", description = "Configures if Demonic Gorilla boulder tile markers are displayed", parent = "demonicGorillaStub", - position = 65 + position = 70 ) default boolean isDemonicGorillaEnabled() { @@ -848,7 +941,7 @@ public interface AoeWarningConfig extends Config name = "Demonic Gorilla Notify", description = "Configures whether or not AoE Projectile Warnings for Demonic Gorilla boulders should trigger a notification", parent = "demonicGorillaStub", - position = 66, + position = 71, hide = "aoeNotifyAll" ) default boolean isDemonicGorillaNotifyEnabled() diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java index c6799ac343..179c9b8c02 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningOverlay.java @@ -30,8 +30,10 @@ package net.runelite.client.plugins.aoewarnings; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Dimension; +import java.awt.Font; import java.awt.Graphics2D; import java.awt.Polygon; +import java.awt.Rectangle; import java.time.Duration; import java.time.Instant; import java.util.Iterator; @@ -40,12 +42,14 @@ import javax.annotation.Nullable; import javax.inject.Inject; import net.runelite.api.Client; import net.runelite.api.Perspective; +import net.runelite.api.Point; import net.runelite.api.Projectile; import net.runelite.api.coords.LocalPoint; import net.runelite.api.coords.WorldPoint; 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 static net.runelite.client.util.ColorUtil.setAlphaComponent; public class AoeWarningOverlay extends Overlay @@ -95,7 +99,7 @@ public class AoeWarningOverlay extends Overlay for (Iterator it = projectiles.values().iterator(); it.hasNext(); ) { AoeProjectile aoeProjectile = it.next(); - + Color color; if (now.isAfter(aoeProjectile.getStartTime().plus(Duration.ofMillis(aoeProjectile.getProjectileLifetime())))) { it.remove(); @@ -111,6 +115,8 @@ public class AoeWarningOverlay extends Overlay // how far through the projectiles lifetime between 0-1. double progress = (System.currentTimeMillis() - aoeProjectile.getStartTime().toEpochMilli()) / (double) aoeProjectile.getProjectileLifetime(); + int tickProgress = aoeProjectile.getFinalTick() - client.getTickCount(); + int fillAlpha, outlineAlpha; if (config.isFadeEnabled()) { @@ -122,6 +128,14 @@ public class AoeWarningOverlay extends Overlay fillAlpha = FILL_START_ALPHA; outlineAlpha = OUTLINE_START_ALPHA; } + if (tickProgress == 0) + { + color = Color.RED; + } + else + { + color = Color.WHITE; + } if (fillAlpha < 0) { @@ -138,7 +152,7 @@ public class AoeWarningOverlay extends Overlay } if (outlineAlpha > 255) { - outlineAlpha = 255;//Make sure we don't pass in an invalid alpha + outlineAlpha = 255; } if (config.isOutlineEnabled()) @@ -146,7 +160,13 @@ public class AoeWarningOverlay extends Overlay graphics.setColor(new Color(setAlphaComponent(config.overlayColor().getRGB(), outlineAlpha), true)); graphics.drawPolygon(tilePoly); } - + if (config.tickTimers()) + { + if (tickProgress >= 0) + { + renderTextLocation(graphics, Integer.toString(tickProgress), config.textSize(), config.fontStyle().getFont(), color, centerPoint(tilePoly.getBounds())); + } + } graphics.setColor(new Color(setAlphaComponent(config.overlayColor().getRGB(), fillAlpha), true)); graphics.fillPolygon(tilePoly); } @@ -171,11 +191,36 @@ public class AoeWarningOverlay extends Overlay { return; } - //OverlayUtil.renderPolygon(graphics, poly, color); graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha)); graphics.setStroke(new BasicStroke(strokeWidth)); graphics.draw(poly); graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha)); graphics.fill(poly); } -} + + private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) + { + graphics.setFont(new Font("Arial", fontStyle, fontSize)); + if (canvasPoint != null) + { + final Point canvasCenterPoint = new Point( + canvasPoint.getX(), + canvasPoint.getY()); + final Point canvasCenterPoint_shadow = new Point( + canvasPoint.getX() + 1, + canvasPoint.getY() + 1); + if (config.shadows()) + { + OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); + } + OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); + } + } + + private Point centerPoint(Rectangle rect) + { + int x = (int) (rect.getX() + rect.getWidth() / 2); + int y = (int) (rect.getY() + rect.getHeight() / 2); + return new Point(x, y); + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java index b21c43a0fc..37375941d6 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/aoewarnings/AoeWarningPlugin.java @@ -147,11 +147,18 @@ public class AoeWarningPlugin extends Plugin int projectileId = projectile.getId(); int projectileLifetime = config.delay() + (projectile.getRemainingCycles() * 20); + int ticksRemaining = projectile.getRemainingCycles() / 30; + if (!isTickTimersEnabledForProjectileID(projectileId)) + { + ticksRemaining = 0; + } + int tickCycle = client.getTickCount() + ticksRemaining; AoeProjectileInfo aoeProjectileInfo = AoeProjectileInfo.getById(projectileId); - if (aoeProjectileInfo != null && isConfigEnabledForProjectileId(projectileId, false)) + if (aoeProjectileInfo != null + && isConfigEnabledForProjectileId(projectileId, false)) { LocalPoint targetPoint = event.getPosition(); - AoeProjectile aoeProjectile = new AoeProjectile(Instant.now(), targetPoint, aoeProjectileInfo, projectileLifetime); + AoeProjectile aoeProjectile = new AoeProjectile(Instant.now(), targetPoint, aoeProjectileInfo, projectileLifetime, tickCycle); projectiles.put(projectile, aoeProjectile); if (config.aoeNotifyAll() || isConfigEnabledForProjectileId(projectileId, true)) @@ -294,6 +301,31 @@ public class AoeWarningPlugin extends Plugin } } + private boolean isTickTimersEnabledForProjectileID(int projectileId) + { + AoeProjectileInfo projectileInfo = AoeProjectileInfo.getById(projectileId); + + if (projectileInfo == null) + { + return false; + } + + switch (projectileInfo) + { + case VASA_RANGED_AOE: + case VORKATH_POISON_POOL: + case VORKATH_SPAWN: + case VORKATH_TICK_FIRE: + case OLM_BURNING: + case OLM_FALLING_CRYSTAL_TRAIL: + case OLM_ACID_TRAIL: + case OLM_FIRE_LINE: + return false; + } + + return true; + } + private boolean isConfigEnabledForProjectileId(int projectileId, boolean notify) { AoeProjectileInfo projectileInfo = AoeProjectileInfo.getById(projectileId); From 7dec0ac448d04a16fd6ebb677fa1831cb318e755 Mon Sep 17 00:00:00 2001 From: Ganom Date: Thu, 20 Jun 2019 06:31:33 -0400 Subject: [PATCH 080/117] Clean up Cox Helper (#668) * Clean up Cox Helper * Small Fix-up * Add Graphics Objects to API --- .../main/java/net/runelite/api/GraphicID.java | 2 + .../client/plugins/coxhelper/CoxConfig.java | 51 +- ...rayAgainstOverlay.java => CoxInfoBox.java} | 106 ++- .../client/plugins/coxhelper/CoxOverlay.java | 436 ++++++---- .../client/plugins/coxhelper/CoxPlugin.java | 798 +++++++----------- .../client/plugins/coxhelper/FontStyle.java | 46 - .../plugins/coxhelper/NPCContainer.java | 120 +++ .../coxhelper/OlmCrippleTimerOverlay.java | 95 --- .../plugins/coxhelper/TimersOverlay.java | 231 ----- .../plugins/coxhelper/VanguardsHighlight.java | 97 --- .../plugins/coxhelper/VanguardsOverlay.java | 84 -- 11 files changed, 837 insertions(+), 1229 deletions(-) rename runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/{OlmPrayAgainstOverlay.java => CoxInfoBox.java} (56%) delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/FontStyle.java create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/NPCContainer.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmCrippleTimerOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/TimersOverlay.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsHighlight.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsOverlay.java diff --git a/runelite-api/src/main/java/net/runelite/api/GraphicID.java b/runelite-api/src/main/java/net/runelite/api/GraphicID.java index 17b47c4224..79ffd07145 100644 --- a/runelite-api/src/main/java/net/runelite/api/GraphicID.java +++ b/runelite-api/src/main/java/net/runelite/api/GraphicID.java @@ -52,5 +52,7 @@ public class GraphicID public static final int FLYING_FISH = 1387; public static final int OLM_BURN = 1351; public static final int OLM_TELEPORT = 1359; + public static final int OLM_HEAL = 1363; + public static final int OLM_CRYSTAL = 1447; public static final int XERIC_TELEPORT = 1612; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxConfig.java index 241e3b13f1..467e6afbf4 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxConfig.java @@ -26,6 +26,9 @@ package net.runelite.client.plugins.coxhelper; import java.awt.Color; +import java.awt.Font; +import lombok.AllArgsConstructor; +import lombok.Getter; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; @@ -36,6 +39,24 @@ import net.runelite.client.config.Stub; public interface CoxConfig extends Config { + @Getter + @AllArgsConstructor + public enum FontStyle + { + BOLD("Bold", Font.BOLD), + ITALIC("Italic", Font.ITALIC), + PLAIN("Plain", Font.PLAIN); + + private String name; + private int font; + + @Override + public String toString() + { + return getName(); + } + } + @ConfigItem( position = 1, keyName = "muttadileStub", @@ -48,12 +69,12 @@ public interface CoxConfig extends Config } @ConfigItem( position = 2, - keyName = "Muttadile", + keyName = "muttadile", name = "Muttadile Marker", description = "Places an overlay around muttadiles showing their melee range.", parent = "muttadileStub" ) - default boolean Muttadile() + default boolean muttadile() { return true; } @@ -71,12 +92,12 @@ public interface CoxConfig extends Config @ConfigItem( position = 4, - keyName = "Tekton", + keyName = "tekton", name = "Tekton Marker", description = "Places an overlay around Tekton showing his melee range.", parent = "tektonStub" ) - default boolean Tekton() + default boolean tekton() { return true; } @@ -106,12 +127,24 @@ public interface CoxConfig extends Config @ConfigItem( position = 6, - keyName = "Guardians", - name = "Guardians timing", + keyName = "guardians", + name = "Guardians Overlay", description = "Places an overlay near Guardians showing safespot.", parent = "guardiansStub" ) - default boolean Guardians() + default boolean guardians() + { + return true; + } + + @ConfigItem( + position = 6, + keyName = "guardinTickCounter", + name = "Guardians Tick Timing", + description = "Places an overlay on Guardians showing attack tick timers.", + parent = "guardiansStub" + ) + default boolean guardinTickCounter() { return true; } @@ -200,12 +233,12 @@ public interface CoxConfig extends Config @ConfigItem( position = 14, - keyName = "OlmTick", + keyName = "olmTick", name = "Olm Tick Counter", description = "Show Tick Counter on Olm", parent = "olmStub" ) - default boolean OlmTick() + default boolean olmTick() { return true; } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmPrayAgainstOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxInfoBox.java similarity index 56% rename from runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmPrayAgainstOverlay.java rename to runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxInfoBox.java index 04ba9d0247..405d13cc96 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmPrayAgainstOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxInfoBox.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, gazivodag + * Copyright (c) 2019, lyzrds * Copyright (c) 2019, ganom * All rights reserved. * @@ -33,70 +33,114 @@ import java.awt.Rectangle; import java.awt.image.BufferedImage; import javax.inject.Inject; import net.runelite.api.Client; +import net.runelite.api.NpcID; 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.components.ComponentConstants; -import net.runelite.client.ui.overlay.components.ComponentOrientation; import net.runelite.client.ui.overlay.components.InfoBoxComponent; import net.runelite.client.ui.overlay.components.PanelComponent; +import net.runelite.client.ui.overlay.components.TitleComponent; +import net.runelite.client.ui.overlay.components.table.TableAlignment; +import net.runelite.client.ui.overlay.components.table.TableComponent; +import net.runelite.client.util.ColorUtil; -class OlmPrayAgainstOverlay extends Overlay +public class CoxInfoBox extends Overlay { private static final Color NOT_ACTIVATED_BACKGROUND_COLOR = new Color(150, 0, 0, 150); private final CoxPlugin plugin; private final CoxConfig config; private final Client client; private final SpriteManager spriteManager; + private final PanelComponent prayAgainstPanel = new PanelComponent(); private final PanelComponent panelComponent = new PanelComponent(); @Inject - OlmPrayAgainstOverlay(CoxPlugin plugin, CoxConfig config, Client client, SpriteManager spriteManager) + CoxInfoBox(CoxPlugin plugin, CoxConfig config, Client client, SpriteManager spriteManager) { this.plugin = plugin; this.config = config; this.client = client; this.spriteManager = spriteManager; setPosition(OverlayPosition.BOTTOM_RIGHT); - panelComponent.setOrientation(ComponentOrientation.VERTICAL); + setPosition(OverlayPosition.DETACHED); } - public Dimension render(Graphics2D graphics2D) + @Override + public Dimension render(Graphics2D graphics) { panelComponent.getChildren().clear(); - - final PrayAgainst prayAgainst = plugin.getPrayAgainstOlm(); - if (plugin.getPrayAgainstOlm() == null && !config.prayAgainstOlm()) + if (plugin.inRaid()) { - return null; - } + prayAgainstPanel.getChildren().clear(); - if (System.currentTimeMillis() < (plugin.getLastPrayTime() + 120000) && plugin.getPrayAgainstOlm() != null) - { - InfoBoxComponent prayComponent = new InfoBoxComponent(); - Image prayImg = scaleImg(getPrayerImage(plugin.prayAgainstOlm)); - prayComponent.setImage(prayImg); - prayComponent.setColor(Color.WHITE); - prayComponent.setBackgroundColor(client.isPrayerActive(prayAgainst.getPrayer()) - ? ComponentConstants.STANDARD_BACKGROUND_COLOR - : NOT_ACTIVATED_BACKGROUND_COLOR); - prayComponent.setPreferredSize(new Dimension(40, 40)); - panelComponent.getChildren().add(prayComponent); + final PrayAgainst prayAgainst = plugin.getPrayAgainstOlm(); - panelComponent.setPreferredSize(new Dimension(40, 40)); - panelComponent.setBorder(new Rectangle(0, 0, 0, 0)); - return panelComponent.render(graphics2D); - } - else - { - plugin.setPrayAgainstOlm(null); + if (plugin.getPrayAgainstOlm() == null && !config.prayAgainstOlm()) + { + return null; + } + + if (System.currentTimeMillis() < (plugin.getLastPrayTime() + 120000) && plugin.getPrayAgainstOlm() != null) + { + InfoBoxComponent prayComponent = new InfoBoxComponent(); + Image prayImg = scaleImg(getPrayerImage(plugin.prayAgainstOlm)); + prayComponent.setImage(prayImg); + prayComponent.setColor(Color.WHITE); + prayComponent.setBackgroundColor(client.isPrayerActive(prayAgainst.getPrayer()) + ? ComponentConstants.STANDARD_BACKGROUND_COLOR + : NOT_ACTIVATED_BACKGROUND_COLOR); + prayComponent.setPreferredSize(new Dimension(40, 40)); + prayAgainstPanel.getChildren().add(prayComponent); + + prayAgainstPanel.setPreferredSize(new Dimension(40, 40)); + prayAgainstPanel.setBorder(new Rectangle(0, 0, 0, 0)); + return prayAgainstPanel.render(graphics); + } + else + { + plugin.setPrayAgainstOlm(null); + } + + if (config.vangHealth() && plugin.isRunVanguard()) + { + panelComponent.getChildren().add(TitleComponent.builder() + .text("Vanguards") + .color(Color.pink) + .build()); + + TableComponent tableComponent = new TableComponent(); + tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); + for (NPCContainer npcs : plugin.getNpcContainer().values()) + { + float percent = (float) npcs.getNpc().getHealthRatio() / npcs.getNpc().getHealth() * 100; + switch (npcs.getNpc().getId()) + { + case NpcID.VANGUARD_7527: + tableComponent.addRow(ColorUtil.prependColorTag("Melee", npcs.getAttackStyle().getColor()), + Integer.toString((int) percent)); + break; + case NpcID.VANGUARD_7528: + tableComponent.addRow(ColorUtil.prependColorTag("Range", npcs.getAttackStyle().getColor()), + Integer.toString((int) percent)); + break; + case NpcID.VANGUARD_7529: + tableComponent.addRow(ColorUtil.prependColorTag("Mage", npcs.getAttackStyle().getColor()), + Integer.toString((int) percent)); + break; + } + } + + panelComponent.getChildren().add(tableComponent); + + return panelComponent.render(graphics); + } } if (client.getLocalPlayer().getWorldLocation().getRegionID() == 4919) { plugin.setPrayAgainstOlm(null); } - return null; } @@ -134,6 +178,4 @@ class OlmPrayAgainstOverlay extends Overlay g.dispose(); return scaledImage; } - - } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxOverlay.java index 1fabeecbed..893b44ff94 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxOverlay.java @@ -34,9 +34,11 @@ import java.awt.Polygon; import java.util.Iterator; import java.util.List; import javax.inject.Inject; +import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.NPC; import net.runelite.api.NPCDefinition; +import net.runelite.api.NpcID; import net.runelite.api.Perspective; import net.runelite.api.Point; import net.runelite.api.coords.LocalPoint; @@ -51,8 +53,6 @@ import net.runelite.client.ui.overlay.OverlayUtil; public class CoxOverlay extends Overlay { private final Client client; - - private final CoxPlugin plugin; private final CoxConfig config; @@ -72,7 +72,6 @@ public class CoxOverlay extends Overlay { for (WorldPoint point : plugin.getOlm_Heal()) { - client.setHintArrow(point); drawTile(graphics, point, config.tpColor(), 2, 150, 50); } @@ -82,156 +81,260 @@ public class CoxOverlay extends Overlay drawTile(graphics, point, config.tpColor(), 2, 150, 50); } - if (plugin.isRunMutta()) + if (plugin.inRaid()) { - if (config.Muttadile()) + for (NPCContainer npcs : plugin.getNpcContainer().values()) { - NPC boss = plugin.getMomma_NPC(); - NPC baby = plugin.getMutta_NPC(); - if (boss != null) + Color color; + List hitSquares; + int ticksLeft; + switch (npcs.getNpc().getId()) { - int size = 1; - NPCDefinition composition = boss.getTransformedDefinition(); - { - size = composition.getSize(); - } - List meleeRangeMom = getHitSquares(boss.getWorldLocation(), size, 1, false); - for (WorldPoint p : meleeRangeMom) - { - drawTile(graphics, p, config.muttaColor(), 0, 0, 50); - } - } - if (baby != null) - { - int size = 1; - NPCDefinition compositionbaby = baby.getTransformedDefinition(); - { - size = compositionbaby.getSize(); - } - List meleeRange = getHitSquares(baby.getWorldLocation(), size, 1, false); - for (WorldPoint p : meleeRange) - { - drawTile(graphics, p, config.muttaColor(), 0, 0, 50); - } - } - } - } - - if (plugin.isRunGuard()) - { - if (config.Guardians()) - { - NPC G1 = plugin.getGuard1_NPC(); - NPC G2 = plugin.getGuard2_NPC(); - int tick = plugin.getGuardTick(); - if (tick == 5) - { - if (G1 != null) - { - int size = 1; - NPCDefinition composition = G1.getTransformedDefinition(); + case NpcID.TEKTON: + case NpcID.TEKTON_7541: + case NpcID.TEKTON_7542: + case NpcID.TEKTON_7545: + case NpcID.TEKTON_ENRAGED: + case NpcID.TEKTON_ENRAGED_7544: + if (config.tekton()) { - size = composition.getSize(); - } - List meleeRange = getHitSquares(G1.getWorldLocation(), size, 1, true); - for (WorldPoint p : meleeRange) - { - drawTile(graphics, p, config.guardColor(), 0, 0, 50); - } - } - if (G2 != null) - { - int size = 1; - NPCDefinition composition = G2.getTransformedDefinition(); - { - size = composition.getSize(); - } - List meleeRange = getHitSquares(G2.getWorldLocation(), size, 1, true); - for (WorldPoint p : meleeRange) - { - drawTile(graphics, p, config.guardColor(), 0, 0, 50); - } - } - } - } - } - - - if (plugin.isRunTekton()) - { - if (config.Tekton()) - { - NPC boss = plugin.getTekton_NPC(); - if (boss != null) - { - int size = 1; - NPCDefinition composition = boss.getTransformedDefinition(); - { - size = composition.getSize(); - } - List meleeRange = getHitSquares(boss.getWorldLocation(), size, 1, false); - for (WorldPoint p : meleeRange) - { - drawTile(graphics, p, config.tektonColor(), 0, 0, 50); - } - } - } - } - - if (plugin.isRunOlm()) - { - NPC boss = plugin.getOlm_NPC(); - - if (config.OlmTick()) - { - if (boss != null) - { - int tick = plugin.getOlm_TicksUntilAction(); - int cycle = plugin.getOlm_ActionCycle(); - int spec = plugin.getOlm_NextSpec(); - final String tickStr = String.valueOf(tick); - String cycleStr = "?"; - switch (cycle) - { - case 1: - switch (spec) + hitSquares = getHitSquares(npcs.getNpc().getWorldLocation(), npcs.getNpcSize(), 1, false); + for (WorldPoint p : hitSquares) { - case 1: - cycleStr = "Portals"; - break; - case 2: - cycleStr = "lightning"; - break; - case 3: - cycleStr = "Crystals"; - break; - case 4: - cycleStr = "Heal"; - break; - case -1: - cycleStr = "??"; - break; + drawTile(graphics, p, config.tektonColor(), 0, 0, 50); } - break; - case 2: - cycleStr = "Sauto"; - break; - case 3: - cycleStr = "Null"; - break; - case 4: - cycleStr = "Nauto"; - break; - case -1: - cycleStr = "??"; - break; + if (config.tektonTickCounter()) + { + ticksLeft = npcs.getTicksUntilAttack(); + int attackTicksleft = plugin.getTektonAttackTicks(); + if (ticksLeft > 0) + { + if (ticksLeft == 1) + { + color = npcs.getAttackStyle().getColor(); + } + else + { + color = Color.WHITE; + } + final String ticksLeftStr = String.valueOf(ticksLeft); + Point canvasPoint = npcs.getNpc().getCanvasTextLocation(graphics, ticksLeftStr, 0); + renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), color, canvasPoint); + } + } + if (config.tektonTickCounter()) + { + final int attackTicksleft = plugin.getTektonAttackTicks(); + String attacksLeftStr; + Color attackcolor; + if (attackTicksleft >= 0 && plugin.isTektonActive()) + { + if (attackTicksleft <= 1) + { + attackcolor = new Color(255, 0, 0, 255); + attacksLeftStr = "Phase Over"; + } + else + { + attackcolor = new Color(255, 255, 255, 255); + attacksLeftStr = String.valueOf(attackTicksleft); + } + + if (npcs.getNpc() != null) + { + Point canvasPoint = npcs.getNpc().getCanvasTextLocation(graphics, attacksLeftStr, 0); + renderTextLocationAbove(graphics, attacksLeftStr, config.textSize(), config.fontStyle().getFont(), attackcolor, canvasPoint); + } + } + } + } + break; + case NpcID.MUTTADILE: + case NpcID.MUTTADILE_7562: + case NpcID.MUTTADILE_7563: + if (config.muttadile()) + { + hitSquares = getHitSquares(npcs.getNpc().getWorldLocation(), npcs.getNpcSize(), 1, false); + for (WorldPoint p : hitSquares) + { + drawTile(graphics, p, config.muttaColor(), 0, 0, 50); + } + } + break; + case NpcID.GUARDIAN: + case NpcID.GUARDIAN_7570: + case NpcID.GUARDIAN_7571: + case NpcID.GUARDIAN_7572: + if (config.guardians()) + { + hitSquares = getHitSquares(npcs.getNpc().getWorldLocation(), npcs.getNpcSize(), 2, true); + for (WorldPoint p : hitSquares) + { + drawTile(graphics, p, config.guardColor(), 0, 0, 50); + } + } + if (config.guardinTickCounter()) + { + ticksLeft = npcs.getTicksUntilAttack(); + if (ticksLeft > 0) + { + if (ticksLeft == 1) + { + color = npcs.getAttackStyle().getColor(); + } + else + { + color = Color.WHITE; + } + final String ticksLeftStr = String.valueOf(ticksLeft); + Point canvasPoint = npcs.getNpc().getCanvasTextLocation(graphics, ticksLeftStr, 0); + renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), color, canvasPoint); + } + } + break; + case NpcID.VANGUARD_7526: + case NpcID.VANGUARD_7527: + case NpcID.VANGUARD_7528: + case NpcID.VANGUARD_7529: + if (config.vangHighlight()) + { + OverlayUtil.renderPolygon(graphics, npcs.getNpc().getConvexHull(), npcs.getAttackStyle().getColor()); + } + break; + } + } + + if (plugin.isHandCripple()) + { + int tick = plugin.getTimer(); + NPC olmHand = plugin.getHand(); + final String tickStr = String.valueOf(tick); + Point canvasPoint = olmHand.getCanvasTextLocation(graphics, tickStr, 50); + renderTextLocation(graphics, tickStr, config.textSize(), config.fontStyle().getFont(), Color.GRAY, canvasPoint); + } + + if (config.timers()) + { + if (plugin.getBurnTarget().size() > 0) + { + for (Actor actor : plugin.getBurnTarget()) + { + final int ticksLeft = plugin.getBurnTicks(); + String ticksLeftStr = String.valueOf(ticksLeft); + Color tickcolor = new Color(255, 255, 255, 255); + if (ticksLeft >= 0) + { + if (ticksLeft == 34 || + ticksLeft == 33 || + ticksLeft == 26 || + ticksLeft == 25 || + ticksLeft == 18 || + ticksLeft == 17 || + ticksLeft == 10 || + ticksLeft == 9 || + ticksLeft == 2 || + ticksLeft == 1) + { + tickcolor = new Color(255, 0, 0, 255); + ticksLeftStr = "GAP"; + } + else + { + tickcolor = new Color(255, 255, 255, 255); + } + Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0); + renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint); + } + } + } + + if (plugin.getAcidTarget() != null) + { + Actor actor = plugin.getAcidTarget(); + renderActorOverlay(graphics, actor, config.acidColor(), 2, 100, 10); + final int ticksLeft = plugin.getAcidTicks(); + Color tickcolor = new Color(255, 255, 255, 255); + if (ticksLeft > 0) + { + if (ticksLeft > 1) + { + tickcolor = new Color(69, 241, 44, 255); + } + else + { + tickcolor = new Color(255, 255, 255, 255); + } + final String ticksLeftStr = String.valueOf(ticksLeft); + Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0); + renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint); + } + } + } + + if (config.tpOverlay()) + { + if (plugin.getTeleportTarget() != null) + { + renderActorOverlay(graphics, plugin.getTeleportTarget(), new Color(193, 255, 245, 255), 2, 100, 10); + } + } + + if (plugin.isRunOlm()) + { + NPC boss = plugin.getOlm_NPC(); + + if (config.olmTick()) + { + if (boss != null) + { + int tick = plugin.getOlm_TicksUntilAction(); + int cycle = plugin.getOlm_ActionCycle(); + int spec = plugin.getOlm_NextSpec(); + final String tickStr = String.valueOf(tick); + String cycleStr = "?"; + switch (cycle) + { + case 1: + switch (spec) + { + case 1: + cycleStr = "Portals"; + break; + case 2: + cycleStr = "lightning"; + break; + case 3: + cycleStr = "Crystals"; + break; + case 4: + cycleStr = "Heal"; + break; + case -1: + cycleStr = "??"; + break; + } + break; + case 2: + cycleStr = "Sauto"; + break; + case 3: + cycleStr = "Null"; + break; + case 4: + cycleStr = "Nauto"; + break; + case -1: + cycleStr = "??"; + break; + } + final String combinedStr = cycleStr + ":" + tickStr; + Point canvasPoint = boss.getCanvasTextLocation(graphics, combinedStr, 130); + renderTextLocation(graphics, combinedStr, config.textSize(), config.fontStyle().getFont(), Color.WHITE, canvasPoint); } - final String combinedStr = cycleStr + ":" + tickStr; - Point canvasPoint = boss.getCanvasTextLocation(graphics, combinedStr, 130); - renderTextLocation(graphics, combinedStr, config.textSize(), config.fontStyle().getFont(), Color.WHITE, canvasPoint); } } } + return null; } @@ -282,6 +385,22 @@ public class CoxOverlay extends Overlay } } + private void renderActorOverlay(Graphics2D graphics, Actor actor, Color color, int outlineWidth, int outlineAlpha, int fillAlpha) + { + int size = 1; + LocalPoint lp = actor.getLocalLocation(); + Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); + + if (tilePoly != null) + { + graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha)); + graphics.setStroke(new BasicStroke(outlineWidth)); + graphics.draw(tilePoly); + graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha)); + graphics.fill(tilePoly); + } + } + private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) { graphics.setFont(new Font("Arial", fontStyle, fontSize)); @@ -301,6 +420,25 @@ public class CoxOverlay extends Overlay } } + private void renderTextLocationAbove(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) + { + graphics.setFont(new Font("Arial", fontStyle, fontSize)); + if (canvasPoint != null) + { + final Point canvasCenterPoint = new Point( + canvasPoint.getX(), + canvasPoint.getY() + 20); + final Point canvasCenterPoint_shadow = new Point( + canvasPoint.getX() + 1, + canvasPoint.getY() + 21); + if (config.shadows()) + { + OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); + } + OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); + } + } + private List getHitSquares(WorldPoint npcLoc, int npcSize, int thickness, boolean includeUnder) { List little = new WorldArea(npcLoc, npcSize, npcSize).toWorldPointList(); @@ -318,16 +456,4 @@ public class CoxOverlay extends Overlay } return big; } - - private void renderPoly(Graphics2D graphics, Color color, Polygon polygon) - { - if (polygon != null) - { - graphics.setColor(color); - graphics.setStroke(new BasicStroke(2)); - graphics.draw(polygon); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20)); - graphics.fill(polygon); - } - } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java index 3ce8afcc20..edff35fddb 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java @@ -29,7 +29,9 @@ package net.runelite.client.plugins.coxhelper; import com.google.inject.Provides; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; import javax.inject.Inject; @@ -51,13 +53,12 @@ import net.runelite.api.Projectile; import net.runelite.api.ProjectileID; import net.runelite.api.Varbits; import net.runelite.api.coords.WorldPoint; -import net.runelite.api.events.AnimationChanged; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameTick; -import net.runelite.api.events.SpotAnimationChanged; import net.runelite.api.events.NpcDespawned; import net.runelite.api.events.NpcSpawned; import net.runelite.api.events.ProjectileMoved; +import net.runelite.api.events.SpotAnimationChanged; import net.runelite.client.chat.ChatMessageManager; import net.runelite.client.config.ConfigManager; import net.runelite.client.eventbus.Subscribe; @@ -65,6 +66,7 @@ import net.runelite.client.plugins.Plugin; import net.runelite.client.plugins.PluginDescriptor; import net.runelite.client.plugins.PluginType; import net.runelite.client.ui.overlay.OverlayManager; +import net.runelite.client.util.Text; @PluginDescriptor( name = "CoX Helper", @@ -78,175 +80,79 @@ import net.runelite.client.ui.overlay.OverlayManager; @Singleton public class CoxPlugin extends Plugin { - private static final int GAMEOBJECT_ID_PSN = 30032; - private static final int GRAPHICSOBJECT_ID_CRYSTAL = 1447; - private static final int GRAPHICSOBJECT_ID_HEAL = 1363; private static final int ANIMATION_ID_G1 = 430; private static final String OLM_HAND_CRIPPLE = "The Great Olm\'s left claw clenches to protect itself temporarily."; private static final Pattern TP_REGEX = Pattern.compile("You have been paired with (.*)! The magical power will enact soon..."); - private int sleepcount = 0; - private boolean needOlm = false; - private GraphicsObject teleportObject; - - @Inject - private Client client; - - @Inject - private ChatMessageManager chatMessageManager; - - @Inject - private CoxOverlay overlay; - - @Inject - private TimersOverlay timersOverlay; - - @Inject - private CoxConfig config; - - @Inject - private OverlayManager overlayManager; - - @Inject - private OlmCrippleTimerOverlay olmCrippleTimerOverlay; - - @Inject - private OlmPrayAgainstOverlay prayAgainstOverlay; - - @Inject - private VanguardsHighlight vanguardsHighlight; - - @Inject - private VanguardsOverlay vanguardsOverlay; - @Setter @Getter(AccessLevel.PACKAGE) protected PrayAgainst prayAgainstOlm; - - @Getter(AccessLevel.PACKAGE) - private boolean runMutta; - - @Getter(AccessLevel.PACKAGE) - private boolean runTekton; - - @Getter(AccessLevel.PACKAGE) - private boolean runVanguards; - - @Getter(AccessLevel.PACKAGE) - private boolean runGuard = false; - - @Getter(AccessLevel.PACKAGE) - private boolean enrageStage = false; - - @Getter(AccessLevel.PACKAGE) - private boolean HandCripple; - - @Getter(AccessLevel.PACKAGE) - private boolean runOlm; - - @Getter(AccessLevel.PACKAGE) - private NPC rangeVang; - - @Getter(AccessLevel.PACKAGE) - private NPC mageVang; - - @Getter(AccessLevel.PACKAGE) - private NPC meleeVang; - - @Getter(AccessLevel.PACKAGE) - private NPC Guard1_NPC; - - @Getter(AccessLevel.PACKAGE) - private NPC Guard2_NPC; - - @Getter(AccessLevel.PACKAGE) - private NPC Tekton_NPC; - - @Getter(AccessLevel.PACKAGE) - private NPC hand; - - @Getter(AccessLevel.PACKAGE) - private NPC Olm_NPC; - - @Getter(AccessLevel.PACKAGE) - private NPC OlmMelee_NPC; - - @Getter(AccessLevel.PACKAGE) - private NPC Mutta_NPC; - - @Getter(AccessLevel.PACKAGE) - private NPC Momma_NPC; - - @Getter(AccessLevel.PACKAGE) - private List Olm_Crystals = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private List Olm_Heal = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private List Olm_TP = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private List Olm_PSN = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private List burnTarget = new ArrayList<>(); - - @Getter(AccessLevel.PACKAGE) - private Actor teleportTarget; - - @Getter(AccessLevel.PACKAGE) - private Actor acidTarget; - - @Getter(AccessLevel.PACKAGE) - private int mageVangHP = -1; - - @Getter(AccessLevel.PACKAGE) - private int rangeVangHP = -1; - - @Getter(AccessLevel.PACKAGE) - private int meleeVangHP = -1; - - @Getter(AccessLevel.PACKAGE) - private int timer = 45; - - @Getter(AccessLevel.PACKAGE) - private int burnTicks = 41; - - @Getter(AccessLevel.PACKAGE) - private int acidTicks = 25; - - @Getter(AccessLevel.PACKAGE) - private int teleportTicks = 10; - - @Getter(AccessLevel.PACKAGE) - private int tektonTicks; - - @Getter(AccessLevel.PACKAGE) - private int tektonAttacks; - - @Getter(AccessLevel.PACKAGE) - private int tektonAttackTicks; - - @Getter(AccessLevel.PACKAGE) - private int guardTick = -1; - - @Getter(AccessLevel.PACKAGE) - private int OlmPhase = 0; - - @Getter(AccessLevel.PACKAGE) - private int Olm_TicksUntilAction = -1; - - @Getter(AccessLevel.PACKAGE) - private int Olm_ActionCycle = -1; //4:0 = auto 3:0 = null 2:0 = auto 1:0 = spec + actioncycle =4 - - @Getter(AccessLevel.PACKAGE) - private int Olm_NextSpec = -1; // 1= crystals 2=lightnig 3=portals 4= heal hand if p4 - @Getter(AccessLevel.PACKAGE) protected long lastPrayTime; - + private int sleepcount = 0; + private boolean needOlm = false; + private GraphicsObject teleportObject; + @Inject + private Client client; + @Inject + private ChatMessageManager chatMessageManager; + @Inject + private CoxOverlay coxOverlay; + @Inject + private CoxInfoBox coxInfoBox; + @Inject + private CoxConfig config; + @Inject + private OverlayManager overlayManager; + @Getter(AccessLevel.PACKAGE) + private boolean HandCripple; + @Getter(AccessLevel.PACKAGE) + private boolean runOlm; + @Getter(AccessLevel.PACKAGE) + private boolean runVanguard; + @Getter(AccessLevel.PACKAGE) + private boolean tektonActive; + @Getter(AccessLevel.PACKAGE) + private NPC hand; + @Getter(AccessLevel.PACKAGE) + private NPC Olm_NPC; + @Getter(AccessLevel.PACKAGE) + private NPC OlmMelee_NPC; + @Getter(AccessLevel.PACKAGE) + private List Olm_Crystals = new ArrayList<>(); + @Getter(AccessLevel.PACKAGE) + private List Olm_Heal = new ArrayList<>(); + @Getter(AccessLevel.PACKAGE) + private List Olm_TP = new ArrayList<>(); + @Getter(AccessLevel.PACKAGE) + private List Olm_PSN = new ArrayList<>(); + @Getter(AccessLevel.PACKAGE) + private List burnTarget = new ArrayList<>(); + @Getter(AccessLevel.PACKAGE) + private Actor teleportTarget; + @Getter(AccessLevel.PACKAGE) + private Actor acidTarget; + @Getter(AccessLevel.PACKAGE) + private int timer = 45; + @Getter(AccessLevel.PACKAGE) + private int burnTicks = 41; + @Getter(AccessLevel.PACKAGE) + private int acidTicks = 25; + @Getter(AccessLevel.PACKAGE) + private int teleportTicks = 10; + @Getter(AccessLevel.PACKAGE) + private int tektonAttackTicks; + @Getter(AccessLevel.PACKAGE) + private int OlmPhase = 0; + @Getter(AccessLevel.PACKAGE) + private int Olm_TicksUntilAction = -1; + @Getter(AccessLevel.PACKAGE) + private int Olm_ActionCycle = -1; //4:0 = auto 3:0 = null 2:0 = auto 1:0 = spec + actioncycle =4 + @Getter(AccessLevel.PACKAGE) + private int Olm_NextSpec = -1; // 1= crystals 2=lightnig 3=portals 4= heal hand if p4 @Getter(AccessLevel.PACKAGE) private float percent; + @Getter(AccessLevel.PACKAGE) + private Map npcContainer = new HashMap<>(); @Provides CoxConfig getConfig(ConfigManager configManager) @@ -257,23 +163,15 @@ public class CoxPlugin extends Plugin @Override protected void startUp() { - overlayManager.add(overlay); - overlayManager.add(olmCrippleTimerOverlay); - overlayManager.add(prayAgainstOverlay); - overlayManager.add(timersOverlay); - overlayManager.add(vanguardsHighlight); - overlayManager.add(vanguardsOverlay); + overlayManager.add(coxOverlay); + overlayManager.add(coxInfoBox); } @Override protected void shutDown() { - overlayManager.remove(overlay); - overlayManager.remove(olmCrippleTimerOverlay); - overlayManager.remove(prayAgainstOverlay); - overlayManager.remove(timersOverlay); - overlayManager.remove(vanguardsHighlight); - overlayManager.remove(vanguardsOverlay); + overlayManager.remove(coxOverlay); + overlayManager.remove(coxInfoBox); HandCripple = false; hand = null; acidTarget = null; @@ -287,11 +185,6 @@ public class CoxPlugin extends Plugin teleportTicks = 10; } - private boolean inRaid() - { - return client.getVar(Varbits.IN_RAID) == 1; - } - @Subscribe public void onChatMessage(ChatMessage chatMessage) { @@ -312,61 +205,44 @@ public class CoxPlugin extends Plugin } } } - String msg = chatMessage.getMessageNode().getValue().toLowerCase(); - if (msg.contains("the great olm rises with the power of")) + switch (Text.standardize(chatMessage.getMessageNode().getValue())) { - if (!runOlm) - { - Olm_ActionCycle = -1; - Olm_TicksUntilAction = 4; - } - else - { - Olm_ActionCycle = -1; - Olm_TicksUntilAction = 3; - } - OlmPhase = 0; - runOlm = true; - needOlm = true; - Olm_NextSpec = -1; - } + case "the great olm rises with the power of acid.": + case "the great olm rises with the power of crystal.": + case "the great olm rises with the power of flame.": + case "the great olm is giving its all. this is its final stand.": + if (!runOlm) + { + Olm_ActionCycle = -1; + Olm_TicksUntilAction = 4; + } + else + { + Olm_ActionCycle = -1; + Olm_TicksUntilAction = 3; + } + OlmPhase = 0; + runOlm = true; + needOlm = true; + Olm_NextSpec = -1; + break; + case "the great olm's left claw clenches to protect itself temporarily.": + HandCripple = true; + timer = 45; + break; + case "the great olm fires a sphere of aggression your way. your prayers have been sapped.": + prayAgainstOlm = PrayAgainst.MELEE; + lastPrayTime = System.currentTimeMillis(); + break; + case "the great olm fires a sphere of magical power your way. your prayers have been sapped.": + prayAgainstOlm = PrayAgainst.MAGIC; + lastPrayTime = System.currentTimeMillis(); + break; + case "the great olm fires a sphere of accuracy and dexterity your way. your prayers have been sapped.": + prayAgainstOlm = PrayAgainst.RANGED; + lastPrayTime = System.currentTimeMillis(); + break; - if (msg.contains("the great olm is giving its all. this is its final stand")) - { - if (!runOlm) - { - Olm_ActionCycle = -1; - Olm_TicksUntilAction = 4; - } - else - { - Olm_ActionCycle = -1; - Olm_TicksUntilAction = 3; - } - OlmPhase = 1; - runOlm = true; - needOlm = true; - Olm_NextSpec = -1; - } - if (msg.startsWith(OLM_HAND_CRIPPLE)) - { - HandCripple = true; - timer = 45; - } - if (msg.contains("aggression")) - { - prayAgainstOlm = PrayAgainst.MELEE; - lastPrayTime = System.currentTimeMillis(); - } - if (msg.contains("of magical power")) - { - prayAgainstOlm = PrayAgainst.MAGIC; - lastPrayTime = System.currentTimeMillis(); - } - if (msg.contains("accuracy and dexterity")) - { - prayAgainstOlm = PrayAgainst.RANGED; - lastPrayTime = System.currentTimeMillis(); } } } @@ -390,7 +266,7 @@ public class CoxPlugin extends Plugin } if (projectile.getId() == ProjectileID.OLM_ACID_TRAIL) { - /*acidTarget = projectile.getInteracting();*/ + acidTarget = projectile.getInteracting(); } } } @@ -403,37 +279,10 @@ public class CoxPlugin extends Plugin Actor actor = graphicChanged.getActor(); if (actor.getSpotAnimation() == GraphicID.OLM_BURN) { - burnTarget.add(actor); - } - } - } - - @Subscribe - public void onAnimationChanged(AnimationChanged event) - { - if (event.getActor() == Tekton_NPC) - { - switch (Tekton_NPC.getAnimation()) - { - case AnimationID.TEKTON_AUTO1: - case AnimationID.TEKTON_AUTO2: - case AnimationID.TEKTON_AUTO3: - case AnimationID.TEKTON_ENRAGE_AUTO1: - case AnimationID.TEKTON_ENRAGE_AUTO2: - case AnimationID.TEKTON_ENRAGE_AUTO3: - tektonTicks = 4; - tektonAttacks++; - break; - case AnimationID.TEKTON_FAST_AUTO1: - case AnimationID.TEKTON_FAST_AUTO2: - tektonTicks = 3; - tektonAttacks++; - break; - case AnimationID.TEKTON_ANVIL: - tektonTicks = 15; - tektonAttacks = 0; - tektonAttackTicks = 47; - break; + if (!burnTarget.contains(actor)) + { + burnTarget.add(actor); + } } } } @@ -452,36 +301,23 @@ public class CoxPlugin extends Plugin case NpcID.TEKTON_7545: case NpcID.TEKTON_ENRAGED: case NpcID.TEKTON_ENRAGED_7544: - runTekton = true; - Tekton_NPC = npc; + npcContainer.put(npc, new NPCContainer(npc)); tektonAttackTicks = 27; break; case NpcID.MUTTADILE: - Momma_NPC = npc; - break; case NpcID.MUTTADILE_7562: - runMutta = true; - Mutta_NPC = npc; - break; case NpcID.MUTTADILE_7563: - runMutta = true; - Momma_NPC = npc; - break; case NpcID.GUARDIAN: - Guard1_NPC = npc; - guardTick = -1; - runGuard = true; - break; case NpcID.GUARDIAN_7570: - Guard2_NPC = npc; - guardTick = -1; - runGuard = true; + npcContainer.put(npc, new NPCContainer(npc)); break; + case NpcID.VANGUARD: case NpcID.VANGUARD_7526: case NpcID.VANGUARD_7527: case NpcID.VANGUARD_7528: case NpcID.VANGUARD_7529: - runVanguards = true; + runVanguard = true; + npcContainer.put(npc, new NPCContainer(npc)); break; case NpcID.GREAT_OLM_LEFT_CLAW: case NpcID.GREAT_OLM_LEFT_CLAW_7555: @@ -492,11 +328,11 @@ public class CoxPlugin extends Plugin } @Subscribe - public void onNpcDespawned(NpcDespawned npcDespawned) + public void onNpcDespawned(NpcDespawned event) { if (inRaid()) { - NPC npc = npcDespawned.getNpc(); + NPC npc = event.getNpc(); switch (npc.getId()) { case NpcID.TEKTON: @@ -505,35 +341,28 @@ public class CoxPlugin extends Plugin case NpcID.TEKTON_7545: case NpcID.TEKTON_ENRAGED: case NpcID.TEKTON_ENRAGED_7544: - enrageStage = false; - runTekton = false; - Tekton_NPC = null; - break; case NpcID.MUTTADILE: - Momma_NPC = null; - break; case NpcID.MUTTADILE_7562: - Mutta_NPC = null; - break; case NpcID.MUTTADILE_7563: - runMutta = false; - Momma_NPC = null; - break; case NpcID.GUARDIAN: - Guard1_NPC = null; - runGuard = false; - Guard2_NPC = null; - break; case NpcID.GUARDIAN_7570: - Guard2_NPC = null; - Guard1_NPC = null; - runGuard = false; - break; case NpcID.GUARDIAN_7571: case NpcID.GUARDIAN_7572: - Guard1_NPC = null; - Guard2_NPC = null; - runGuard = false; + if (npcContainer.remove(event.getNpc()) != null && !npcContainer.isEmpty()) + { + npcContainer.remove(event.getNpc()); + } + break; + case NpcID.VANGUARD: + case NpcID.VANGUARD_7526: + case NpcID.VANGUARD_7527: + case NpcID.VANGUARD_7528: + case NpcID.VANGUARD_7529: + if (npcContainer.remove(event.getNpc()) != null && !npcContainer.isEmpty()) + { + npcContainer.remove(event.getNpc()); + } + runVanguard = false; break; case NpcID.GREAT_OLM_RIGHT_CLAW_7553: case NpcID.GREAT_OLM_RIGHT_CLAW: @@ -548,21 +377,20 @@ public class CoxPlugin extends Plugin { if (!inRaid()) { - runOlm = false; - runGuard = false; - runMutta = false; - runTekton = false; - runVanguards = false; - enrageStage = false; needOlm = false; OlmPhase = 0; sleepcount = 0; Olm_Heal.clear(); - burnTarget.clear(); + npcContainer.clear(); + Olm_NPC = null; + hand = null; prayAgainstOlm = null; + runOlm = false; return; } + npcHandler(); + if (needOlm = true) { for (NPC monster : client.getNpcs()) @@ -576,221 +404,231 @@ public class CoxPlugin extends Plugin } } - if (runTekton) + if (teleportTarget != null) { - runVanguards = false; - if (Tekton_NPC.getId() == NpcID.TEKTON_ENRAGED || Tekton_NPC.getId() == NpcID.TEKTON_ENRAGED_7544) + log.info(teleportTarget.getName()); + Player target = (Player) teleportTarget; + client.setHintArrow(target); + teleportTicks--; + if (teleportTicks <= 0) { - enrageStage = true; - } - if (tektonTicks > 0) - { - tektonTicks--; - } - if (tektonAttacks > 0 && tektonAttackTicks > 0) - { - tektonAttackTicks--; + client.clearHintArrow(); + teleportTarget = null; + teleportTicks = 10; } } - if (runGuard) + if (acidTarget != null) { - runVanguards = false; - if (guardTick == -1) + acidTicks--; + if (acidTicks <= 0) { - if (Guard1_NPC != null) - { - if (Guard1_NPC.getAnimation() == ANIMATION_ID_G1) - { - guardTick = 5; - } - } - if (Guard2_NPC != null) - { - if (Guard2_NPC.getAnimation() == ANIMATION_ID_G1) - { - guardTick = 5; - } - } - } - else - { - guardTick--; - } - if (guardTick == 0) - { - guardTick = 5; + acidTarget = null; + acidTicks = 25; } } - if (runVanguards) + if (burnTarget.size() > 0) { - for (NPC npc : client.getNpcs()) + burnTicks--; + if (burnTicks <= 0) { - switch (npc.getId()) - { - case NpcID.VANGUARD_7529: - percent = (float) npc.getHealthRatio() / npc.getHealth() * 100; - mageVangHP = (int) percent; - mageVang = npc; - break; - case NpcID.VANGUARD_7528: - percent = (float) npc.getHealthRatio() / npc.getHealth() * 100; - rangeVangHP = (int) percent; - rangeVang = npc; - break; - case NpcID.VANGUARD_7527: - percent = (float) npc.getHealthRatio() / npc.getHealth() * 100; - meleeVangHP = (int) percent; - meleeVang = npc; - break; - case NpcID.VANGUARD_7526: - break; - } + burnTarget.clear(); + burnTicks = 41; } - if (mageVangHP == 0 && meleeVangHP == 0 && rangeVangHP == 0) + } + + if (HandCripple) + { + timer--; + if (timer <= 0) { - runVanguards = false; + HandCripple = false; + timer = 45; } } if (runOlm) { - runVanguards = false; - Olm_Crystals.clear(); - Olm_Heal.clear(); - Olm_TP.clear(); - client.clearHintArrow(); - sleepcount--; + olmHandler(); + } + } - if (teleportTarget != null) + private void npcHandler() + { + for (NPCContainer npcs : getNpcContainer().values()) + { + switch (npcs.getNpc().getId()) { - log.info(teleportTarget.getName()); - Player target = (Player) teleportTarget; - client.setHintArrow(target); - teleportTicks--; - if (teleportTicks <= 0) - { - client.clearHintArrow(); - teleportTarget = null; - teleportTicks = 10; - } - } - if (acidTarget != null) - { - acidTicks--; - if (acidTicks <= 0) - { - acidTarget = null; - acidTicks = 25; - } - } - if (burnTarget.size() > 0) - { - burnTicks--; - if (burnTicks <= 0) - { - burnTarget.clear(); - burnTicks = 41; - } - } - if (HandCripple) - { - timer--; - if (timer <= 0) - { - HandCripple = false; - timer = 45; - } - } - - if (Olm_TicksUntilAction == 1) - { - if (Olm_ActionCycle == 1) - { - Olm_ActionCycle = 4; - Olm_TicksUntilAction = 4; - if (Olm_NextSpec == 1) + case NpcID.TEKTON: + case NpcID.TEKTON_7541: + case NpcID.TEKTON_7542: + case NpcID.TEKTON_7545: + case NpcID.TEKTON_ENRAGED: + case NpcID.TEKTON_ENRAGED_7544: + npcs.setTicksUntilAttack(npcs.getTicksUntilAttack() - 1); + npcs.setAttackStyle(NPCContainer.Attackstyle.MELEE); + switch (npcs.getNpc().getAnimation()) { - if (OlmPhase == 1) - { - Olm_NextSpec = 4; // 4 = heal 3= cry 2 = lightn 1 = swap - } - else - { - Olm_NextSpec = 3; - } + case AnimationID.TEKTON_AUTO1: + case AnimationID.TEKTON_AUTO2: + case AnimationID.TEKTON_AUTO3: + case AnimationID.TEKTON_ENRAGE_AUTO1: + case AnimationID.TEKTON_ENRAGE_AUTO2: + case AnimationID.TEKTON_ENRAGE_AUTO3: + tektonActive = true; + if (npcs.getTicksUntilAttack() < 1) + { + npcs.setTicksUntilAttack(4); + } + break; + case AnimationID.TEKTON_FAST_AUTO1: + case AnimationID.TEKTON_FAST_AUTO2: + tektonActive = true; + if (npcs.getTicksUntilAttack() < 1) + { + npcs.setTicksUntilAttack(3); + } + break; + case AnimationID.TEKTON_ANVIL: + tektonActive = false; + tektonAttackTicks = 47; + if (npcs.getTicksUntilAttack() < 1) + { + npcs.setTicksUntilAttack(15); + } + } + break; + case NpcID.GUARDIAN: + case NpcID.GUARDIAN_7570: + case NpcID.GUARDIAN_7571: + case NpcID.GUARDIAN_7572: + npcs.setTicksUntilAttack(npcs.getTicksUntilAttack() - 1); + npcs.setAttackStyle(NPCContainer.Attackstyle.MELEE); + if (npcs.getNpc().getAnimation() == ANIMATION_ID_G1 && + npcs.getTicksUntilAttack() < 1) + { + npcs.setTicksUntilAttack(5); + } + break; + case NpcID.VANGUARD_7529: + npcs.setAttackStyle(NPCContainer.Attackstyle.MAGE); + break; + case NpcID.VANGUARD_7528: + npcs.setAttackStyle(NPCContainer.Attackstyle.RANGE); + break; + case NpcID.VANGUARD_7527: + npcs.setAttackStyle(NPCContainer.Attackstyle.MELEE); + break; + case NpcID.VANGUARD_7526: + npcs.setAttackStyle(NPCContainer.Attackstyle.UNKNOWN); + break; + } + } + if (tektonActive && tektonAttackTicks > 0) + { + tektonAttackTicks--; + } + } + + private void olmHandler() + { + Olm_Crystals.clear(); + Olm_Heal.clear(); + Olm_TP.clear(); + client.clearHintArrow(); + sleepcount--; + if (Olm_TicksUntilAction == 1) + { + if (Olm_ActionCycle == 1) + { + Olm_ActionCycle = 4; + Olm_TicksUntilAction = 4; + if (Olm_NextSpec == 1) + { + if (OlmPhase == 1) + { + Olm_NextSpec = 4; // 4 = heal 3= cry 2 = lightn 1 = swap } else { - Olm_NextSpec--; + Olm_NextSpec = 3; } } else { - if (Olm_ActionCycle != -1) - { - Olm_ActionCycle--; - } - Olm_TicksUntilAction = 4; + Olm_NextSpec--; } } else { - Olm_TicksUntilAction--; + if (Olm_ActionCycle != -1) + { + Olm_ActionCycle--; + } + Olm_TicksUntilAction = 4; } + } + else + { + Olm_TicksUntilAction--; + } - for (GraphicsObject o : client.getGraphicsObjects()) + for (GraphicsObject o : client.getGraphicsObjects()) + { + if (o.getId() == GraphicID.OLM_CRYSTAL) { - if (o.getId() == GRAPHICSOBJECT_ID_CRYSTAL) + WorldPoint newloc; + for (int x = -1; x <= 1; x++) { - WorldPoint newloc; - for (int x = -1; x <= 1; x++) + for (int y = -1; y <= 1; y++) { - for (int y = -1; y <= 1; y++) - { - newloc = WorldPoint.fromLocal(client, o.getLocation()); - newloc = newloc.dx(x); - newloc = newloc.dy(y); - Olm_Crystals.add(newloc); - } + newloc = WorldPoint.fromLocal(client, o.getLocation()); + newloc = newloc.dx(x); + newloc = newloc.dy(y); + Olm_Crystals.add(newloc); } } - if (sleepcount <= 0) + } + if (sleepcount <= 0) + { + if (o.getId() == 1338) { - if (o.getId() == 1338) - { - Olm_TicksUntilAction = 1; - Olm_NextSpec = 2; - Olm_ActionCycle = 4; //spec=1 null=3 - sleepcount = 5; - } - if (o.getId() == 1356) - { - Olm_TicksUntilAction = 4; - Olm_NextSpec = 1; - Olm_ActionCycle = 4; //spec=1 null=3 - sleepcount = 50; - } + Olm_TicksUntilAction = 1; + Olm_NextSpec = 2; + Olm_ActionCycle = 4; //spec=1 null=3 + sleepcount = 5; } - if (o.getId() == 1359) + if (o.getId() == 1356) { - Olm_TP.add(WorldPoint.fromLocal(client, o.getLocation())); + Olm_TicksUntilAction = 4; + Olm_NextSpec = 1; + Olm_ActionCycle = 4; //spec=1 null=3 + sleepcount = 50; } - if (o.getId() == GRAPHICSOBJECT_ID_HEAL) + } + if (o.getId() == GraphicID.OLM_TELEPORT) + { + Olm_TP.add(WorldPoint.fromLocal(client, o.getLocation())); + } + if (o.getId() == GraphicID.OLM_HEAL) + { + Olm_Heal.add(WorldPoint.fromLocal(client, o.getLocation())); + } + if (!Olm_TP.isEmpty()) + { + teleportTicks--; + if (teleportTicks <= 0) { - Olm_Heal.add(WorldPoint.fromLocal(client, o.getLocation())); - } - if (!Olm_TP.isEmpty()) - { - teleportTicks--; - if (teleportTicks <= 0) - { - client.clearHintArrow(); - teleportTicks = 10; - } + client.clearHintArrow(); + teleportTicks = 10; } } } } + + boolean inRaid() + { + return client.getVar(Varbits.IN_RAID) == 1; + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/FontStyle.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/FontStyle.java deleted file mode 100644 index 9b5c1a1ea7..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/FontStyle.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2019, ganom - * 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.coxhelper; - -import java.awt.Font; -import lombok.AllArgsConstructor; -import lombok.Getter; - -@Getter -@AllArgsConstructor -public enum FontStyle -{ - BOLD("Bold", Font.BOLD), - ITALIC("Italic", Font.ITALIC), - PLAIN("Plain", Font.PLAIN); - - private String name; - private int font; - - @Override - public String toString() - { - return getName(); - } -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/NPCContainer.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/NPCContainer.java new file mode 100644 index 0000000000..de33254a5d --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/NPCContainer.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2018, Woox + * Copyright (c) 2019, Ganom + * 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.coxhelper; + +import java.awt.Color; +import lombok.AllArgsConstructor; +import lombok.Getter; +import lombok.Setter; +import net.runelite.api.Actor; +import net.runelite.api.NPC; +import net.runelite.api.NPCDefinition; + +class NPCContainer +{ + + @Getter + private NPC npc; + + @Getter + private int npcIndex; + + @Getter + private String npcName; + + @Getter + private int npcSize; + + @Setter + @Getter + private int ticksUntilAttack; + + @Setter + @Getter + private int intermissionPeriod; + + @Setter + @Getter + private int npcSpeed; + + @Setter + @Getter + private Actor npcInteracting; + + @Setter + @Getter + private Specials specials; + + @Setter + @Getter + private Attackstyle attackStyle; + + + NPCContainer(NPC npc) + { + this.npc = npc; + this.npcName = npc.getName(); + this.npcIndex = npc.getIndex(); + this.npcInteracting = npc.getInteracting(); + this.npcSpeed = 0; + this.ticksUntilAttack = 0; + this.intermissionPeriod = 0; + this.attackStyle = Attackstyle.UNKNOWN; + this.specials = Specials.UNKNOWN; + final NPCDefinition composition = npc.getTransformedDefinition(); + + if (composition != null) + { + this.npcSize = composition.getSize(); + } + } + + @AllArgsConstructor + @Getter + public enum Specials + { + PORTALS("Portals"), + LIGHTNING("Lightning"), + CRYSTALS("Crystals"), + HEAL("Heal"), + UNKNOWN("Unknown"); + + private String name = ""; + } + + @AllArgsConstructor + @Getter + public enum Attackstyle + { + MAGE("Mage", Color.CYAN), + RANGE("Range", Color.GREEN), + MELEE("Melee", Color.RED), + UNKNOWN("Unknown", Color.WHITE); + + private String name = ""; + private Color color; + } +} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmCrippleTimerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmCrippleTimerOverlay.java deleted file mode 100644 index 465303027b..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/OlmCrippleTimerOverlay.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2018, https://runelitepl.us - * Copyright (c) 2019, ganom - * 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.coxhelper; - - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.NPC; -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.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - - -public class OlmCrippleTimerOverlay extends Overlay -{ - - - private final Client client; - private final CoxPlugin plugin; - private final CoxConfig config; - - @Inject - private OlmCrippleTimerOverlay(Client client, CoxPlugin plugin, CoxConfig config) - { - this.client = client; - this.plugin = plugin; - this.config = config; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGH); - setLayer(OverlayLayer.ABOVE_SCENE); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isHandCripple()) - { - int tick = plugin.getTimer(); - NPC olmHand = plugin.getHand(); - final String tickStr = String.valueOf(tick); - Point canvasPoint = olmHand.getCanvasTextLocation(graphics, tickStr, 50); - renderTextLocation(graphics, tickStr, config.textSize(), config.fontStyle().getFont(), Color.GRAY, canvasPoint); - } - - - return null; - } - - private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) - { - graphics.setFont(new Font("Arial", fontStyle, fontSize)); - if (canvasPoint != null) - { - final Point canvasCenterPoint = new Point( - canvasPoint.getX(), - canvasPoint.getY()); - final Point canvasCenterPoint_shadow = new Point( - canvasPoint.getX() + 1, - canvasPoint.getY() + 1); - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); - } - } - -} \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/TimersOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/TimersOverlay.java deleted file mode 100644 index b47627dc86..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/TimersOverlay.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright (c) 2019, ganom - * 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.coxhelper; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Font; -import java.awt.Graphics2D; -import java.awt.Polygon; -import javax.inject.Inject; -import net.runelite.api.Actor; -import net.runelite.api.Client; -import net.runelite.api.Perspective; -import net.runelite.api.Point; -import net.runelite.api.coords.LocalPoint; -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.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayUtil; - -public class TimersOverlay extends Overlay -{ - - private CoxPlugin plugin; - private CoxConfig config; - private Client client; - - @Inject - TimersOverlay(CoxPlugin plugin, CoxConfig config, Client client) - { - this.plugin = plugin; - this.config = config; - this.client = client; - setPosition(OverlayPosition.DYNAMIC); - setPriority(OverlayPriority.HIGHEST); - setLayer(OverlayLayer.ALWAYS_ON_TOP); - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (config.tektonTickCounter()) - { - Actor actor = plugin.getTekton_NPC(); - final int ticksLeft = plugin.getTektonTicks(); - final int attackTicksleft = plugin.getTektonAttackTicks(); - String attacksLeftStr; - Color tickcolor; - Color attackcolor; - if (ticksLeft > 0) - { - if (ticksLeft == 1) - { - tickcolor = new Color(255, 0, 0, 255); - } - else - { - tickcolor = new Color(255, 255, 255, 255); - } - final String ticksLeftStr = String.valueOf(ticksLeft); - Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0); - renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint); - } - if (attackTicksleft >= 0 && plugin.getTektonAttacks() > 0) - { - if (attackTicksleft <= 1) - { - attackcolor = new Color(255, 0, 0, 255); - attacksLeftStr = "Phase Over"; - } - else - { - attackcolor = new Color(255, 255, 255, 255); - attacksLeftStr = String.valueOf(attackTicksleft); - } - - if (actor != null) - { - Point canvasPoint = actor.getCanvasTextLocation(graphics, attacksLeftStr, 0); - renderTextLocationAbove(graphics, attacksLeftStr, config.textSize(), config.fontStyle().getFont(), attackcolor, canvasPoint); - } - } - } - - if (config.timers()) - { - if (plugin.getBurnTarget().size() > 0) - { - for (Actor actor : plugin.getBurnTarget()) - { - renderNpcOverlay(graphics, actor, config.burnColor(), 2, 100, 10); - final int ticksLeft = plugin.getBurnTicks(); - String ticksLeftStr = String.valueOf(ticksLeft); - Color tickcolor = new Color(255, 255, 255, 255); - if (ticksLeft >= 0) - { - if (ticksLeft == 34 || - ticksLeft == 33 || - ticksLeft == 26 || - ticksLeft == 25 || - ticksLeft == 18 || - ticksLeft == 17 || - ticksLeft == 10 || - ticksLeft == 9 || - ticksLeft == 2 || - ticksLeft == 1) - { - tickcolor = new Color(255, 0, 0, 255); - ticksLeftStr = "GAP"; - } - else - { - tickcolor = new Color(255, 255, 255, 255); - } - Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0); - renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint); - } - } - } - - if (plugin.getAcidTarget() != null) - { - Actor actor = plugin.getAcidTarget(); - renderNpcOverlay(graphics, actor, config.acidColor(), 2, 100, 10); - final int ticksLeft = plugin.getAcidTicks(); - Color tickcolor = new Color(255, 255, 255, 255); - if (ticksLeft > 0) - { - if (ticksLeft > 1) - { - tickcolor = new Color(69, 241, 44, 255); - } - else - { - tickcolor = new Color(255, 255, 255, 255); - } - final String ticksLeftStr = String.valueOf(ticksLeft); - Point canvasPoint = actor.getCanvasTextLocation(graphics, ticksLeftStr, 0); - renderTextLocation(graphics, ticksLeftStr, config.textSize(), config.fontStyle().getFont(), tickcolor, canvasPoint); - } - } - } - - if (config.tpOverlay()) - { - if (plugin.getTeleportTarget() != null) - { - renderNpcOverlay(graphics, plugin.getTeleportTarget(), new Color(193, 255, 245, 255), 2, 100, 10); - } - } - - return null; - } - - private void renderNpcOverlay(Graphics2D graphics, Actor actor, Color color, int outlineWidth, int outlineAlpha, int fillAlpha) - { - int size = 1; - LocalPoint lp = actor.getLocalLocation(); - Polygon tilePoly = Perspective.getCanvasTileAreaPoly(client, lp, size); - - if (tilePoly != null) - { - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), outlineAlpha)); - graphics.setStroke(new BasicStroke(outlineWidth)); - graphics.draw(tilePoly); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), fillAlpha)); - graphics.fill(tilePoly); - } - } - - private void renderTextLocation(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) - { - graphics.setFont(new Font("Arial", fontStyle, fontSize)); - if (canvasPoint != null) - { - final Point canvasCenterPoint = new Point( - canvasPoint.getX(), - canvasPoint.getY()); - final Point canvasCenterPoint_shadow = new Point( - canvasPoint.getX() + 1, - canvasPoint.getY() + 1); - if (config.shadows()) - { - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); - } - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); - } - } - - private void renderTextLocationAbove(Graphics2D graphics, String txtString, int fontSize, int fontStyle, Color fontColor, Point canvasPoint) - { - graphics.setFont(new Font("Arial", fontStyle, fontSize)); - if (canvasPoint != null) - { - final Point canvasCenterPoint = new Point( - canvasPoint.getX(), - canvasPoint.getY() + 20); - final Point canvasCenterPoint_shadow = new Point( - canvasPoint.getX() + 1, - canvasPoint.getY() + 21); - if (config.shadows()) - { - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint_shadow, txtString, Color.BLACK); - } - OverlayUtil.renderTextLocation(graphics, canvasCenterPoint, txtString, fontColor); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsHighlight.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsHighlight.java deleted file mode 100644 index 0e02c9ddda..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsHighlight.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2019, lyzrds - * Copyright (c) 2019, ganom - * 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.coxhelper; - -import java.awt.BasicStroke; -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import java.awt.Polygon; -import javax.inject.Inject; -import net.runelite.api.Client; -import net.runelite.api.NPC; -import net.runelite.client.ui.overlay.Overlay; -import net.runelite.client.ui.overlay.OverlayLayer; - -public class VanguardsHighlight extends Overlay -{ - - private final Client client; - private final CoxPlugin plugin; - private final CoxConfig config; - - @Inject - VanguardsHighlight(Client client, CoxPlugin plugin, CoxConfig config) - { - super(plugin); - setLayer(OverlayLayer.ABOVE_MAP); - this.client = client; - this.plugin = plugin; - this.config = config; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isRunVanguards()) - { - if (config.vangHighlight()) - { - if (plugin.getRangeVang() != null) - { - renderNpcOverlay(graphics, plugin.getRangeVang(), "Range", Color.GREEN); - } - if (plugin.getMageVang() != null) - { - renderNpcOverlay(graphics, plugin.getMageVang(), "Mage", Color.BLUE); - } - if (plugin.getMeleeVang() != null) - { - renderNpcOverlay(graphics, plugin.getMeleeVang(), "Melee", Color.RED); - } - } - } - return null; - } - - - private void renderNpcOverlay(Graphics2D graphics, NPC actor, String name, Color color) - { - Polygon objectClickbox = actor.getConvexHull(); - renderPoly(graphics, color, objectClickbox); - } - - private void renderPoly(Graphics2D graphics, Color color, Polygon polygon) - { - if (polygon != null) - { - graphics.setColor(color); - graphics.setStroke(new BasicStroke(2)); - graphics.draw(polygon); - graphics.setColor(new Color(color.getRed(), color.getGreen(), color.getBlue(), 20)); - graphics.fill(polygon); - } - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsOverlay.java deleted file mode 100644 index 97f0ede328..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/VanguardsOverlay.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2019, lyzrds - * Copyright (c) 2019, ganom - * 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.coxhelper; - -import java.awt.Color; -import java.awt.Dimension; -import java.awt.Graphics2D; -import javax.inject.Inject; -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.TableAlignment; -import net.runelite.client.ui.overlay.components.table.TableComponent; -import net.runelite.client.util.ColorUtil; - -public class VanguardsOverlay extends Overlay -{ - - private final CoxPlugin plugin; - private final CoxConfig config; - private final PanelComponent panelComponent = new PanelComponent(); - - @Inject - VanguardsOverlay(CoxPlugin plugin, CoxConfig config) - { - super(plugin); - setPosition(OverlayPosition.DYNAMIC); - setPosition(OverlayPosition.DETACHED); - this.plugin = plugin; - this.config = config; - } - - @Override - public Dimension render(Graphics2D graphics) - { - if (plugin.isRunVanguards()) - { - panelComponent.getChildren().clear(); - - if (config.vangHealth()) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text("Vanguards") - .color(Color.pink) - .build()); - - TableComponent tableComponent = new TableComponent(); - tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); - - tableComponent.addRow(ColorUtil.prependColorTag("Range", Color.GREEN), Integer.toString(plugin.getRangeVangHP())); - tableComponent.addRow(ColorUtil.prependColorTag("Mage", Color.BLUE), Integer.toString(plugin.getMageVangHP())); - tableComponent.addRow(ColorUtil.prependColorTag("Melee", Color.RED), Integer.toString(plugin.getMeleeVangHP())); - - panelComponent.getChildren().add(tableComponent); - - return panelComponent.render(graphics); - } - } - return null; - } -} From 21a54a19561f77860c2b47017f58b6f3f29bd84e Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 20 Jun 2019 10:33:18 +0000 Subject: [PATCH 081/117] Update Item IDs to 2019-06-20-rev180 --- runelite-api/src/main/java/net/runelite/api/ItemID.java | 2 ++ runelite-api/src/main/java/net/runelite/api/NullItemID.java | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/runelite-api/src/main/java/net/runelite/api/ItemID.java b/runelite-api/src/main/java/net/runelite/api/ItemID.java index 517d093058..79ca788870 100644 --- a/runelite-api/src/main/java/net/runelite/api/ItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/ItemID.java @@ -10852,5 +10852,7 @@ public final class ItemID public static final int HEALER_ICON_23484 = 23484; public static final int HEALER_ICON_23485 = 23485; public static final int HEALER_ICON_23486 = 23486; + public static final int WINE_OF_ZAMORAK_23489 = 23489; + public static final int LARRANS_KEY = 23490; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/NullItemID.java b/runelite-api/src/main/java/net/runelite/api/NullItemID.java index 9007300837..5a7f1eb567 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullItemID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullItemID.java @@ -12424,5 +12424,11 @@ public final class NullItemID public static final int NULL_23456 = 23456; public static final int NULL_23457 = 23457; public static final int NULL_23459 = 23459; + public static final int NULL_23487 = 23487; + public static final int NULL_23488 = 23488; + public static final int NULL_23491 = 23491; + public static final int NULL_23492 = 23492; + public static final int NULL_23493 = 23493; + public static final int NULL_23494 = 23494; /* This file is automatically generated. Do not edit. */ } From 4b36918ba77e4265e9ca3e037149b6f9c47784da Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 20 Jun 2019 10:33:18 +0000 Subject: [PATCH 082/117] Update Item variations to 2019-06-20-rev180 --- runelite-client/src/main/resources/item_variations.json | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/runelite-client/src/main/resources/item_variations.json b/runelite-client/src/main/resources/item_variations.json index 8105a02ee2..987169cb75 100644 --- a/runelite-client/src/main/resources/item_variations.json +++ b/runelite-client/src/main/resources/item_variations.json @@ -176,6 +176,10 @@ 237, 1487 ], + "wine of zamorak": [ + 245, + 23489 + ], "key": [ 275, 423, From 1ed702a7b02050776a756063ac036271cbf515e8 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 20 Jun 2019 10:33:19 +0000 Subject: [PATCH 083/117] Update Object IDs to 2019-06-20-rev180 --- .../src/main/java/net/runelite/api/NullObjectID.java | 2 ++ .../src/main/java/net/runelite/api/ObjectID.java | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java index 279f795689..103bf0143c 100644 --- a/runelite-api/src/main/java/net/runelite/api/NullObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/NullObjectID.java @@ -16209,5 +16209,7 @@ public final class NullObjectID public static final int NULL_34823 = 34823; public static final int NULL_34824 = 34824; public static final int NULL_34825 = 34825; + public static final int NULL_34831 = 34831; + public static final int NULL_34832 = 34832; /* This file is automatically generated. Do not edit. */ } diff --git a/runelite-api/src/main/java/net/runelite/api/ObjectID.java b/runelite-api/src/main/java/net/runelite/api/ObjectID.java index e31bd024d8..9d5ee32bfb 100644 --- a/runelite-api/src/main/java/net/runelite/api/ObjectID.java +++ b/runelite-api/src/main/java/net/runelite/api/ObjectID.java @@ -16133,7 +16133,7 @@ public final class ObjectID public static final int GRAND_EXCHANGE_BOOTH_30390 = 30390; public static final int IRON_LADDER_30391 = 30391; public static final int IRON_LADDER_30392 = 30392; - public static final int JADFEST_PORTAL = 30395; + public static final int MYSTERIOUS_POOL = 30395; public static final int SHIMMERING_BARRIER_30396 = 30396; public static final int SHIMMERING_BARRIER_30397 = 30397; public static final int SHIMMERING_BARRIER_30398 = 30398; @@ -17528,7 +17528,7 @@ public final class ObjectID public static final int FIRE_OF_DEHUMIDIFICATION = 33322; public static final int PILE_OF_RUBBLE_33340 = 33340; public static final int PILE_OF_RUBBLE_33341 = 33341; - public static final int HUB_PORTAL = 33343; + public static final int LARRANS_SMALL_CHEST = 33343; public static final int BROKEN_WALL_33344 = 33344; public static final int PORTAL_NEXUS_SPACE = 33346; public static final int RUG_SPACE_33347 = 33347; @@ -18605,5 +18605,10 @@ public final class ObjectID public static final int RUBBLE_34803 = 34803; public static final int RUBBLE_34804 = 34804; public static final int RUBBLE_34805 = 34805; + public static final int JADFEST_PORTAL = 34826; + public static final int HUB_PORTAL = 34827; + public static final int LARRANS_SMALL_CHEST_34828 = 34828; + public static final int LARRANS_BIG_CHEST = 34829; + public static final int LARRANS_BIG_CHEST_34830 = 34830; /* This file is automatically generated. Do not edit. */ } From c3077eb6726232d7d335441f4d4bbd1b28914e53 Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 20 Jun 2019 10:33:19 +0000 Subject: [PATCH 084/117] Update NPC IDs to 2019-06-20-rev180 --- .../src/main/java/net/runelite/api/NpcID.java | 403 +++++++++--------- 1 file changed, 204 insertions(+), 199 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/NpcID.java b/runelite-api/src/main/java/net/runelite/api/NpcID.java index 1ab55200fd..1288a33ba7 100644 --- a/runelite-api/src/main/java/net/runelite/api/NpcID.java +++ b/runelite-api/src/main/java/net/runelite/api/NpcID.java @@ -460,10 +460,9 @@ public final class NpcID public static final int SKELETAL_WYVERN_468 = 468; public static final int KILLERWATT = 469; public static final int KILLERWATT_470 = 470; - public static final int FUNGI = 471; - public static final int FUNGI_472 = 472; - public static final int ZYGOMITE = 473; - public static final int ZYGOMITE_474 = 474; + public static final int DARK_WIZARD = 472; + public static final int INVRIGAR_THE_NECROMANCER = 473; + public static final int DARK_WIZARD_474 = 474; public static final int HOLE_IN_THE_WALL = 475; public static final int WALL_BEAST = 476; public static final int GIANT_FROG = 477; @@ -493,40 +492,37 @@ public final class NpcID public static final int VANESSA = 502; public static final int RICHARD = 503; public static final int ALICE = 504; - public static final int BOB = 505; - public static final int SHOP_KEEPER = 506; - public static final int SHOP_ASSISTANT = 507; - public static final int SHOP_KEEPER_508 = 508; - public static final int SHOP_ASSISTANT_509 = 509; - public static final int SHOP_KEEPER_510 = 510; - public static final int SHOP_ASSISTANT_511 = 511; - public static final int SHOP_KEEPER_512 = 512; - public static final int SHOP_ASSISTANT_513 = 513; - public static final int SHOP_KEEPER_514 = 514; - public static final int SHOP_ASSISTANT_515 = 515; - public static final int SHOP_KEEPER_516 = 516; - public static final int SHOP_ASSISTANT_517 = 517; - public static final int SHOP_KEEPER_518 = 518; - public static final int SHOP_ASSISTANT_519 = 519; - public static final int FAIRY_SHOP_KEEPER = 520; - public static final int FAIRY_SHOP_ASSISTANT = 521; - public static final int VALAINE = 522; - public static final int SCAVVO = 523; - public static final int PEKSA = 524; - public static final int SILK_TRADER = 525; - public static final int GEM_TRADER = 526; - public static final int ZEKE = 527; - public static final int LOUIE_LEGS = 528; - public static final int KARIM = 529; - public static final int RANAEL = 530; - public static final int DOMMIK = 531; - public static final int ZAFF = 532; - public static final int BARAEK = 533; + public static final int MUGGER = 505; + public static final int WITCH = 506; + public static final int WITCH_507 = 507; + public static final int BLACK_KNIGHT = 508; + public static final int BLACK_KNIGHT_509 = 509; + public static final int HIGHWAYMAN = 510; + public static final int HIGHWAYMAN_511 = 511; + public static final int CHAOS_DRUID = 512; + public static final int PIRATE = 513; + public static final int PIRATE_514 = 514; + public static final int PIRATE_515 = 515; + public static final int PIRATE_516 = 516; + public static final int THUG = 517; + public static final int ROGUE = 518; + public static final int MONK_OF_ZAMORAK = 519; + public static final int MONK_OF_ZAMORAK_520 = 520; + public static final int MONK_OF_ZAMORAK_521 = 521; + public static final int TRIBESMAN = 522; + public static final int DARK_WARRIOR = 523; + public static final int CHAOS_DRUID_WARRIOR = 524; + public static final int NECROMANCER = 525; + public static final int BANDIT = 526; + public static final int GUARD_BANDIT = 527; + public static final int BARBARIAN_GUARD = 528; + public static final int PORTAL = 530; + public static final int PORTAL_532 = 532; + public static final int FUNGI = 533; public static final int THESSALIA = 534; - public static final int HORVIK = 535; - public static final int LOWE = 536; - public static final int SHOP_KEEPER_537 = 537; - public static final int SHOP_ASSISTANT_538 = 538; + public static final int FUNGI_535 = 535; + public static final int ZYGOMITE = 537; + public static final int FUNGI_538 = 538; public static final int ELFINLOCKS = 539; public static final int CLOCKWORK_CAT = 540; public static final int CLOCKWORK_CAT_541 = 541; @@ -625,7 +621,7 @@ public final class NpcID public static final int BREWER_634 = 634; public static final int FISHING_SPOT = 635; public static final int KARAMTHULHU = 636; - public static final int AUBURY = 637; + public static final int FUNGI_637 = 637; public static final int ELF_TRACKER = 638; public static final int TYRAS_GUARD = 639; public static final int UG = 640; @@ -678,7 +674,7 @@ public final class NpcID public static final int BARTENDER = 687; public static final int EBLIS = 688; public static final int EBLIS_689 = 689; - public static final int BANDIT = 690; + public static final int BANDIT_690 = 690; public static final int BANDIT_691 = 691; public static final int BANDIT_692 = 692; public static final int BANDIT_693 = 693; @@ -992,37 +988,34 @@ public final class NpcID public static final int RAT = 1020; public static final int RAT_1021 = 1021; public static final int RAT_1022 = 1022; - public static final int FANCY_DRESS_SHOP_OWNER = 1023; - public static final int SHOP_KEEPER_1024 = 1024; - public static final int GRUM = 1025; - public static final int WYDIN = 1026; - public static final int GERRANT = 1027; - public static final int BRIAN = 1028; - public static final int JIMINUA = 1029; - public static final int SHOP_KEEPER_1030 = 1030; - public static final int CANDLE_MAKER = 1031; - public static final int ARHEIN = 1032; - public static final int JUKAT = 1033; - public static final int LUNDERWIN = 1034; - public static final int IRKSOL = 1035; - public static final int FAIRY = 1036; - public static final int ZAMBO = 1037; - public static final int SILVER_MERCHANT = 1038; - public static final int GEM_MERCHANT = 1039; - public static final int BAKER = 1040; - public static final int SPICE_SELLER = 1041; - public static final int FUR_TRADER = 1042; - public static final int SILK_MERCHANT = 1043; - public static final int HICKTON = 1044; - public static final int HARRY = 1045; - public static final int CASSIE = 1046; - public static final int FRINCOS = 1047; - public static final int DROGO_DWARF = 1048; - public static final int FLYNN = 1049; - public static final int WAYNE = 1050; - public static final int DWARF_1051 = 1051; - public static final int BETTY = 1052; - public static final int HERQUIN = 1053; + public static final int ZYGOMITE_1024 = 1024; + public static final int BANKER_1027 = 1027; + public static final int BANKER_1028 = 1028; + public static final int BANKER_1029 = 1029; + public static final int BANKER_1030 = 1030; + public static final int BANKER_1031 = 1031; + public static final int BANKER_1032 = 1032; + public static final int BANKER_1033 = 1033; + public static final int BANKER_1034 = 1034; + public static final int BANKER_1035 = 1035; + public static final int BANKER_1036 = 1036; + public static final int SNAKE = 1037; + public static final int MONKEY_1038 = 1038; + public static final int ALBINO_BAT = 1039; + public static final int CRAB = 1040; + public static final int GIANT_MOSQUITO = 1041; + public static final int JUNGLE_HORROR = 1042; + public static final int JUNGLE_HORROR_1043 = 1043; + public static final int JUNGLE_HORROR_1044 = 1044; + public static final int JUNGLE_HORROR_1045 = 1045; + public static final int JUNGLE_HORROR_1046 = 1046; + public static final int CAVE_HORROR = 1047; + public static final int CAVE_HORROR_1048 = 1048; + public static final int CAVE_HORROR_1049 = 1049; + public static final int CAVE_HORROR_1050 = 1050; + public static final int CAVE_HORROR_1051 = 1051; + public static final int CAVEY_DAVEY = 1052; + public static final int PATCHY = 1053; public static final int LAUNA = 1054; public static final int LAUNA_1055 = 1055; public static final int BRANA = 1056; @@ -1134,13 +1127,12 @@ public final class NpcID public static final int MONK_OF_ENTRANA_1169 = 1169; public static final int MONK_OF_ENTRANA_1170 = 1170; public static final int MONK_1171 = 1171; - public static final int ROMMIK = 1172; - public static final int GAIUS = 1173; - public static final int JATIX = 1174; - public static final int DAVON = 1175; - public static final int ZENESHA = 1176; - public static final int AEMAD = 1177; - public static final int KORTAN = 1178; + public static final int CHICKEN = 1173; + public static final int CHICKEN_1174 = 1174; + public static final int ROOSTER = 1175; + public static final int LIL_LAMB = 1176; + public static final int LAMB = 1177; + public static final int SHEEP_1178 = 1178; public static final int LUMBRIDGE_GUIDE_1179 = 1179; public static final int LUMBRIDGE_GUIDE_1181 = 1181; public static final int ___ = 1182; @@ -1252,17 +1244,17 @@ public final class NpcID public static final int MORTTON_LOCAL_1296 = 1296; public static final int AFFLICTED_1297 = 1297; public static final int AFFLICTED_1298 = 1298; - public static final int ROACHEY = 1299; - public static final int FRENITA = 1300; - public static final int NURMOF = 1301; - public static final int TEA_SELLER = 1302; - public static final int FAT_TONY = 1303; - public static final int NOTERAZZO = 1304; + public static final int SHEEP_1299 = 1299; + public static final int SHEEP_1300 = 1300; + public static final int SHEEP_1301 = 1301; + public static final int SHEEP_1302 = 1302; + public static final int SHEEP_1303 = 1303; + public static final int SHEEP_1304 = 1304; public static final int HAIRDRESSER = 1305; public static final int MAKEOVER_MAGE = 1306; public static final int MAKEOVER_MAGE_1307 = 1307; - public static final int DIANGO = 1308; - public static final int BRIAN_1309 = 1309; + public static final int SHEEP_1308 = 1308; + public static final int SHEEP_1309 = 1309; public static final int BARTENDER_1310 = 1310; public static final int BARTENDER_1311 = 1311; public static final int BARTENDER_1312 = 1312; @@ -1392,12 +1384,12 @@ public final class NpcID public static final int DAERO = 1444; public static final int DAERO_1445 = 1445; public static final int WAYDAR = 1446; - public static final int PIRATE = 1447; + public static final int PIRATE_1447 = 1447; public static final int THIEF = 1448; public static final int LUMDO_1453 = 1453; public static final int LUMDO_1454 = 1454; public static final int GLO_CARANOCK = 1460; - public static final int MUGGER = 1461; + public static final int MUGGER_1461 = 1461; public static final int SMALL_NINJA_MONKEY = 1462; public static final int MEDIUM_NINJA_MONKEY = 1463; public static final int GORILLA = 1464; @@ -1478,7 +1470,7 @@ public final class NpcID public static final int FISHING_SPOT_1542 = 1542; public static final int GARGOYLE_1543 = 1543; public static final int FISHING_SPOT_1544 = 1544; - public static final int BLACK_KNIGHT = 1545; + public static final int BLACK_KNIGHT_1545 = 1545; public static final int GUARD_1546 = 1546; public static final int GUARD_1547 = 1547; public static final int GUARD_1548 = 1548; @@ -1486,7 +1478,7 @@ public final class NpcID public static final int GUARD_1550 = 1550; public static final int GUARD_1551 = 1551; public static final int GUARD_1552 = 1552; - public static final int CRAB = 1553; + public static final int CRAB_1553 = 1553; public static final int SEAGULL_1554 = 1554; public static final int SEAGULL_1555 = 1555; public static final int FIRE_WIZARD = 1556; @@ -1668,7 +1660,7 @@ public final class NpcID public static final int BRAWLER_1736 = 1736; public static final int BRAWLER_1737 = 1737; public static final int BRAWLER_1738 = 1738; - public static final int PORTAL = 1739; + public static final int PORTAL_1739 = 1739; public static final int PORTAL_1740 = 1740; public static final int PORTAL_1741 = 1741; public static final int PORTAL_1742 = 1742; @@ -1716,10 +1708,10 @@ public final class NpcID public static final int SKELETON_1785 = 1785; public static final int GHOST_1786 = 1786; public static final int SKELETON_MAGE_1787 = 1787; - public static final int BETTY_1788 = 1788; - public static final int GRUM_1789 = 1789; - public static final int GERRANT_1790 = 1790; - public static final int WYDIN_1791 = 1791; + public static final int BETTY = 1788; + public static final int GRUM = 1789; + public static final int GERRANT = 1790; + public static final int WYDIN = 1791; public static final int GOAT = 1792; public static final int GOAT_1793 = 1793; public static final int BILLY_GOAT = 1794; @@ -1767,7 +1759,7 @@ public final class NpcID public static final int STAG = 1845; public static final int WOOD_DRYAD = 1846; public static final int FAIRY_VERY_WISE = 1847; - public static final int FAIRY_1848 = 1848; + public static final int FAIRY = 1848; public static final int FAIRY_1849 = 1849; public static final int FAIRY_1850 = 1850; public static final int FAIRY_1851 = 1851; @@ -1915,7 +1907,7 @@ public final class NpcID public static final int FRITZ_THE_GLASSBLOWER = 2053; public static final int CHAOS_ELEMENTAL = 2054; public static final int CHAOS_ELEMENTAL_JR = 2055; - public static final int DARK_WIZARD = 2056; + public static final int DARK_WIZARD_2056 = 2056; public static final int DARK_WIZARD_2057 = 2057; public static final int DARK_WIZARD_2058 = 2058; public static final int DARK_WIZARD_2059 = 2059; @@ -2488,7 +2480,7 @@ public final class NpcID public static final int LILIYA = 2632; public static final int BANKER_2633 = 2633; public static final int MYRE_BLAMISH_SNAIL = 2634; - public static final int BOB_2635 = 2635; + public static final int BOB = 2635; public static final int BOB_2636 = 2636; public static final int SPHINX = 2637; public static final int NEITE = 2638; @@ -2544,11 +2536,12 @@ public final class NpcID public static final int IMIAGO = 2688; public static final int LILIWEN = 2689; public static final int COOL_MOM227 = 2690; - public static final int CHICKEN = 2692; - public static final int CHICKEN_2693 = 2693; - public static final int ROOSTER = 2694; - public static final int LIL_LAMB = 2695; - public static final int LAMB = 2696; + public static final int SHEEP_2691 = 2691; + public static final int SHEEP_2692 = 2692; + public static final int SHEEP_2693 = 2693; + public static final int SHEEP_2694 = 2694; + public static final int SHEEP_2695 = 2695; + public static final int SHEEP_2696 = 2696; public static final int SHEEP_2697 = 2697; public static final int SHEEP_2698 = 2698; public static final int SHEEP_2699 = 2699; @@ -2642,43 +2635,43 @@ public final class NpcID public static final int SHEEP_2787 = 2787; public static final int SHEEP_2788 = 2788; public static final int SHEEP_2789 = 2789; - public static final int SHEEP_2790 = 2790; - public static final int SHEEP_2791 = 2791; - public static final int SHEEP_2792 = 2792; - public static final int SHEEP_2793 = 2793; - public static final int SHEEP_2794 = 2794; - public static final int SHEEP_2795 = 2795; - public static final int SHEEP_2796 = 2796; - public static final int SHEEP_2797 = 2797; - public static final int SHEEP_2798 = 2798; - public static final int SHEEP_2799 = 2799; - public static final int SHEEP_2800 = 2800; - public static final int SHEEP_2801 = 2801; - public static final int SHEEP_2802 = 2802; - public static final int SHEEP_2803 = 2803; - public static final int SHEEP_2804 = 2804; - public static final int COW = 2805; - public static final int COW_2806 = 2806; - public static final int COW_CALF = 2807; - public static final int COW_2808 = 2808; - public static final int COW_CALF_2809 = 2809; - public static final int COW_2810 = 2810; - public static final int PIG = 2811; - public static final int PIG_2812 = 2812; - public static final int PIGLET = 2813; - public static final int PIGLET_2814 = 2814; - public static final int PIGLET_2815 = 2815; - public static final int COW_CALF_2816 = 2816; - public static final int SHEEPDOG = 2817; - public static final int ROOSTER_2818 = 2818; - public static final int CHICKEN_2819 = 2819; - public static final int CHICKEN_2820 = 2820; - public static final int CHICKEN_2821 = 2821; - public static final int PIG_2822 = 2822; - public static final int PIG_2823 = 2823; - public static final int PIGLET_2824 = 2824; - public static final int PIGLET_2825 = 2825; - public static final int PIGLET_2826 = 2826; + public static final int COW = 2790; + public static final int COW_2791 = 2791; + public static final int COW_CALF = 2792; + public static final int COW_2793 = 2793; + public static final int COW_CALF_2794 = 2794; + public static final int COW_2795 = 2795; + public static final int PIG = 2796; + public static final int PIG_2797 = 2797; + public static final int PIGLET = 2798; + public static final int PIGLET_2799 = 2799; + public static final int PIGLET_2800 = 2800; + public static final int COW_CALF_2801 = 2801; + public static final int SHEEPDOG = 2802; + public static final int ROOSTER_2803 = 2803; + public static final int CHICKEN_2804 = 2804; + public static final int CHICKEN_2805 = 2805; + public static final int CHICKEN_2806 = 2806; + public static final int PIG_2807 = 2807; + public static final int PIG_2808 = 2808; + public static final int PIGLET_2809 = 2809; + public static final int PIGLET_2810 = 2810; + public static final int PIGLET_2811 = 2811; + public static final int BOB_2812 = 2812; + public static final int SHOP_KEEPER = 2813; + public static final int SHOP_ASSISTANT = 2814; + public static final int SHOP_KEEPER_2815 = 2815; + public static final int SHOP_ASSISTANT_2816 = 2816; + public static final int SHOP_KEEPER_2817 = 2817; + public static final int SHOP_ASSISTANT_2818 = 2818; + public static final int SHOP_KEEPER_2819 = 2819; + public static final int SHOP_ASSISTANT_2820 = 2820; + public static final int SHOP_KEEPER_2821 = 2821; + public static final int SHOP_ASSISTANT_2822 = 2822; + public static final int SHOP_KEEPER_2823 = 2823; + public static final int SHOP_ASSISTANT_2824 = 2824; + public static final int SHOP_KEEPER_2825 = 2825; + public static final int SHOP_ASSISTANT_2826 = 2826; public static final int BAT = 2827; public static final int DRYAD = 2828; public static final int FAIRY_2829 = 2829; @@ -2697,7 +2690,7 @@ public final class NpcID public static final int ICE_WARRIOR_2842 = 2842; public static final int OTHERWORLDLY_BEING = 2843; public static final int MAGIC_AXE = 2844; - public static final int SNAKE = 2845; + public static final int SNAKE_2845 = 2845; public static final int SKAVID = 2846; public static final int YETI = 2847; public static final int MONKEY_2848 = 2848; @@ -2720,33 +2713,33 @@ public final class NpcID public static final int DUNGEON_RAT = 2865; public static final int DUNGEON_RAT_2866 = 2866; public static final int DUNGEON_RAT_2867 = 2867; - public static final int DARK_WIZARD_2868 = 2868; - public static final int INVRIGAR_THE_NECROMANCER = 2869; - public static final int DARK_WIZARD_2870 = 2870; - public static final int MUGGER_2871 = 2871; - public static final int WITCH = 2872; - public static final int WITCH_2873 = 2873; - public static final int BLACK_KNIGHT_2874 = 2874; - public static final int BLACK_KNIGHT_2875 = 2875; - public static final int HIGHWAYMAN = 2876; - public static final int HIGHWAYMAN_2877 = 2877; - public static final int CHAOS_DRUID = 2878; - public static final int PIRATE_2879 = 2879; - public static final int PIRATE_2880 = 2880; - public static final int PIRATE_2881 = 2881; - public static final int PIRATE_2882 = 2882; - public static final int THUG = 2883; - public static final int ROGUE = 2884; - public static final int MONK_OF_ZAMORAK = 2885; - public static final int MONK_OF_ZAMORAK_2886 = 2886; - public static final int MONK_OF_ZAMORAK_2887 = 2887; - public static final int TRIBESMAN = 2888; - public static final int DARK_WARRIOR = 2889; - public static final int CHAOS_DRUID_WARRIOR = 2890; - public static final int NECROMANCER = 2891; - public static final int BANDIT_2892 = 2892; - public static final int GUARD_BANDIT = 2893; - public static final int BARBARIAN_GUARD = 2894; + public static final int FAIRY_SHOP_KEEPER = 2868; + public static final int FAIRY_SHOP_ASSISTANT = 2869; + public static final int VALAINE = 2870; + public static final int SCAVVO = 2871; + public static final int PEKSA = 2872; + public static final int SILK_TRADER = 2873; + public static final int GEM_TRADER = 2874; + public static final int ZEKE = 2875; + public static final int LOUIE_LEGS = 2876; + public static final int KARIM = 2877; + public static final int RANAEL = 2878; + public static final int DOMMIK = 2879; + public static final int ZAFF = 2880; + public static final int BARAEK = 2881; + public static final int HORVIK = 2882; + public static final int LOWE = 2883; + public static final int SHOP_KEEPER_2884 = 2884; + public static final int SHOP_ASSISTANT_2885 = 2885; + public static final int AUBURY = 2886; + public static final int FANCY_DRESS_SHOP_OWNER = 2887; + public static final int SHOP_KEEPER_2888 = 2888; + public static final int GRUM_2889 = 2889; + public static final int WYDIN_2890 = 2890; + public static final int GERRANT_2891 = 2891; + public static final int BRIAN = 2892; + public static final int JIMINUA = 2893; + public static final int SHOP_KEEPER_2894 = 2894; public static final int COOK_2895 = 2895; public static final int COOK_2896 = 2896; public static final int BANKER_2897 = 2897; @@ -3022,23 +3015,23 @@ public final class NpcID public static final int EMERALD_BENEDICT = 3194; public static final int SPIN_BLADES = 3195; public static final int SPIN_BLADES_3196 = 3196; - public static final int SNAKE_3199 = 3199; - public static final int MONKEY_3200 = 3200; - public static final int ALBINO_BAT = 3201; - public static final int CRAB_3202 = 3202; - public static final int GIANT_MOSQUITO = 3203; - public static final int JUNGLE_HORROR = 3204; - public static final int JUNGLE_HORROR_3205 = 3205; - public static final int JUNGLE_HORROR_3206 = 3206; - public static final int JUNGLE_HORROR_3207 = 3207; - public static final int JUNGLE_HORROR_3208 = 3208; - public static final int CAVE_HORROR = 3209; - public static final int CAVE_HORROR_3210 = 3210; - public static final int CAVE_HORROR_3211 = 3211; - public static final int CAVE_HORROR_3212 = 3212; - public static final int CAVE_HORROR_3213 = 3213; - public static final int CAVEY_DAVEY = 3214; - public static final int PATCHY = 3215; + public static final int CANDLE_MAKER = 3199; + public static final int ARHEIN = 3200; + public static final int JUKAT = 3201; + public static final int LUNDERWIN = 3202; + public static final int IRKSOL = 3203; + public static final int FAIRY_3204 = 3204; + public static final int ZAMBO = 3205; + public static final int SILVER_MERCHANT = 3206; + public static final int GEM_MERCHANT = 3207; + public static final int BAKER = 3208; + public static final int SPICE_SELLER = 3209; + public static final int FUR_TRADER = 3210; + public static final int SILK_MERCHANT = 3211; + public static final int HICKTON = 3212; + public static final int HARRY = 3213; + public static final int CASSIE = 3214; + public static final int FRINCOS = 3215; public static final int MELEE_COMBAT_TUTOR = 3216; public static final int RANGED_COMBAT_TUTOR = 3217; public static final int MAGIC_COMBAT_TUTOR = 3218; @@ -4354,7 +4347,7 @@ public final class NpcID public static final int GEM_MERCHANT_4581 = 4581; public static final int SILVER_MERCHANT_4582 = 4582; public static final int SILK_MERCHANT_4583 = 4583; - public static final int ZENESHA_4584 = 4584; + public static final int ZENESHA = 4584; public static final int ALI_MORRISANE_4585 = 4585; public static final int GRIMESQUIT = 4586; public static final int PHINGSPET = 4587; @@ -5591,11 +5584,11 @@ public final class NpcID public static final int TZREKJAD = 5892; public static final int TZREKJAD_5893 = 5893; public static final int BAST = 5894; - public static final int BANKER_5895 = 5895; - public static final int BANKER_5896 = 5896; - public static final int BANKER_5897 = 5897; - public static final int BANKER_5904 = 5904; - public static final int BANKER_5905 = 5905; + public static final int DROGO_DWARF = 5895; + public static final int FLYNN = 5896; + public static final int WAYNE = 5897; + public static final int DWARF_5904 = 5904; + public static final int BETTY_5905 = 5905; public static final int PROBITA = 5906; public static final int CHAOS_ELEMENTAL_JR_5907 = 5907; public static final int ABYSSAL_SIRE_5908 = 5908; @@ -6021,8 +6014,8 @@ public final class NpcID public static final int FIDELIO = 6525; public static final int SBOTT = 6526; public static final int ROAVAR = 6527; - public static final int BANKER_6529 = 6529; - public static final int BANKER_6530 = 6530; + public static final int HERQUIN = 6529; + public static final int ROMMIK = 6530; public static final int BLURBERRY = 6531; public static final int BARMAN_6532 = 6532; public static final int ROMILY_WEAKLAX = 6533; @@ -7135,7 +7128,7 @@ public final class NpcID public static final int ANCIENT_WYVERN = 7795; public static final int LOBSTROSITY = 7796; public static final int ANCIENT_ZYGOMITE = 7797; - public static final int ANCIENT_FUNGI = 7798; + public static final int GAIUS = 7798; public static final int AMMONITE_CRAB = 7799; public static final int FOSSIL_ROCK = 7800; public static final int TAR_BUBBLES = 7801; @@ -7745,7 +7738,7 @@ public final class NpcID public static final int TRAPPED_SOUL_HARD = 8529; public static final int AMELIA_8530 = 8530; public static final int ALLANNA = 8531; - public static final int LEKE_QUO_KERAN = 8532; + public static final int JATIX = 8532; public static final int NIKKIE = 8533; public static final int ROSIE = 8534; public static final int ALAN = 8535; @@ -7855,11 +7848,23 @@ public final class NpcID public static final int ILFEEN_8677 = 8677; public static final int FERAL_VAMPYRE_8678 = 8678; public static final int ABIDOR_CRANK_8679 = 8679; - public static final int BANKER_8680 = 8680; - public static final int BANKER_8681 = 8681; - public static final int BANKER_8682 = 8682; - public static final int PORTAL_8684 = 8684; - public static final int PORTAL_8686 = 8686; + public static final int DAVON = 8680; + public static final int ZENESHA_8681 = 8681; + public static final int AEMAD = 8682; + public static final int KORTAN = 8683; + public static final int ROACHEY = 8684; + public static final int FRENITA = 8685; + public static final int NURMOF = 8686; + public static final int TEA_SELLER = 8687; + public static final int FAT_TONY = 8688; + public static final int ANCIENT_FUNGI = 8690; + public static final int ANCIENT_FUNGI_8691 = 8691; + public static final int NOTERAZZO = 8692; + public static final int DIANGO = 8693; + public static final int BRIAN_8694 = 8694; public static final int MOSOL_REI_8696 = 8696; + public static final int LEKE_QUO_KERAN = 8697; + public static final int MONK_OF_ZAMORAK_8698 = 8698; + public static final int LARRAN = 8699; /* This file is automatically generated. Do not edit. */ } From 2bfd069e22559472bde3ca55cd3594dc409b6e8a Mon Sep 17 00:00:00 2001 From: RuneLite Cache-Code Autoupdater Date: Thu, 20 Jun 2019 10:33:25 +0000 Subject: [PATCH 085/117] Update Widget IDs to 2019-06-20-rev180 --- .../src/main/java/net/runelite/api/widgets/WidgetID.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java index a91f295588..6a097d254c 100644 --- a/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java +++ b/runelite-api/src/main/java/net/runelite/api/widgets/WidgetID.java @@ -732,11 +732,11 @@ public class WidgetID static class Pvp { - static final int BOUNTY_HUNTER_INFO = 19; + static final int BOUNTY_HUNTER_INFO = 18; static final int KILLDEATH_RATIO = 15; - static final int SKULL_CONTAINER = 62; - static final int SAFE_ZONE = 64; - static final int WILDERNESS_LEVEL = 67; // this can also be the Deadman Mode "Protection" text + static final int SKULL_CONTAINER = 61; + static final int SAFE_ZONE = 63; + static final int WILDERNESS_LEVEL = 66; // this can also be the Deadman Mode "Protection" text } static class KourendFavour From 1c9dacf4971bd3c3b1527718cbd8c29a5c4aa67f Mon Sep 17 00:00:00 2001 From: Max Weber Date: Thu, 20 Jun 2019 04:48:59 -0600 Subject: [PATCH 086/117] LootManager: update npc ids --- .../src/main/java/net/runelite/client/game/LootManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/game/LootManager.java b/runelite-client/src/main/java/net/runelite/client/game/LootManager.java index 3369f76aef..4e2f11201b 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/LootManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/LootManager.java @@ -109,7 +109,7 @@ public class LootManager case NpcID.LIZARD: case NpcID.ZYGOMITE: - case NpcID.ZYGOMITE_474: + case NpcID.ZYGOMITE_1024: case NpcID.ANCIENT_ZYGOMITE: // these monsters die with >0 hp, so we just look for coincident From 5b8d0e897fe7aeeccda5bddeeed98ba3f8e50027 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 20 Jun 2019 11:19:34 +0000 Subject: [PATCH 087/117] [maven-release-plugin] prepare release runelite-parent-1.5.27 --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index b38cde63a8..a4593fb219 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 1b5c9aeb3e..5652c9c218 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 99b8c5d74a..01321d6c81 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 cache diff --git a/http-api/pom.xml b/http-api/pom.xml index 8416e66087..eb78d2f483 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 7e0f8c90f6..673421c012 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 Web Service diff --git a/pom.xml b/pom.xml index 3ff666086c..43515b0c36 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - HEAD + runelite-parent-1.5.27 diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index b1a76077d7..5bc8fe2f49 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 722766e9a3..4b5e299c2b 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index 13d29bba94..ffda036d40 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 35edb85818..73163844d5 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 9f03b75640..57de34dcca 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index eb035101c6..fb8aa1baae 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index bcbaaa1171..3e49f2103a 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.27 net.runelite.rs From 9620a4fce6818d0c0365702427affedf96c2caf1 Mon Sep 17 00:00:00 2001 From: Runelite auto updater Date: Thu, 20 Jun 2019 11:19:39 +0000 Subject: [PATCH 088/117] [maven-release-plugin] prepare for next development iteration --- cache-client/pom.xml | 2 +- cache-updater/pom.xml | 2 +- cache/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 2 +- pom.xml | 4 ++-- protocol-api/pom.xml | 2 +- protocol/pom.xml | 2 +- runelite-api/pom.xml | 2 +- runelite-client/pom.xml | 2 +- runelite-mixins/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 2 +- runescape-api/pom.xml | 2 +- 13 files changed, 14 insertions(+), 14 deletions(-) diff --git a/cache-client/pom.xml b/cache-client/pom.xml index a4593fb219..59b213541f 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT cache-client diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index 5652c9c218..4eb3f28217 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT Cache Updater diff --git a/cache/pom.xml b/cache/pom.xml index 01321d6c81..2069230ff9 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT cache diff --git a/http-api/pom.xml b/http-api/pom.xml index eb78d2f483..0b08a5d6c9 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 673421c012..b47299f9b2 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT Web Service diff --git a/pom.xml b/pom.xml index 43515b0c36..b191cd34d0 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT pom RuneLite @@ -59,7 +59,7 @@ https://github.com/runelite/runelite scm:git:git://github.com/runelite/runelite scm:git:git@github.com:runelite/runelite - runelite-parent-1.5.27 + HEAD diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 5bc8fe2f49..cb85d612f9 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT protocol-api diff --git a/protocol/pom.xml b/protocol/pom.xml index 4b5e299c2b..1e03da9e36 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT protocol diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index ffda036d40..a4c60790a2 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT runelite-api diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 73163844d5..6f765e2d81 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT client diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 57de34dcca..db8285d1c9 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT mixins diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index fb8aa1baae..25f0b49f51 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT script-assembler-plugin diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index 3e49f2103a..710b68be9f 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27 + 1.5.28-SNAPSHOT net.runelite.rs From 993731a0d976730b7fb1f548186b684dea0bc3d7 Mon Sep 17 00:00:00 2001 From: xperiaclash Date: Thu, 20 Jun 2019 15:42:19 +0200 Subject: [PATCH 089/117] fixes #664 --- .../runeliteplus/RuneLitePlusPlugin.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/runeliteplus/RuneLitePlusPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/runeliteplus/RuneLitePlusPlugin.java index 257d2e470a..289940cb8f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/runeliteplus/RuneLitePlusPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/runeliteplus/RuneLitePlusPlugin.java @@ -27,8 +27,10 @@ package net.runelite.client.plugins.runeliteplus; import com.google.inject.Provides; + import java.awt.event.KeyEvent; import javax.inject.Inject; + import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.events.ConfigChanged; @@ -48,11 +50,11 @@ import net.runelite.client.plugins.PluginType; import net.runelite.client.ui.ClientUI; @PluginDescriptor( - loadWhenOutdated = true, // prevent users from disabling - hidden = true, // prevent users from disabling - name = "RuneLitePlus", - description = "Configures various aspects of RuneLitePlus", - type = PluginType.EXTERNAL + loadWhenOutdated = true, // prevent users from disabling + hidden = true, // prevent users from disabling + name = "RuneLitePlus", + description = "Configures various aspects of RuneLitePlus", + type = PluginType.EXTERNAL ) @Slf4j @@ -251,10 +253,13 @@ public class RuneLitePlusPlugin extends Plugin private void handleKey(char c) { if (client.getWidget(WidgetID.BANK_PIN_GROUP_ID, 0) == null - || !client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText().equals("Bank of Gielinor") - && !client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText().equals("Chambers of Xeric") - && !client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText().equals("Grand Exchange") - && !client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText().equals("Housing Security System")) + || !client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText().equals("Bank of Gielinor") + && !client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText().equals("Chambers of Xeric") + && !client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText().equals("Grand Exchange") + && !client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText().equals("Housing Security System") + && !client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText().equals("Dominic's Coffer") + && !client.getWidget(WidgetInfo.BANK_PIN_TOP_LEFT_TEXT).getText().equals("Dominic's Reward Shop")) + { entered = 0; enterIdx = 0; From 9cc32a6307c6b45a356c8e1afddb98bac772a4ec Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 20 Jun 2019 19:02:01 +0200 Subject: [PATCH 090/117] Bump up version numbers --- bootstrap.json | 30 +++++++++---------- cache-client/pom.xml | 6 +++- cache-updater/pom.xml | 7 +++-- cache/pom.xml | 17 ++++++----- deobfuscator/pom.xml | 2 +- http-api/pom.xml | 2 +- http-service/pom.xml | 24 +++++++-------- injected-client/pom.xml | 2 +- injector-plugin/pom.xml | 2 +- pom.xml | 4 +-- protocol-api/pom.xml | 4 ++- protocol/pom.xml | 5 +++- runelite-api/pom.xml | 8 ++--- runelite-client/pom.xml | 7 +---- .../client/util/bootstrap/Client.java | 2 +- runelite-mixins/pom.xml | 12 +++----- runelite-plugin-archetype/pom.xml | 2 +- runelite-script-assembler-plugin/pom.xml | 14 +++------ runescape-api/pom.xml | 2 +- runescape-client/pom.xml | 4 +-- scripts/pom.xml | 6 +--- 21 files changed, 74 insertions(+), 88 deletions(-) diff --git a/bootstrap.json b/bootstrap.json index 6c1ab35484..9032e655d3 100644 --- a/bootstrap.json +++ b/bootstrap.json @@ -20,10 +20,10 @@ "size": "3168921" }, { - "hash": "43ab86508a0d8f944470ad5fcae6b9997eb9c640f72371f587e721e29588fa24", - "name": "client-1.5.27-SNAPSHOT.jar", - "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/client-1.5.27-SNAPSHOT.jar", - "size": "5841971" + "hash": "7d64dafaf007613fef59f47884ce62db5fdc21e148b351e52a3f6ce7cc28928e", + "name": "client-1.5.28-SNAPSHOT.jar", + "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/client-1.5.28-SNAPSHOT.jar", + "size": "5845716" }, { "hash": "18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79", @@ -212,21 +212,21 @@ "size": "2327547" }, { - "hash": "38d569278eb8cbd1ea875522d3df2befd14d90f395655f78e60f947050119303", - "name": "runelite-api-1.5.27-SNAPSHOT.jar", - "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/runelite-api-1.5.27-SNAPSHOT.jar", - "size": "1019722" + "hash": "0858c0fa0e3efa454a2c06a60e0b9c003661cdccb52331b36f0d1dc4e90d381f", + "name": "runelite-api-1.5.28-SNAPSHOT.jar", + "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/runelite-api-1.5.28-SNAPSHOT.jar", + "size": "1019717" }, { - "hash": "aa7cbacf941b1b12c0d083688c5da272db0a21ee2ef31e5a59ea659b323d139c", - "name": "runescape-api-1.5.27-SNAPSHOT.jar", - "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/runescape-api-1.5.27-SNAPSHOT.jar", + "hash": "69eddc4155a66e07761c433dc83c0703afe7b1206063fc5e1ef77c787ce777ee", + "name": "runescape-api-1.5.28-SNAPSHOT.jar", + "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/runescape-api-1.5.28-SNAPSHOT.jar", "size": "56056" }, { - "hash": "6a2a6b860c4ea1bbeb4cf483f9c0b97a065a2ea93327a3ed28dce8d3a3f5f305", - "name": "http-api-1.5.27-SNAPSHOT.jar", - "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/http-api-1.5.27-SNAPSHOT.jar", + "hash": "55426093ae731f5c25fe6d5eb28bfb8f645ea7e41faad9e12f53d40f683101be", + "name": "http-api-1.5.28-SNAPSHOT.jar", + "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/http-api-1.5.28-SNAPSHOT.jar", "size": "101785" }, { @@ -260,7 +260,7 @@ "extension": "jar", "groupId": "net.runelite", "properties": "", - "version": "1.5.27" + "version": "1.5.28" }, "clientJvm9Arguments": [ "-XX:+DisableAttachMechanism", diff --git a/cache-client/pom.xml b/cache-client/pom.xml index ebe28ee8c8..59b213541f 100644 --- a/cache-client/pom.xml +++ b/cache-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT cache-client @@ -50,10 +50,14 @@ junit junit + 4.12 + test org.slf4j slf4j-simple + 1.7.12 + test net.runelite diff --git a/cache-updater/pom.xml b/cache-updater/pom.xml index eec033bd29..4eb3f28217 100644 --- a/cache-updater/pom.xml +++ b/cache-updater/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT Cache Updater @@ -36,7 +36,6 @@ 1.5.6.RELEASE - 5.1.45 @@ -59,7 +58,7 @@ mysql mysql-connector-java - ${mysql.connector.version} + 5.1.45 net.runelite @@ -69,10 +68,12 @@ org.sql2o sql2o + 1.5.4 io.minio minio + 3.0.6 org.projectlombok diff --git a/cache/pom.xml b/cache/pom.xml index 6fd5d36c0f..9fd6153b3b 100644 --- a/cache/pom.xml +++ b/cache/pom.xml @@ -29,18 +29,16 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT cache Cache - 1.3.1 - 1.10 - 4.6 - 165 + + 4.6 @@ -61,7 +59,7 @@ org.apache.commons commons-compress - ${commons.compress.version} + 1.10 com.google.code.gson @@ -70,6 +68,7 @@ io.netty netty-buffer + 4.1.0.Final org.antlr @@ -79,7 +78,7 @@ commons-cli commons-cli - ${commons.cli.version} + 1.3.1 org.projectlombok @@ -90,10 +89,14 @@ junit junit + 4.12 + test org.slf4j slf4j-simple + 1.7.12 + test net.runelite.rs diff --git a/deobfuscator/pom.xml b/deobfuscator/pom.xml index af5e2792b4..c711697622 100644 --- a/deobfuscator/pom.xml +++ b/deobfuscator/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT deobfuscator diff --git a/http-api/pom.xml b/http-api/pom.xml index 9727dc2642..ccd886a376 100644 --- a/http-api/pom.xml +++ b/http-api/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT Web API diff --git a/http-service/pom.xml b/http-service/pom.xml index 5f06963aa8..b47299f9b2 100644 --- a/http-service/pom.xml +++ b/http-service/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT Web Service @@ -38,12 +38,6 @@ 1.5.6.RELEASE 1.2.0.Final - 2.2.3 - 3.10.1 - 4.1.0 - 3.1.8 - 2.10.0 - 2.3.1 @@ -91,12 +85,13 @@ org.mariadb.jdbc mariadb-java-client - ${maria.java.client.version} + 2.2.3 provided org.sql2o sql2o + 1.5.4 com.google.guava @@ -109,16 +104,17 @@ com.github.scribejava scribejava-apis - ${scribejava.apis.version} + 4.1.0 io.minio minio + 3.0.6 redis.clients jedis - ${redis.clients.version} + 2.10.0 org.apache.commons @@ -129,7 +125,7 @@ org.mongodb mongodb-driver-sync - ${mongodb.driver.version} + 3.10.1 @@ -140,6 +136,8 @@ com.squareup.okhttp3 mockwebserver + 3.7.0 + test com.h2database @@ -190,13 +188,13 @@ com.github.kongchen swagger-maven-plugin - ${swagger.maven.plugin.version} + 3.1.8 javax.xml.bind jaxb-api - ${jaxb.api.version} + 2.3.1 diff --git a/injected-client/pom.xml b/injected-client/pom.xml index c8605a8c6d..77cc2e42e8 100644 --- a/injected-client/pom.xml +++ b/injected-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT injected-client diff --git a/injector-plugin/pom.xml b/injector-plugin/pom.xml index 38728b11e2..a80ce1afb3 100644 --- a/injector-plugin/pom.xml +++ b/injector-plugin/pom.xml @@ -30,7 +30,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT net.runelite.rs diff --git a/pom.xml b/pom.xml index b404ec6e40..6a41755b67 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT pom RuneLite @@ -302,9 +302,7 @@ checkstyle.xml - ${project.build.sourceDirectory} - true diff --git a/protocol-api/pom.xml b/protocol-api/pom.xml index 574921c269..cb85d612f9 100644 --- a/protocol-api/pom.xml +++ b/protocol-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT protocol-api @@ -58,6 +58,8 @@ junit junit + 4.12 + test diff --git a/protocol/pom.xml b/protocol/pom.xml index b02fe25c69..1e03da9e36 100644 --- a/protocol/pom.xml +++ b/protocol/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT protocol @@ -54,6 +54,7 @@ io.netty netty-all + 4.1.0.Final org.projectlombok @@ -64,6 +65,8 @@ junit junit + 4.12 + test diff --git a/runelite-api/pom.xml b/runelite-api/pom.xml index de7b43c940..bfcbf4c4a7 100644 --- a/runelite-api/pom.xml +++ b/runelite-api/pom.xml @@ -29,16 +29,12 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT runelite-api RuneLite API - - 1.3.9 - - org.slf4j @@ -52,7 +48,7 @@ com.google.code.findbugs jsr305 - ${jsr305.version} + 1.3.9 diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 407a3b17f3..5e690979e2 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT client @@ -232,11 +232,6 @@ ${runelite.orange.extensions.version} provided - - net.runelite.rs - runescape-api - ${project.version} - junit junit diff --git a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Client.java b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Client.java index 59b1c60ff9..c2ecf9da72 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Client.java +++ b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Client.java @@ -8,5 +8,5 @@ public class Client String extension = "jar"; String groupId = "net.runelite"; String properties = ""; - String version = "1.5.27"; + String version = "1.5.28"; } diff --git a/runelite-mixins/pom.xml b/runelite-mixins/pom.xml index 97ef913147..f299e82ec5 100644 --- a/runelite-mixins/pom.xml +++ b/runelite-mixins/pom.xml @@ -29,16 +29,12 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT mixins RuneLite Mixins - - 1 - - org.slf4j @@ -59,7 +55,7 @@ javax.inject javax.inject - ${javax.inject.version} + 1 provided @@ -82,8 +78,8 @@ - 1.7 - 1.7 + 1.6 + 1.6 diff --git a/runelite-plugin-archetype/pom.xml b/runelite-plugin-archetype/pom.xml index 710b157fde..1fd933b70e 100644 --- a/runelite-plugin-archetype/pom.xml +++ b/runelite-plugin-archetype/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT runelite-plugin-archetype diff --git a/runelite-script-assembler-plugin/pom.xml b/runelite-script-assembler-plugin/pom.xml index ee54dc85af..25f0b49f51 100644 --- a/runelite-script-assembler-plugin/pom.xml +++ b/runelite-script-assembler-plugin/pom.xml @@ -29,19 +29,13 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT script-assembler-plugin Script Assembler Plugin maven-plugin - - 3.0.5 - 3.4 - 3.4 - - net.runelite @@ -57,12 +51,12 @@ org.apache.maven maven-plugin-api - ${maven.plugin.api.version} + 3.0.5 org.apache.maven.plugin-tools maven-plugin-annotations - ${maven.plugin.annotations.version} + 3.4 @@ -71,7 +65,7 @@ org.apache.maven.plugins maven-plugin-plugin - ${maven.plugin.plugin.version} + 3.4 default-descriptor diff --git a/runescape-api/pom.xml b/runescape-api/pom.xml index bcbaaa1171..710b68be9f 100644 --- a/runescape-api/pom.xml +++ b/runescape-api/pom.xml @@ -29,7 +29,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT net.runelite.rs diff --git a/runescape-client/pom.xml b/runescape-client/pom.xml index b5dc6838ee..04e2850dde 100644 --- a/runescape-client/pom.xml +++ b/runescape-client/pom.xml @@ -5,7 +5,7 @@ net.runelite runelite-parent - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT net.runelite.rs @@ -16,7 +16,7 @@ net.runelite.rs runescape-api - 1.5.27-SNAPSHOT + 1.5.28-SNAPSHOT diff --git a/scripts/pom.xml b/scripts/pom.xml index e033f3d764..7898c2e8fb 100644 --- a/scripts/pom.xml +++ b/scripts/pom.xml @@ -31,16 +31,12 @@ 1.0.0 Scripts - - 2.12 - - org.apache.maven.wagon wagon-webdav-jackrabbit - ${webdav.version} + 2.12 From 1a54fc471177afca8506fb8dc307917206c4ecc8 Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 20 Jun 2019 21:52:22 +0200 Subject: [PATCH 091/117] Fix npc/gameobject combo's not being clickable with gpu enabled --- .../net/runelite/mixins/ClickboxMixin.java | 459 +++++++++++------- .../net/runelite/mixins/RSModelMixin.java | 310 ++++++------ .../java/net/runelite/mixins/RSTileMixin.java | 102 ++-- .../net/runelite/mixins/RSUserListMixin.java | 13 +- .../java/net/runelite/rs/api/RSModel.java | 5 +- runescape-client/src/main/java/Client.java | 2 +- runescape-client/src/main/java/class238.java | 4 +- runescape-client/src/main/java/class30.java | 2 +- 8 files changed, 506 insertions(+), 391 deletions(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/ClickboxMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/ClickboxMixin.java index 1200698f52..3bf15193e1 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/ClickboxMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/ClickboxMixin.java @@ -1,9 +1,12 @@ package net.runelite.mixins; +import net.runelite.api.Model; +import net.runelite.api.Perspective; import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.Mixin; import net.runelite.api.mixins.Shadow; import net.runelite.rs.api.RSClient; +import net.runelite.rs.api.RSModel; /** * Class to check clickboxes of models. Mostly refactored code from the client. @@ -11,16 +14,285 @@ import net.runelite.rs.api.RSClient; @Mixin(RSClient.class) public abstract class ClickboxMixin implements RSClient { + @Shadow("client") + private static RSClient client; + private static final int MAX_ENTITES_AT_MOUSE = 1000; private static final int CLICKBOX_CLOSE = 50; private static final int CLICKBOX_FAR = 10000; private static final int OBJECT_INTERACTION_FAR = 100; // Max distance, in tiles, from camera + @Inject private static final int[] rl$modelViewportXs = new int[4700]; + @Inject private static final int[] rl$modelViewportYs = new int[4700]; - @Shadow("client") - private static RSClient client; + + @Inject + public void checkClickbox(Model rlModel, int orientation, int pitchSin, int pitchCos, int yawSin, int yawCos, int _x, int _y, int _z, long hash) + { + RSModel model = (RSModel) rlModel; + boolean hasFlag = hash != 0L && (int) (hash >>> 16 & 1L) != 1; + boolean viewportContainsMouse = client.getViewportContainsMouse(); + + if (!hasFlag || !viewportContainsMouse) + { + return; + } + + boolean bb = boundingboxCheck(model, _x, _y, _z); + if (!bb) + { + return; + } + + if (Math.sqrt(_x * _x + _z * _z) > OBJECT_INTERACTION_FAR * Perspective.LOCAL_TILE_SIZE) + { + return; + } + + // only need a boundingbox check? + if (model.isClickable()) + { + addHashAtMouse(hash); + return; + } + + // otherwise we must check if the mouse is in a triangle + final int vertexCount = model.getVerticesCount(); + final int triangleCount = model.getTrianglesCount(); + + final int[] vertexX = model.getVerticesX(); + final int[] vertexY = model.getVerticesY(); + final int[] vertexZ = model.getVerticesZ(); + + final int[] triangleX = model.getTrianglesX(); + final int[] triangleY = model.getTrianglesY(); + final int[] triangleZ = model.getTrianglesZ(); + + final int[] color3 = model.getFaceColors3(); + + final int zoom = client.get3dZoom(); + + final int centerX = client.getCenterX(); + final int centerY = client.getCenterY(); + + int sin = 0; + int cos = 0; + if (orientation != 0) + { + sin = Perspective.SINE[orientation]; + cos = Perspective.COSINE[orientation]; + } + + for (int i = 0; i < vertexCount; ++i) + { + int x = vertexX[i]; + int y = vertexY[i]; + int z = vertexZ[i]; + + int var42; + if (orientation != 0) + { + var42 = z * sin + x * cos >> 16; + z = z * cos - x * sin >> 16; + x = var42; + } + + x += _x; + y += _y; + z += _z; + + var42 = z * yawSin + yawCos * x >> 16; + z = yawCos * z - x * yawSin >> 16; + x = var42; + var42 = pitchCos * y - z * pitchSin >> 16; + z = y * pitchSin + pitchCos * z >> 16; + + if (z >= 50) + { + rl$modelViewportYs[i] = x * zoom / z + centerX; + rl$modelViewportXs[i] = var42 * zoom / z + centerY; + } + else + { + rl$modelViewportYs[i] = -5000; + } + } + + final int viewportMouseX = client.getViewportMouseX(); + final int viewportMouseY = client.getViewportMouseY(); + + for (int i = 0; i < triangleCount; ++i) + { + if (color3[i] == -2) + { + continue; + } + + final int vA = triangleX[i]; + final int vB = triangleY[i]; + final int vC = triangleZ[i]; + + int y1 = rl$modelViewportYs[vA]; + int y2 = rl$modelViewportYs[vB]; + int y3 = rl$modelViewportYs[vC]; + + int x1 = rl$modelViewportXs[vA]; + int x2 = rl$modelViewportXs[vB]; + int x3 = rl$modelViewportXs[vC]; + + if (y1 == -5000 || y2 == -5000 || y3 == -5000) + { + continue; + } + + final int radius = model.isClickable() ? 20 : 5; + + int var18 = radius + viewportMouseY; + boolean var34; + if (var18 < x1 && var18 < x2 && var18 < x3) + { + var34 = false; + } + else + { + var18 = viewportMouseY - radius; + if (var18 > x1 && var18 > x2 && var18 > x3) + { + var34 = false; + } + else + { + var18 = radius + viewportMouseX; + if (var18 < y1 && var18 < y2 && var18 < y3) + { + var34 = false; + } + else + { + var18 = viewportMouseX - radius; + if (var18 > y1 && var18 > y2 && var18 > y3) + { + var34 = false; + } + else + { + var34 = true; + } + } + } + } + + if (var34) + { + addHashAtMouse(hash); + break; + } + } + } + + @Inject + private void addHashAtMouse(long hash) + { + long[] entitiesAtMouse = client.getEntitiesAtMouse(); + int count = client.getEntitiesAtMouseCount(); + if (count < MAX_ENTITES_AT_MOUSE) + { + entitiesAtMouse[count] = hash; + client.setEntitiesAtMouseCount(count + 1); + } + } + + @Inject + private boolean boundingboxCheck(Model model, int x, int y, int z) + { + final int cameraPitch = client.getCameraPitch(); + final int cameraYaw = client.getCameraYaw(); + + final int pitchSin = Perspective.SINE[cameraPitch]; + final int pitchCos = Perspective.COSINE[cameraPitch]; + + final int yawSin = Perspective.SINE[cameraYaw]; + final int yawCos = Perspective.COSINE[cameraYaw]; + + final int centerX = client.getCenterX(); + final int centerY = client.getCenterY(); + + final int viewportMouseX = client.getViewportMouseX(); + final int viewportMouseY = client.getViewportMouseY(); + + final int Rasterizer3D_zoom = client.get3dZoom(); + + int var6 = (viewportMouseX - centerX) * CLICKBOX_CLOSE / Rasterizer3D_zoom; + int var7 = (viewportMouseY - centerY) * CLICKBOX_CLOSE / Rasterizer3D_zoom; + int var8 = (viewportMouseX - centerX) * CLICKBOX_FAR / Rasterizer3D_zoom; + int var9 = (viewportMouseY - centerY) * CLICKBOX_FAR / Rasterizer3D_zoom; + int var10 = rl$rot1(var7, CLICKBOX_CLOSE, pitchCos, pitchSin); + int var11 = rl$rot2(var7, CLICKBOX_CLOSE, pitchCos, pitchSin); + var7 = var10; + var10 = rl$rot1(var9, CLICKBOX_FAR, pitchCos, pitchSin); + int var12 = rl$rot2(var9, CLICKBOX_FAR, pitchCos, pitchSin); + var9 = var10; + var10 = rl$rot3(var6, var11, yawCos, yawSin); + var11 = rl$rot4(var6, var11, yawCos, yawSin); + var6 = var10; + var10 = rl$rot3(var8, var12, yawCos, yawSin); + var12 = rl$rot4(var8, var12, yawCos, yawSin); + int field1720 = (var10 - var6) / 2; + int field638 = (var9 - var7) / 2; + int field1846 = (var12 - var11) / 2; + int field1722 = Math.abs(field1720); + int field601 = Math.abs(field638); + int field38 = Math.abs(field1846); + + int var38 = x + model.getCenterX(); + int var39 = y + model.getCenterY(); + int var40 = z + model.getCenterZ(); + int var41 = model.getExtremeX(); + int var42 = model.getExtremeY(); + int var43 = model.getExtremeZ(); + + int field1861 = (var6 + var10) / 2; + int field2317 = (var7 + var9) / 2; + int field528 = (var12 + var11) / 2; + + int var44 = field1861 - var38; + int var45 = field2317 - var39; + int var46 = field528 - var40; + + boolean passes; + if (Math.abs(var44) > var41 + field1722) + { + passes = false; + } + else if (Math.abs(var45) > var42 + field601) + { + passes = false; + } + else if (Math.abs(var46) > var43 + field38) + { + passes = false; + } + else if (Math.abs(var46 * field638 - var45 * field1846) > var42 * field38 + var43 * field601) + { + passes = false; + } + else if (Math.abs(var44 * field1846 - var46 * field1720) > var43 * field1722 + var41 * field38) + { + passes = false; + } + else if (Math.abs(var45 * field1720 - var44 * field638) > var42 * field1722 + var41 * field601) + { + passes = false; + } + else + { + passes = true; + } + + return passes; + } @Inject private static int rl$rot1(int var0, int var1, int var2, int var3) @@ -45,187 +317,4 @@ public abstract class ClickboxMixin implements RSClient { return var3 * var0 + var2 * var1 >> 16; } - - @Inject - public void checkClickbox(net.runelite.api.Model model, int n2, int n3, int n4, int n5, int n6, int n7, int n8, int n9, long l2) - { - int n10; - int n11; - int n12; - int n13; - int n14; - net.runelite.rs.api.RSModel rSModel = (net.runelite.rs.api.RSModel) model; - boolean bl2 = l2 != 0L && (int) (l2 >>> 16 & 1L) != 1; - boolean bl3 = client.getViewportContainsMouse(); - if (!bl2) - { - return; - } - if (!bl3) - { - return; - } - boolean bl4 = this.boundingboxCheck(rSModel, n7, n8, n9); - if (!bl4) - { - return; - } - if (rSModel.isClickable()) - { - this.addHashAtMouse(l2); - return; - } - int n15 = rSModel.getVerticesCount(); - int n16 = rSModel.getTrianglesCount(); - int[] arrn = rSModel.getVerticesX(); - int[] arrn2 = rSModel.getVerticesY(); - int[] arrn3 = rSModel.getVerticesZ(); - int[] arrn4 = rSModel.getTrianglesX(); - int[] arrn5 = rSModel.getTrianglesY(); - int[] arrn6 = rSModel.getTrianglesZ(); - int[] arrn7 = rSModel.getFaceColors3(); - int n17 = client.get3dZoom(); - int n18 = client.getCenterX(); - int n19 = client.getCenterY(); - int n20 = 0; - int n21 = 0; - if (n2 != 0) - { - n20 = net.runelite.api.Perspective.SINE[n2]; - n21 = net.runelite.api.Perspective.COSINE[n2]; - } - for (n14 = 0; n14 < n15; ++n14) - { - n11 = arrn[n14]; - n13 = arrn2[n14]; - n12 = arrn3[n14]; - if (n2 != 0) - { - n10 = n12 * n20 + n11 * n21 >> 16; - n12 = n12 * n21 - n11 * n20 >> 16; - n11 = n10; - } - n10 = (n12 += n9) * n5 + n6 * (n11 += n7) >> 16; - n12 = n6 * n12 - n11 * n5 >> 16; - n11 = n10; - n10 = n4 * (n13 += n8) - n12 * n3 >> 16; - if ((n12 = n13 * n3 + n4 * n12 >> 16) >= 50) - { - rl$modelViewportYs[n14] = n11 * n17 / n12 + n18; - rl$modelViewportXs[n14] = n10 * n17 / n12 + n19; - continue; - } - rl$modelViewportYs[n14] = -5000; - } - n14 = client.getViewportMouseX(); - n11 = client.getViewportMouseY(); - n13 = 0; - while (n13 < n16) - { - if (arrn7[n13] != -2) - { - int n22; - boolean bl5; - int n23; - n12 = arrn4[n13]; - n10 = arrn5[n13]; - int n24 = arrn6[n13]; - int n25 = rl$modelViewportYs[n12]; - int n26 = rl$modelViewportYs[n10]; - int n27 = rl$modelViewportYs[n24]; - int n28 = rl$modelViewportXs[n12]; - int n29 = rl$modelViewportXs[n10]; - int n30 = rl$modelViewportXs[n24]; - if (n25 != -5000 && n26 != -5000 && n27 != -5000 && (bl5 = ((n23 = (n22 = rSModel.isClickable() ? 20 - : 5) + n11) >= n28 || n23 >= n29 || n23 >= n30) && (((n23 = n11 - n22) <= n28 || n23 <= n29 || n23 <= n30) && (((n23 = n22 + n14) >= n25 || n23 >= n26 || n23 >= n27) && ((n23 = n14 - n22) <= n25 || n23 <= n26 || n23 <= n27))))) - { - this.addHashAtMouse(l2); - return; - } - } - ++n13; - } - } - - @Inject - private void addHashAtMouse(long hash) - { - long[] entitiesAtMouse = client.getEntitiesAtMouse(); - int count = client.getEntitiesAtMouseCount(); - if (count < MAX_ENTITES_AT_MOUSE) - { - entitiesAtMouse[count] = hash; - client.setEntitiesAtMouseCount(count + 1); - } - } - - @Inject - public boolean boundingboxCheck(net.runelite.api.Model model, int n2, int n3, int n4) - { - int n5 = client.getCameraPitch(); - int n6 = client.getCameraYaw(); - int n7 = net.runelite.api.Perspective.SINE[n5]; - int n8 = net.runelite.api.Perspective.COSINE[n5]; - int n9 = net.runelite.api.Perspective.SINE[n6]; - int n10 = net.runelite.api.Perspective.COSINE[n6]; - int n11 = client.getCenterX(); - int n12 = client.getCenterY(); - int n13 = client.getViewportMouseX(); - int n14 = client.getViewportMouseY(); - int n15 = client.get3dZoom(); - int n16 = (n13 - n11) * 50 / n15; - int n17 = (n14 - n12) * 50 / n15; - int n18 = (n13 - n11) * 10000 / n15; - int n19 = (n14 - n12) * 10000 / n15; - int n20 = rl$rot1(n17, 50, n8, n7); - int n21 = rl$rot2(n17, 50, n8, n7); - n17 = n20; - n20 = rl$rot1(n19, 10000, n8, n7); - int n22 = rl$rot2(n19, 10000, n8, n7); - n19 = n20; - n20 = rl$rot3(n16, n21, n10, n9); - n21 = rl$rot4(n16, n21, n10, n9); - n16 = n20; - n20 = rl$rot3(n18, n22, n10, n9); - n22 = rl$rot4(n18, n22, n10, n9); - int n23 = (n20 - n16) / 2; - int n24 = (n19 - n17) / 2; - int n25 = (n22 - n21) / 2; - int n26 = Math.abs(n23); - int n27 = Math.abs(n24); - int n28 = Math.abs(n25); - int n29 = n2 + model.getCenterX(); - int n30 = n3 + model.getCenterY(); - int n31 = n4 + model.getCenterZ(); - int n32 = model.getExtremeX(); - int n33 = model.getExtremeY(); - int n34 = model.getExtremeZ(); - int n35 = (n16 + n20) / 2; - int n36 = (n17 + n19) / 2; - int n37 = (n22 + n21) / 2; - int n38 = n35 - n29; - int n39 = n36 - n30; - int n40 = n37 - n31; - if (Math.abs(n38) > n32 + n26) - { - return false; - } - if (Math.abs(n39) > n33 + n27) - { - return false; - } - if (Math.abs(n40) > n34 + n28) - { - return false; - } - if (Math.abs(n40 * n24 - n39 * n25) > n33 * n28 + n34 * n27) - { - return false; - } - if (Math.abs(n38 * n25 - n40 * n23) > n34 * n26 + n32 * n28) - { - return false; - } - return Math.abs(n39 * n23 - n38 * n24) <= n33 * n26 + n32 * n27; - } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSModelMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSModelMixin.java index 38a27323e9..69d6776aec 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSModelMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSModelMixin.java @@ -54,10 +54,6 @@ public abstract class RSModelMixin implements RSModel @Inject private int rl$sceneId; - - @Inject - private boolean isClickable; - @Inject private int rl$bufferOffset; @@ -70,120 +66,6 @@ public abstract class RSModelMixin implements RSModel @Inject private float[][] rl$faceTextureVCoordinates; - @Inject - public void rl$init(Model[] models, int length) - { - rl$init((RSModel[]) models, length); - } - - @Inject - public boolean isClickable() - { - return isClickable; - } - - @Inject - public void interpolateFrames(RSFrames frames, int frameId, RSFrames nextFrames, int nextFrameId, int interval, int intervalCount) - { - if (getVertexGroups() != null) - { - if (frameId != -1) - { - RSAnimation frame = frames.getFrames()[frameId]; - RSSkeleton skin = frame.getSkin(); - RSAnimation nextFrame = null; - if (nextFrames != null) - { - nextFrame = nextFrames.getFrames()[nextFrameId]; - if (nextFrame.getSkin() != skin) - { - nextFrame = null; - } - } - - client.setAnimOffsetX(0); - client.setAnimOffsetY(0); - client.setAnimOffsetZ(0); - - interpolateFrames(skin, frame, nextFrame, interval, intervalCount); - resetBounds(); - } - } - } - - @Override - @Inject - public Polygon getConvexHull(int localX, int localY, int orientation, int tileHeight) - { - List vertices = getVertices(); - - // rotate vertices - for (int i = 0; i < vertices.size(); ++i) - { - Vertex v = vertices.get(i); - vertices.set(i, v.rotate(orientation)); - } - - List points = new ArrayList(); - - for (Vertex v : vertices) - { - // Compute canvas location of vertex - Point p = Perspective.localToCanvas(client, - localX - v.getX(), - localY - v.getZ(), - tileHeight + v.getY()); - if (p != null) - { - points.add(p); - } - } - - // Run Jarvis march algorithm - points = Jarvis.convexHull(points); - if (points == null) - { - return null; - } - - // Convert to a polygon - Polygon p = new Polygon(); - for (Point point : points) - { - p.addPoint(point.getX(), point.getY()); - } - - return p; - } - - @Inject - @Override - public float[][] getFaceTextureUCoordinates() - { - return rl$faceTextureUCoordinates; - } - - @Inject - @Override - public void setFaceTextureUCoordinates(float[][] faceTextureUCoordinates) - { - this.rl$faceTextureUCoordinates = faceTextureUCoordinates; - } - - @Inject - @Override - public float[][] getFaceTextureVCoordinates() - { - return rl$faceTextureVCoordinates; - } - - @Inject - @Override - public void setFaceTextureVCoordinates(float[][] faceTextureVCoordinates) - { - this.rl$faceTextureVCoordinates = faceTextureVCoordinates; - } - @MethodHook(value = "", end = true) @Inject public void rl$init(RSModel[] models, int length) @@ -277,48 +159,6 @@ public abstract class RSModelMixin implements RSModel return triangles; } - @Inject - @Override - public int getSceneId() - { - return rl$sceneId; - } - - @Inject - @Override - public void setSceneId(int sceneId) - { - this.rl$sceneId = sceneId; - } - - @Inject - @Override - public int getBufferOffset() - { - return rl$bufferOffset; - } - - @Inject - @Override - public void setBufferOffset(int bufferOffset) - { - rl$bufferOffset = bufferOffset; - } - - @Inject - @Override - public int getUvBufferOffset() - { - return rl$uvBufferOffset; - } - - @Inject - @Override - public void setUvBufferOffset(int bufferOffset) - { - rl$uvBufferOffset = bufferOffset; - } - @Copy("contourGround") public abstract Model rs$contourGround(int[][] tileHeights, int packedX, int height, int packedY, boolean copy, int contouredGround); @@ -346,6 +186,35 @@ public abstract class RSModelMixin implements RSModel rsModel.setFaceTextureVCoordinates(rl$faceTextureVCoordinates); } + @Inject + public void interpolateFrames(RSFrames frames, int frameId, RSFrames nextFrames, int nextFrameId, int interval, int intervalCount) + { + if (getVertexGroups() != null) + { + if (frameId != -1) + { + RSAnimation frame = frames.getFrames()[frameId]; + RSSkeleton skin = frame.getSkin(); + RSAnimation nextFrame = null; + if (nextFrames != null) + { + nextFrame = nextFrames.getFrames()[nextFrameId]; + if (nextFrame.getSkin() != skin) + { + nextFrame = null; + } + } + + client.setAnimOffsetX(0); + client.setAnimOffsetY(0); + client.setAnimOffsetZ(0); + + interpolateFrames(skin, frame, nextFrame, interval, intervalCount); + resetBounds(); + } + } + } + @Inject public void interpolateFrames(RSSkeleton skin, RSAnimation frame, RSAnimation nextFrame, int interval, int intervalCount) { @@ -356,7 +225,7 @@ public abstract class RSModelMixin implements RSModel { int type = frame.getTransformTypes()[i]; this.animate(skin.getTypes()[type], skin.getList()[type], frame.getTranslatorX()[i], - frame.getTranslatorY()[i], frame.getTranslatorZ()[i]); + frame.getTranslatorY()[i], frame.getTranslatorZ()[i]); } } else @@ -367,13 +236,13 @@ public abstract class RSModelMixin implements RSModel { boolean frameValid = false; if (transformIndex < frame.getTransformCount() - && frame.getTransformTypes()[transformIndex] == i) + && frame.getTransformTypes()[transformIndex] == i) { frameValid = true; } boolean nextFrameValid = false; if (nextTransformIndex < nextFrame.getTransformCount() - && nextFrame.getTransformTypes()[nextTransformIndex] == i) + && nextFrame.getTransformTypes()[nextTransformIndex] == i) { nextFrameValid = true; } @@ -449,4 +318,119 @@ public abstract class RSModelMixin implements RSModel } } } + + @Override + @Inject + public Polygon getConvexHull(int localX, int localY, int orientation, int tileHeight) + { + List vertices = getVertices(); + + // rotate vertices + for (int i = 0; i < vertices.size(); ++i) + { + Vertex v = vertices.get(i); + vertices.set(i, v.rotate(orientation)); + } + + List points = new ArrayList(); + + for (Vertex v : vertices) + { + // Compute canvas location of vertex + Point p = Perspective.localToCanvas(client, + localX - v.getX(), + localY - v.getZ(), + tileHeight + v.getY()); + if (p != null) + { + points.add(p); + } + } + + // Run Jarvis march algorithm + points = Jarvis.convexHull(points); + if (points == null) + { + return null; + } + + // Convert to a polygon + Polygon p = new Polygon(); + for (Point point : points) + { + p.addPoint(point.getX(), point.getY()); + } + + return p; + } + + @Inject + @Override + public int getSceneId() + { + return rl$sceneId; + } + + @Inject + @Override + public void setSceneId(int sceneId) + { + this.rl$sceneId = sceneId; + } + + @Inject + @Override + public int getBufferOffset() + { + return rl$bufferOffset; + } + + @Inject + @Override + public void setBufferOffset(int bufferOffset) + { + rl$bufferOffset = bufferOffset; + } + + @Inject + @Override + public int getUvBufferOffset() + { + return rl$uvBufferOffset; + } + + @Inject + @Override + public void setUvBufferOffset(int bufferOffset) + { + rl$uvBufferOffset = bufferOffset; + } + + @Inject + @Override + public float[][] getFaceTextureUCoordinates() + { + return rl$faceTextureUCoordinates; + } + + @Inject + @Override + public void setFaceTextureUCoordinates(float[][] faceTextureUCoordinates) + { + this.rl$faceTextureUCoordinates = faceTextureUCoordinates; + } + + @Inject + @Override + public float[][] getFaceTextureVCoordinates() + { + return rl$faceTextureVCoordinates; + } + + @Inject + @Override + public void setFaceTextureVCoordinates(float[][] faceTextureVCoordinates) + { + this.rl$faceTextureVCoordinates = faceTextureVCoordinates; + } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java index b88684fc6b..ed17140360 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSTileMixin.java @@ -24,12 +24,10 @@ */ package net.runelite.mixins; -import net.runelite.api.Actor; import net.runelite.api.CollisionData; import net.runelite.api.CollisionDataFlag; import net.runelite.api.Constants; import net.runelite.api.DecorativeObject; -import net.runelite.api.GameObject; import net.runelite.api.GroundObject; import net.runelite.api.Item; import net.runelite.api.ItemLayer; @@ -59,13 +57,18 @@ import net.runelite.api.mixins.FieldHook; import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.Mixin; import net.runelite.api.mixins.Shadow; +import net.runelite.rs.api.RSActor; import net.runelite.rs.api.RSClient; +import net.runelite.rs.api.RSEntity; import net.runelite.rs.api.RSGameObject; +import net.runelite.rs.api.RSGraphicsObject; import net.runelite.rs.api.RSGroundItem; import net.runelite.rs.api.RSGroundItemPile; import net.runelite.rs.api.RSNode; import net.runelite.rs.api.RSNodeDeque; +import net.runelite.rs.api.RSProjectile; import net.runelite.rs.api.RSTile; +import org.slf4j.Logger; @Mixin(RSTile.class) public abstract class RSTileMixin implements RSTile @@ -74,7 +77,7 @@ public abstract class RSTileMixin implements RSTile private static RSClient client; @Inject - private static GameObject lastGameObject; + private static RSGameObject lastGameObject; @Inject private static RSNodeDeque[][][] lastGroundItems = new RSNodeDeque[Constants.MAX_Z][Constants.SCENE_SIZE][Constants.SCENE_SIZE]; @@ -89,7 +92,7 @@ public abstract class RSTileMixin implements RSTile private GroundObject previousGroundObject; @Inject - private GameObject[] previousGameObjects; + private RSGameObject[] previousGameObjects; @Inject @Override @@ -222,55 +225,96 @@ public abstract class RSTileMixin implements RSTile if (previousGameObjects == null) { - previousGameObjects = new GameObject[5]; + previousGameObjects = new RSGameObject[5]; } // Previous game object - GameObject previous = previousGameObjects[idx]; + RSGameObject previous = previousGameObjects[idx]; // GameObject that was changed. RSGameObject current = (RSGameObject) getGameObjects()[idx]; + // Update previous object to current + previousGameObjects[idx] = current; + // Last game object - GameObject last = lastGameObject; + RSGameObject last = lastGameObject; // Update last game object lastGameObject = current; - // Update previous object to current - previousGameObjects[idx] = current; - // Duplicate event, return - if (current != null && current.equals(last)) + if (current == previous) { return; } - // Characters seem to generate a constant stream of new GameObjects - if (current == null || !(current.getRenderable() instanceof Actor)) + if (current != null && current == last) { - if (current == null && previous != null) + // When >1 tile objects are added to the scene, the same GameObject is added to + // multiple tiles. We keep lastGameObject to prevent duplicate spawn events from + // firing for these objects. + return; + } + + // actors, projectiles, and graphics objects are added and removed from the scene each frame as GameObjects, + // so ignore them. + boolean currentInvalid = false, prevInvalid = false; + if (current != null) + { + RSEntity renderable = current.getRenderable(); + currentInvalid = renderable instanceof RSActor || renderable instanceof RSProjectile || renderable instanceof RSGraphicsObject; + } + + if (previous != null) + { + RSEntity renderable = previous.getRenderable(); + prevInvalid = renderable instanceof RSActor || renderable instanceof RSProjectile || renderable instanceof RSGraphicsObject; + } + + Logger logger = client.getLogger(); + if (current == null) + { + if (prevInvalid) { - GameObjectDespawned gameObjectDespawned = new GameObjectDespawned(); - gameObjectDespawned.setTile(this); - gameObjectDespawned.setGameObject(previous); - client.getCallbacks().post(gameObjectDespawned); + return; } - else if (current != null && previous == null) + + logger.trace("Game object despawn: {}", previous.getId()); + + GameObjectDespawned gameObjectDespawned = new GameObjectDespawned(); + gameObjectDespawned.setTile(this); + gameObjectDespawned.setGameObject(previous); + client.getCallbacks().post(gameObjectDespawned); + } + else if (previous == null) + { + if (currentInvalid) { - GameObjectSpawned gameObjectSpawned = new GameObjectSpawned(); - gameObjectSpawned.setTile(this); - gameObjectSpawned.setGameObject(current); - client.getCallbacks().post(gameObjectSpawned); + return; } - else if (current != null) + + logger.trace("Game object spawn: {}", current.getId()); + + GameObjectSpawned gameObjectSpawned = new GameObjectSpawned(); + gameObjectSpawned.setTile(this); + gameObjectSpawned.setGameObject(current); + client.getCallbacks().post(gameObjectSpawned); + } + else + { + if (currentInvalid && prevInvalid) { - GameObjectChanged gameObjectsChanged = new GameObjectChanged(); - gameObjectsChanged.setTile(this); - gameObjectsChanged.setPrevious(previous); - gameObjectsChanged.setGameObject(current); - client.getCallbacks().post(gameObjectsChanged); + return; } + + logger.trace("Game object change: {} -> {}", previous.getId(), current.getId()); + + GameObjectChanged gameObjectsChanged = new GameObjectChanged(); + gameObjectsChanged.setTile(this); + gameObjectsChanged.setPrevious(previous); + gameObjectsChanged.setGameObject(current); + client.getCallbacks().post(gameObjectsChanged); } } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSUserListMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSUserListMixin.java index 0760cd302f..1577ddf182 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSUserListMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSUserListMixin.java @@ -32,11 +32,6 @@ public abstract class RSUserListMixin implements RSUserList { } - @Inject - public void remove(Nameable nameable) - { - } - @Inject @MethodHook(value = "addLast", end = true) public void add(RSUsername name, RSUsername prevName) @@ -49,5 +44,11 @@ public abstract class RSUserListMixin implements RSUserList public void remove(RSUser nameable) { rl$remove(nameable); - } + } + + @Inject + public void remove(Nameable nameable) + { + rl$remove((RSUser) nameable); + } } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSModel.java b/runescape-api/src/main/java/net/runelite/rs/api/RSModel.java index 8e0d272430..c4e2786ca4 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSModel.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSModel.java @@ -118,9 +118,6 @@ public interface RSModel extends RSEntity, Model @Import("rotateY270Ccw") void rotateY270Ccw(); - @Import("isSingleTile") - boolean isSingleTile(); - @Import("radius") @Override int getRadius(); @@ -157,7 +154,7 @@ public interface RSModel extends RSEntity, Model @Override int getXYZMag(); - @Import("__du_bx") + @Import("isSingleTile") @Override boolean isClickable(); diff --git a/runescape-client/src/main/java/Client.java b/runescape-client/src/main/java/Client.java index 7cedb7c49e..4e37d7317f 100644 --- a/runescape-client/src/main/java/Client.java +++ b/runescape-client/src/main/java/Client.java @@ -3983,7 +3983,7 @@ public final class Client extends GameShell implements Usernamed { class48.method868(); } else { if(!isMenuOpen) { - class30.method569(); + class30.resetMenuEntries(); } int var1; diff --git a/runescape-client/src/main/java/class238.java b/runescape-client/src/main/java/class238.java index a556c08699..1c72b1dcbf 100644 --- a/runescape-client/src/main/java/class238.java +++ b/runescape-client/src/main/java/class238.java @@ -153,7 +153,7 @@ public final class class238 { } if(!Client.isMenuOpen) { - class30.method569(); + class30.resetMenuEntries(); } } } else if(var9.noScrollThrough && MouseHandler.MouseHandler_x >= var12 && MouseHandler.MouseHandler_y >= var13 && MouseHandler.MouseHandler_x < var14 && MouseHandler.MouseHandler_y < var15) { @@ -582,7 +582,7 @@ public final class class238 { } if(!Client.isMenuOpen) { - class30.method569(); + class30.resetMenuEntries(); } } diff --git a/runescape-client/src/main/java/class30.java b/runescape-client/src/main/java/class30.java index 5e56ee55cb..a6511f8f8c 100644 --- a/runescape-client/src/main/java/class30.java +++ b/runescape-client/src/main/java/class30.java @@ -65,7 +65,7 @@ public class class30 { signature = "(B)V", garbageValue = "49" ) - static void method569() { + static void resetMenuEntries() { Client.menuOptionsCount = 0; Client.isMenuOpen = false; Client.menuActions[0] = "Cancel"; From 3adafeb5785a8c97a62bbc21d999eae48cbad89a Mon Sep 17 00:00:00 2001 From: xperiaclash Date: Thu, 20 Jun 2019 22:19:41 +0200 Subject: [PATCH 092/117] remove burn after cox raid is done --- .../java/net/runelite/client/plugins/coxhelper/CoxPlugin.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java index edff35fddb..6a2b2efe7f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java @@ -382,6 +382,7 @@ public class CoxPlugin extends Plugin sleepcount = 0; Olm_Heal.clear(); npcContainer.clear(); + burnTarget.clear(); Olm_NPC = null; hand = null; prayAgainstOlm = null; From 1fa656ce2d04f67192cbd52786c8235b7d48a7fd Mon Sep 17 00:00:00 2001 From: Lucas Date: Thu, 20 Jun 2019 23:19:02 +0200 Subject: [PATCH 093/117] Stop nosuchmethoderrors being thrown by dumb vanilla to api stuff --- .../java/net/runelite/injector/InjectHookMethod.java | 2 +- .../main/java/net/runelite/mixins/RSUserListMixin.java | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/injector-plugin/src/main/java/net/runelite/injector/InjectHookMethod.java b/injector-plugin/src/main/java/net/runelite/injector/InjectHookMethod.java index 94303e81d3..be654e127d 100644 --- a/injector-plugin/src/main/java/net/runelite/injector/InjectHookMethod.java +++ b/injector-plugin/src/main/java/net/runelite/injector/InjectHookMethod.java @@ -192,7 +192,7 @@ public class InjectHookMethod new net.runelite.asm.pool.Method( new net.runelite.asm.pool.Class(vanillaMethod.getClassFile().getName()), hookMethod.getName(), - signature + hookMethod.getDescriptor() ) ); } diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSUserListMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSUserListMixin.java index 1577ddf182..1a76beec25 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSUserListMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSUserListMixin.java @@ -1,6 +1,5 @@ package net.runelite.mixins; -import net.runelite.api.Nameable; import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.MethodHook; import net.runelite.api.mixins.Mixin; @@ -13,6 +12,7 @@ public abstract class RSUserListMixin implements RSUserList { /** * Default implementation of rl$add + * * @param name * @param prevName */ @@ -24,6 +24,7 @@ public abstract class RSUserListMixin implements RSUserList /** * Default implementation of rl$del + * * @param nameable */ @Inject @@ -45,10 +46,4 @@ public abstract class RSUserListMixin implements RSUserList { rl$remove(nameable); } - - @Inject - public void remove(Nameable nameable) - { - rl$remove((RSUser) nameable); - } } From 2a4fbef7eeba0748f990d5f9b93c6bd722a7f5a9 Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 21 Jun 2019 02:03:34 +0200 Subject: [PATCH 094/117] Add gameobject id's to dev tools via dynamicobjects --- bootstrap.json | 12 ++++++------ .../java/net/runelite/api/DynamicObject.java | 6 ++++++ .../plugins/devtools/DevToolsOverlay.java | 10 ++++++++-- .../runelite/mixins/RSDynamicObjectMixin.java | 19 +++++++++++++++++++ .../net/runelite/rs/api/RSDynamicObject.java | 3 ++- .../src/main/java/DynamicObject.java | 6 +++--- 6 files changed, 44 insertions(+), 12 deletions(-) create mode 100644 runelite-api/src/main/java/net/runelite/api/DynamicObject.java diff --git a/bootstrap.json b/bootstrap.json index 9032e655d3..3ae81b11cc 100644 --- a/bootstrap.json +++ b/bootstrap.json @@ -20,10 +20,10 @@ "size": "3168921" }, { - "hash": "7d64dafaf007613fef59f47884ce62db5fdc21e148b351e52a3f6ce7cc28928e", + "hash": "877106b9b525477f8e9662704b00894d445dd7d476c51dad7a674f6a313e3f88", "name": "client-1.5.28-SNAPSHOT.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/client-1.5.28-SNAPSHOT.jar", - "size": "5845716" + "size": "5845767" }, { "hash": "18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79", @@ -218,16 +218,16 @@ "size": "1019717" }, { - "hash": "69eddc4155a66e07761c433dc83c0703afe7b1206063fc5e1ef77c787ce777ee", + "hash": "303ac8f202bc169f30f16f3c5a3810aaae773515af4d6a7562bc996ed0f32054", "name": "runescape-api-1.5.28-SNAPSHOT.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/runescape-api-1.5.28-SNAPSHOT.jar", - "size": "56056" + "size": "56043" }, { - "hash": "55426093ae731f5c25fe6d5eb28bfb8f645ea7e41faad9e12f53d40f683101be", + "hash": "830499b8b8d65403536d20206d210f12e7524777dde9a6948d4681333c9b962a", "name": "http-api-1.5.28-SNAPSHOT.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/http-api-1.5.28-SNAPSHOT.jar", - "size": "101785" + "size": "101786" }, { "hash": "f55abda036da75e1af45bd43b9dfa79b2a3d90905be9cb38687c6621597a8165", diff --git a/runelite-api/src/main/java/net/runelite/api/DynamicObject.java b/runelite-api/src/main/java/net/runelite/api/DynamicObject.java new file mode 100644 index 0000000000..a1914605e3 --- /dev/null +++ b/runelite-api/src/main/java/net/runelite/api/DynamicObject.java @@ -0,0 +1,6 @@ +package net.runelite.api; + +public interface DynamicObject extends Renderable +{ + int getAnimationID(); +} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java index 93f4210530..6a24c10976 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java @@ -42,6 +42,7 @@ import net.runelite.api.Actor; import net.runelite.api.Client; import net.runelite.api.Constants; import net.runelite.api.DecorativeObject; +import net.runelite.api.DynamicObject; import net.runelite.api.GameObject; import net.runelite.api.GraphicsObject; import net.runelite.api.GroundObject; @@ -54,6 +55,7 @@ import net.runelite.api.Perspective; import net.runelite.api.Player; import net.runelite.api.Point; import net.runelite.api.Projectile; +import net.runelite.api.Renderable; import net.runelite.api.Scene; import net.runelite.api.Tile; import net.runelite.api.WallObject; @@ -307,7 +309,11 @@ class DevToolsOverlay extends Overlay { if (player.getLocalLocation().distanceTo(gameObject.getLocalLocation()) <= MAX_DISTANCE) { - OverlayUtil.renderTileOverlay(graphics, gameObject, "ID: " + gameObject.getId(), GREEN); + Renderable renderable = gameObject.getRenderable(); + if (renderable instanceof DynamicObject) + { + OverlayUtil.renderTileOverlay(graphics, gameObject, "ID: " + gameObject.getId() + " Anim: " + ((DynamicObject) renderable).getAnimationID(), GREEN); + } } // Draw a polygon around the convex hull @@ -417,7 +423,7 @@ class DevToolsOverlay extends Overlay } int projectileId = projectile.getId(); - Actor projectileInteracting = null; + Actor projectileInteracting = projectile.getInteracting(); String infoString = ""; diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSDynamicObjectMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSDynamicObjectMixin.java index 18ad95fb67..5760e13157 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSDynamicObjectMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSDynamicObjectMixin.java @@ -27,11 +27,13 @@ package net.runelite.mixins; import net.runelite.api.mixins.Copy; import net.runelite.api.mixins.FieldHook; import net.runelite.api.mixins.Inject; +import net.runelite.api.mixins.MethodHook; import net.runelite.api.mixins.Mixin; import net.runelite.api.mixins.Replace; import net.runelite.api.mixins.Shadow; import net.runelite.rs.api.RSClient; import net.runelite.rs.api.RSDynamicObject; +import net.runelite.rs.api.RSEntity; import net.runelite.rs.api.RSModel; @Mixin(RSDynamicObject.class) @@ -40,6 +42,9 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject @Shadow("client") private static RSClient client; + @Inject + public int animationID; + @Copy("getModel") public abstract RSModel rs$getModel(); @@ -78,4 +83,18 @@ public abstract class RSDynamicObjectMixin implements RSDynamicObject setAnimFrame(Integer.MIN_VALUE | objectFrameCycle << 16 | getAnimFrame()); } } + + @MethodHook(value = "", end = true) + @Inject + public void rl$init(int id, int type, int orientation, int plane, int x, int y, int animationID, boolean var8, RSEntity var9) + { + this.animationID = animationID; + } + + @Inject + @Override + public int getAnimationID() + { + return animationID; + } } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSDynamicObject.java b/runescape-api/src/main/java/net/runelite/rs/api/RSDynamicObject.java index 44dd3cadf5..cdaa72277c 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSDynamicObject.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSDynamicObject.java @@ -1,9 +1,10 @@ package net.runelite.rs.api; +import net.runelite.api.DynamicObject; import net.runelite.api.Renderable; import net.runelite.mapping.Import; -public interface RSDynamicObject extends RSEntity, Renderable +public interface RSDynamicObject extends RSEntity, DynamicObject, Renderable { @Import("id") int getId(); diff --git a/runescape-client/src/main/java/DynamicObject.java b/runescape-client/src/main/java/DynamicObject.java index 891cc10b79..95d3a17dae 100644 --- a/runescape-client/src/main/java/DynamicObject.java +++ b/runescape-client/src/main/java/DynamicObject.java @@ -74,15 +74,15 @@ public class DynamicObject extends Entity { @ObfuscatedSignature( signature = "(IIIIIIIZLex;)V" ) - DynamicObject(int var1, int var2, int var3, int var4, int var5, int var6, int var7, boolean var8, Entity var9) { + DynamicObject(int var1, int var2, int var3, int var4, int var5, int var6, int animationID, boolean var8, Entity var9) { this.id = var1; this.type = var2; this.orientation = var3; this.plane = var4; this.x = var5; this.y = var6; - if(var7 != -1) { - this.sequenceDefinition = WorldMapAreaData.getSequenceDefinition(var7); + if(animationID != -1) { + this.sequenceDefinition = WorldMapAreaData.getSequenceDefinition(animationID); this.frame = 0; this.cycleStart = Client.cycle - 1; if(this.sequenceDefinition.__t == 0 && var9 != null && var9 instanceof DynamicObject) { From f5a40623f0ac76d88c0354b547eafd189dc5648d Mon Sep 17 00:00:00 2001 From: Ganom Date: Thu, 20 Jun 2019 20:39:40 -0400 Subject: [PATCH 095/117] Add back in regular GameObjects for Dev Tools (#677) --- .../runelite/client/plugins/devtools/DevToolsOverlay.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java index 6a24c10976..a770bf8b85 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/devtools/DevToolsOverlay.java @@ -80,6 +80,7 @@ class DevToolsOverlay extends Overlay private static final Font FONT = FontManager.getRunescapeFont().deriveFont(Font.BOLD, 16); private static final Color RED = new Color(221, 44, 0); private static final Color GREEN = new Color(0, 200, 83); + private static final Color TURQOISE = new Color(0, 200, 157); private static final Color ORANGE = new Color(255, 109, 0); private static final Color YELLOW = new Color(255, 214, 0); private static final Color CYAN = new Color(0, 184, 212); @@ -312,7 +313,11 @@ class DevToolsOverlay extends Overlay Renderable renderable = gameObject.getRenderable(); if (renderable instanceof DynamicObject) { - OverlayUtil.renderTileOverlay(graphics, gameObject, "ID: " + gameObject.getId() + " Anim: " + ((DynamicObject) renderable).getAnimationID(), GREEN); + OverlayUtil.renderTileOverlay(graphics, gameObject, "ID: " + gameObject.getId() + " Anim: " + ((DynamicObject) renderable).getAnimationID(), TURQOISE); + } + else + { + OverlayUtil.renderTileOverlay(graphics, gameObject, "ID: " + gameObject.getId(), GREEN); } } From 711e6c1a82db1971691d7a227907c8f3b73e7cc9 Mon Sep 17 00:00:00 2001 From: James <38226001+f0rmatme@users.noreply.github.com> Date: Thu, 20 Jun 2019 18:08:30 -0700 Subject: [PATCH 096/117] Bug fixes for inventory setup (#673) * Fix for inventory setup * Fix bug where toggling plugin would fail to load setups from config * Fix bug where toggling plugin would fail to load setups from config * Revert --- .../inventorysetups/InventorySetupPlugin.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupPlugin.java index afc8bc8e36..c6ccacac8f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupPlugin.java @@ -288,7 +288,6 @@ public class InventorySetupPlugin extends Plugin panel.addInventorySetup(key); } - highlightDifference = false; } @Subscribe @@ -333,17 +332,20 @@ public class InventorySetupPlugin extends Plugin // set the highlighting off if login screen shows up case LOGIN_SCREEN: highlightDifference = false; - final String setupName = panel.getSelectedInventorySetup(); - if (!setupName.isEmpty()) - { - panel.setCurrentInventorySetup(setupName); - } break; // set highlighting case LOGGED_IN: highlightDifference = config.getHighlightDifferences(); break; + + default: + return; + } + final String setupName = panel.getSelectedInventorySetup(); + if (!setupName.isEmpty()) + { + panel.setCurrentInventorySetup(setupName); } } From 8020f758e1de5d98e2f225e4fa83ee157af4c1c2 Mon Sep 17 00:00:00 2001 From: zeruth Date: Fri, 21 Jun 2019 03:32:48 -0400 Subject: [PATCH 097/117] bringup --- .../inventoryviewer/InventoryViewerOverlay.java | 1 + .../itemskeptondeath/ItemsKeptOnDeathPlugin.java | 14 +++++++------- .../lootingbagviewer/LootingBagViewerOverlay.java | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java index ba1901caf9..efe6df33a0 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventoryviewer/InventoryViewerOverlay.java @@ -41,6 +41,7 @@ import net.runelite.api.ItemDefinition; import net.runelite.api.ItemContainer; import net.runelite.api.VarClientInt; import net.runelite.client.game.ItemManager; +import static net.runelite.client.plugins.lootingbagviewer.LootingBagViewerOverlay.PLACEHOLDER_WIDTH; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayPosition; import net.runelite.client.ui.overlay.components.ComponentConstants; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java index dd9a5403e5..ee761ad9a9 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/itemskeptondeath/ItemsKeptOnDeathPlugin.java @@ -39,7 +39,7 @@ import net.runelite.api.Constants; import net.runelite.api.FontID; import net.runelite.api.InventoryID; import net.runelite.api.Item; -import net.runelite.api.ItemComposition; +import net.runelite.api.ItemDefinition; import net.runelite.api.ItemContainer; import net.runelite.api.ItemID; import net.runelite.api.ScriptID; @@ -245,7 +245,7 @@ public class ItemsKeptOnDeathPlugin extends Plugin continue; } - final ItemComposition c = itemManager.getItemComposition(i.getId()); + final ItemDefinition c = itemManager.getItemDefinition(i.getId()); // Bonds are always kept and do not count towards the limit. if (id == ItemID.OLD_SCHOOL_BOND || id == ItemID.OLD_SCHOOL_BOND_UNTRADEABLE) @@ -344,7 +344,7 @@ public class ItemsKeptOnDeathPlugin extends Plugin int exchangePrice = itemManager.getItemPrice(canonicalizedItemId); if (exchangePrice == 0) { - final ItemComposition c1 = itemManager.getItemComposition(canonicalizedItemId); + final ItemDefinition c1 = itemManager.getItemDefinition(canonicalizedItemId); exchangePrice = c1.getPrice(); } else @@ -453,7 +453,7 @@ public class ItemsKeptOnDeathPlugin extends Plugin if (price == 0) { // Default to alch price - price = (int) (itemManager.getItemComposition(cid).getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER); + price = (int) (itemManager.getItemDefinition(cid).getPrice() * Constants.HIGH_ALCHEMY_MULTIPLIER); } total += (long) price * w.getItemQuantity(); } @@ -472,9 +472,9 @@ public class ItemsKeptOnDeathPlugin extends Plugin * @param c The item * @return */ - private static boolean isTradeable(final ItemComposition c) + private static boolean isTradeable(final ItemDefinition c) { - // ItemComposition:: isTradeable checks if they are traded on the grand exchange, some items are trade-able but not via GE + // ItemDefinition:: isTradeable checks if they are traded on the grand exchange, some items are trade-able but not via GE if (c.getNote() != -1 || c.getLinkedNoteId() != -1 || c.isTradeable()) @@ -593,7 +593,7 @@ public class ItemsKeptOnDeathPlugin extends Plugin * @param c Items Composition * @return */ - private static Widget createItemWidget(final Widget parent, final int qty, final ItemComposition c) + private static Widget createItemWidget(final Widget parent, final int qty, final ItemDefinition c) { final Widget itemWidget = parent.createChild(-1, WidgetType.GRAPHIC); itemWidget.setItemId(c.getId()); diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerOverlay.java index 461e752386..ecfe3dc5da 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/lootingbagviewer/LootingBagViewerOverlay.java @@ -41,10 +41,10 @@ import net.runelite.client.ui.overlay.components.ComponentOrientation; import net.runelite.client.ui.overlay.components.ImageComponent; import net.runelite.client.ui.overlay.components.PanelComponent; -class LootingBagViewerOverlay extends Overlay +public class LootingBagViewerOverlay extends Overlay { private static final int INVENTORY_SIZE = 28; - private static final int PLACEHOLDER_WIDTH = 36; + public static final int PLACEHOLDER_WIDTH = 36; private static final int PLACEHOLDER_HEIGHT = 32; private static final ImageComponent PLACEHOLDER_IMAGE = new ImageComponent(new BufferedImage(PLACEHOLDER_WIDTH, PLACEHOLDER_HEIGHT, BufferedImage.TYPE_4BYTE_ABGR)); From 24228f86feb8e2840b2fc4505683ecc63ac7a340 Mon Sep 17 00:00:00 2001 From: Lucas Date: Fri, 21 Jun 2019 18:50:32 +0200 Subject: [PATCH 098/117] Fix healthbar stuff, remove double constant --- .../main/java/net/runelite/api/Client.java | 6 +- .../main/java/net/runelite/api/Constants.java | 13 ++-- .../net/runelite/client/game/ItemManager.java | 6 +- .../client/plugins/bank/BankCalculation.java | 1 - .../chatcommands/ChatCommandsPlugin.java | 1 - .../client/plugins/examine/ExaminePlugin.java | 1 - .../grounditems/GroundItemsPlugin.java | 1 - .../net/runelite/mixins/RSClientMixin.java | 4 -- .../mixins/RSHealthBarDefinitionMixin.java | 63 ------------------- .../net/runelite/mixins/RSHealthBarMixin.java | 50 --------------- .../java/net/runelite/rs/api/RSClient.java | 4 +- .../java/net/runelite/rs/api/RSHealthBar.java | 19 +----- .../rs/api/RSHealthBarDefinition.java | 4 ++ 13 files changed, 17 insertions(+), 156 deletions(-) delete mode 100644 runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarMixin.java diff --git a/runelite-api/src/main/java/net/runelite/api/Client.java b/runelite-api/src/main/java/net/runelite/api/Client.java index 22303a5d51..6d4e38235b 100644 --- a/runelite-api/src/main/java/net/runelite/api/Client.java +++ b/runelite-api/src/main/java/net/runelite/api/Client.java @@ -934,7 +934,7 @@ public interface Client extends GameShell * * @return all projectiles */ - java.util.List getProjectiles(); + List getProjectiles(); /** * Gets a list of all graphics objects currently drawn. @@ -1631,7 +1631,7 @@ public interface Client extends GameShell void draw2010Menu(); - NodeCache getHealthBarCache(); + void resetHealthBarCaches(); void setRenderSelf(boolean enabled); @@ -1655,6 +1655,4 @@ public interface Client extends GameShell String getSelectedSpellName(); boolean getIsSpellSelected(); - - void resetHealthBarCaches(); } diff --git a/runelite-api/src/main/java/net/runelite/api/Constants.java b/runelite-api/src/main/java/net/runelite/api/Constants.java index 0b078e6449..bdcb8f6374 100644 --- a/runelite-api/src/main/java/net/runelite/api/Constants.java +++ b/runelite-api/src/main/java/net/runelite/api/Constants.java @@ -99,9 +99,11 @@ public class Constants public static final int GAME_TICK_LENGTH = 600; /** - * Used when getting High Alchemy value - multiplied by general store price. + * High alchemy = shop price * HIGH_ALCHEMY_MULTIPLIER + * + * @see ItemDefinition#getPrice */ - public static final float HIGH_ALCHEMY_CONSTANT = 0.6f; + public static final float HIGH_ALCHEMY_MULTIPLIER = 0.6f; /** * Width of a standard item sprite @@ -112,11 +114,4 @@ public class Constants * Height of a standard item sprite */ public static final int ITEM_SPRITE_HEIGHT = 32; - - /** - * High alchemy = shop price * HIGH_ALCHEMY_MULTIPLIER - * - * @see ItemComposition#getPrice - */ - public static final float HIGH_ALCHEMY_MULTIPLIER = .6f; } diff --git a/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java b/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java index 73bf521739..02f5a8785d 100644 --- a/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java +++ b/runelite-client/src/main/java/net/runelite/client/game/ItemManager.java @@ -46,7 +46,7 @@ import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; import net.runelite.api.Constants; import static net.runelite.api.Constants.CLIENT_DEFAULT_ZOOM; -import static net.runelite.api.Constants.HIGH_ALCHEMY_CONSTANT; +import static net.runelite.api.Constants.HIGH_ALCHEMY_MULTIPLIER; import net.runelite.api.GameState; import net.runelite.api.ItemDefinition; import net.runelite.api.ItemID; @@ -424,7 +424,7 @@ public class ItemManager return 1000; } - return (int) Math.max(1, composition.getPrice() * HIGH_ALCHEMY_CONSTANT); + return (int) Math.max(1, composition.getPrice() * HIGH_ALCHEMY_MULTIPLIER); } public int getAlchValue(int itemID) @@ -438,7 +438,7 @@ public class ItemManager return 1000; } - return (int) Math.max(1, getItemDefinition(itemID).getPrice() * HIGH_ALCHEMY_CONSTANT); + return (int) Math.max(1, getItemDefinition(itemID).getPrice() * HIGH_ALCHEMY_MULTIPLIER); } /** diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankCalculation.java b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankCalculation.java index e8d1401503..13398e22f7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankCalculation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/bank/BankCalculation.java @@ -34,7 +34,6 @@ import javax.inject.Inject; import lombok.Getter; import lombok.extern.slf4j.Slf4j; import net.runelite.api.Client; -import net.runelite.api.Constants; import net.runelite.api.InventoryID; import net.runelite.api.Item; import net.runelite.api.ItemContainer; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java index 77af32ec73..269c116c76 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/chatcommands/ChatCommandsPlugin.java @@ -37,7 +37,6 @@ import lombok.Value; import lombok.extern.slf4j.Slf4j; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; -import net.runelite.api.Constants; import net.runelite.api.Experience; import net.runelite.api.IconID; import net.runelite.api.ItemDefinition; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java index bb6907b44b..1a795af452 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/examine/ExaminePlugin.java @@ -36,7 +36,6 @@ import javax.inject.Inject; import lombok.extern.slf4j.Slf4j; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; -import net.runelite.api.Constants; import net.runelite.api.ItemDefinition; import net.runelite.api.events.ChatMessage; import net.runelite.api.events.GameStateChanged; diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java index 4be768e28f..6093650b1b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/grounditems/GroundItemsPlugin.java @@ -49,7 +49,6 @@ import lombok.AccessLevel; import lombok.Getter; import lombok.Setter; import net.runelite.api.Client; -import net.runelite.api.Constants; import net.runelite.api.GameState; import net.runelite.api.Item; import net.runelite.api.ItemDefinition; diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java index a25f42d117..8e48c50cad 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSClientMixin.java @@ -32,7 +32,6 @@ import net.runelite.api.GameState; import net.runelite.api.GrandExchangeOffer; import net.runelite.api.GraphicsObject; import net.runelite.api.HashTable; -import net.runelite.api.HealthBarOverride; import net.runelite.api.HintArrowType; import net.runelite.api.Ignore; import net.runelite.api.IndexDataBase; @@ -190,9 +189,6 @@ public abstract class RSClientMixin implements RSClient .maximumSize(64) .build(); - @Inject - private static HealthBarOverride healthBarOverride; - @Inject private static boolean printMenuActions; diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java index 33337f3d79..f6f31abdf6 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarDefinitionMixin.java @@ -1,83 +1,20 @@ package net.runelite.mixins; -import net.runelite.api.HealthBarOverride; import net.runelite.api.events.PostHealthBar; -import net.runelite.api.mixins.Copy; import net.runelite.api.mixins.Inject; import net.runelite.api.mixins.MethodHook; import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Replace; import net.runelite.api.mixins.Shadow; import net.runelite.rs.api.RSBuffer; import net.runelite.rs.api.RSClient; import net.runelite.rs.api.RSHealthBarDefinition; -import net.runelite.rs.api.RSSprite; @Mixin(RSHealthBarDefinition.class) public abstract class RSHealthBarDefinitionMixin implements RSHealthBarDefinition { - // Larger values are used for bosses like Corporeal Beast - private static final int DEFAULT_HEALTH_SCALE = 30; - @Shadow("client") private static RSClient client; - @Shadow("healthBarOverride") - private static HealthBarOverride healthBarOverride; - - @Copy("getSprite2") - abstract RSSprite rs$getHealthBarBackSprite(); - - @Replace("getSprite2") - public RSSprite rl$getHealthBarBackSprite() - { - /* - * If this combat info already uses sprites for health bars, - * use those instead, and don't override. - */ - RSSprite pixels = rs$getHealthBarBackSprite(); - if (pixels != null) - { - return pixels; - } - - if (healthBarOverride == null) - { - return null; - } - - return getHealthScale() == DEFAULT_HEALTH_SCALE - ? (RSSprite) healthBarOverride.backSprite - : (RSSprite) healthBarOverride.backSpriteLarge; - } - - @Copy("getSprite1") - abstract RSSprite rs$getHealthBarFrontSprite(); - - @Replace("getSprite1") - public RSSprite rl$getHealthBarFrontSprite() - { - /* - * If this combat info already uses sprites for health bars, - * use those instead, and don't override. - */ - RSSprite pixels = rs$getHealthBarFrontSprite(); - if (pixels != null) - { - return pixels; - } - - if (healthBarOverride == null) - { - return null; - } - - // 30 is the default size, large is for bosses like Corporeal Beast - return getHealthScale() == DEFAULT_HEALTH_SCALE - ? (RSSprite) healthBarOverride.frontSprite - : (RSSprite) healthBarOverride.frontSpriteLarge; - } - @MethodHook(value = "read", end = true) @Inject public void onRead(RSBuffer buffer) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarMixin.java deleted file mode 100644 index 65a7e976a4..0000000000 --- a/runelite-mixins/src/main/java/net/runelite/mixins/RSHealthBarMixin.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2019, Lotto - * 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.mixins; - -import net.runelite.api.events.PostHealthBar; -import net.runelite.api.mixins.Inject; -import net.runelite.api.mixins.MethodHook; -import net.runelite.api.mixins.Mixin; -import net.runelite.api.mixins.Shadow; -import net.runelite.rs.api.RSBuffer; -import net.runelite.rs.api.RSClient; -import net.runelite.rs.api.RSHealthBar; - -@Mixin(RSHealthBar.class) -public abstract class RSHealthBarMixin implements RSHealthBar -{ - @Shadow("client") - private static RSClient client; - - @MethodHook(value = "get", end = true) - @Inject - public void onRead(RSBuffer buffer) - { - PostHealthBar postHealthBar = new PostHealthBar(); - postHealthBar.setHealthBar(this); - client.getCallbacks().post(postHealthBar); - } -} diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java index de72b2ef83..dc52ced619 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSClient.java @@ -986,9 +986,11 @@ public interface RSClient extends RSGameShell, Client void rasterizerDrawCircle(int x, int y, int r, int rgb); @Import("HealthBarDefinition_cached") - @Override RSEvictingDualNodeHashTable getHealthBarCache(); + @Import("HealthBarDefinition_cachedSprites") + RSEvictingDualNodeHashTable getHealthBarSpriteCache(); + @Import("renderSelf") @Override void setRenderSelf(boolean enabled); diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBar.java b/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBar.java index 99162fce1b..248ec7d624 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBar.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBar.java @@ -1,29 +1,12 @@ package net.runelite.rs.api; -import net.runelite.api.HealthBar; import net.runelite.mapping.Import; -public interface RSHealthBar extends RSNode, HealthBar +public interface RSHealthBar extends RSNode { @Import("updates") RSIterableNodeDeque getUpdates(); // "combatinfolist" but only thing it has is getNode so this works @Import("definition") RSHealthBarDefinition getDefinition(); - - @Import("healthBarFrontSpriteId") - @Override - int getHealthBarFrontSpriteId(); - - @Import("getHealthBarFrontSprite") - @Override - RSSprite getHealthBarFrontSprite(); - - @Import("getHealthBarBackSprite") - @Override - RSSprite getHealthBarBackSprite(); - - @Import("healthBarPadding") - @Override - void setPadding(int padding); } diff --git a/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBarDefinition.java b/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBarDefinition.java index 377a0934a1..110ce49826 100644 --- a/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBarDefinition.java +++ b/runescape-api/src/main/java/net/runelite/rs/api/RSHealthBarDefinition.java @@ -8,6 +8,10 @@ public interface RSHealthBarDefinition extends RSDualNode, HealthBar @Import("width") int getHealthScale(); + @Import("spriteId1") + @Override + int getHealthBarFrontSpriteId(); + @Import("getSprite1") RSSprite getHealthBarFrontSprite(); From 85d030e631375d7249a0b3a7342a8cab2ef72882 Mon Sep 17 00:00:00 2001 From: Lucwousin Date: Fri, 21 Jun 2019 20:38:36 +0200 Subject: [PATCH 099/117] Fix inventory setups (#683) --- .../plugins/inventorysetups/InventorySetupPlugin.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupPlugin.java index c6ccacac8f..fa35f2718e 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inventorysetups/InventorySetupPlugin.java @@ -32,6 +32,7 @@ import java.awt.image.BufferedImage; import java.lang.reflect.Type; import java.util.ArrayList; import java.util.HashMap; +import java.util.Map; import java.util.Objects; import javax.inject.Inject; import javax.swing.JOptionPane; @@ -102,7 +103,7 @@ public class InventorySetupPlugin extends Plugin private InventorySetupPluginPanel panel; - private HashMap inventorySetups; + private Map inventorySetups = new HashMap<>(); private NavigationButton navButton; @@ -270,7 +271,7 @@ public class InventorySetupPlugin extends Plugin final String json = configManager.getConfiguration(CONFIG_GROUP, CONFIG_KEY); if (json == null || json.isEmpty()) { - inventorySetups = new HashMap<>(); + inventorySetups.clear(); } else { @@ -280,7 +281,8 @@ public class InventorySetupPlugin extends Plugin { }.getType(); - inventorySetups = gson.fromJson(json, type); + inventorySetups.clear(); + inventorySetups.putAll(gson.fromJson(json, type)); } for (final String key : inventorySetups.keySet()) From 619d4907e60df5564ed4c286c78c403bed742e77 Mon Sep 17 00:00:00 2001 From: Ganom Date: Fri, 21 Jun 2019 17:54:35 -0400 Subject: [PATCH 100/117] Fix-up Vanguards in Cox Helper --- .../client/plugins/coxhelper/CoxInfoBox.java | 2 +- .../client/plugins/coxhelper/CoxPlugin.java | 39 +++++++++++-------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxInfoBox.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxInfoBox.java index 405d13cc96..5e9f8da222 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxInfoBox.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxInfoBox.java @@ -103,7 +103,7 @@ public class CoxInfoBox extends Overlay plugin.setPrayAgainstOlm(null); } - if (config.vangHealth() && plugin.isRunVanguard()) + if (config.vangHealth() && plugin.getVanguards() > 0) { panelComponent.getChildren().add(TitleComponent.builder() .text("Vanguards") diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java index 6a2b2efe7f..22413a86a5 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/coxhelper/CoxPlugin.java @@ -108,7 +108,7 @@ public class CoxPlugin extends Plugin @Getter(AccessLevel.PACKAGE) private boolean runOlm; @Getter(AccessLevel.PACKAGE) - private boolean runVanguard; + private int vanguards; @Getter(AccessLevel.PACKAGE) private boolean tektonActive; @Getter(AccessLevel.PACKAGE) @@ -165,13 +165,6 @@ public class CoxPlugin extends Plugin { overlayManager.add(coxOverlay); overlayManager.add(coxInfoBox); - } - - @Override - protected void shutDown() - { - overlayManager.remove(coxOverlay); - overlayManager.remove(coxInfoBox); HandCripple = false; hand = null; acidTarget = null; @@ -183,6 +176,14 @@ public class CoxPlugin extends Plugin burnTicks = 40; acidTicks = 25; teleportTicks = 10; + vanguards = 0; + } + + @Override + protected void shutDown() + { + overlayManager.remove(coxOverlay); + overlayManager.remove(coxInfoBox); } @Subscribe @@ -316,7 +317,7 @@ public class CoxPlugin extends Plugin case NpcID.VANGUARD_7527: case NpcID.VANGUARD_7528: case NpcID.VANGUARD_7529: - runVanguard = true; + vanguards++; npcContainer.put(npc, new NPCContainer(npc)); break; case NpcID.GREAT_OLM_LEFT_CLAW: @@ -362,7 +363,7 @@ public class CoxPlugin extends Plugin { npcContainer.remove(event.getNpc()); } - runVanguard = false; + vanguards--; break; case NpcID.GREAT_OLM_RIGHT_CLAW_7553: case NpcID.GREAT_OLM_RIGHT_CLAW: @@ -513,16 +514,22 @@ public class CoxPlugin extends Plugin } break; case NpcID.VANGUARD_7529: - npcs.setAttackStyle(NPCContainer.Attackstyle.MAGE); + if (npcs.getAttackStyle() == NPCContainer.Attackstyle.UNKNOWN) + { + npcs.setAttackStyle(NPCContainer.Attackstyle.MAGE); + } break; case NpcID.VANGUARD_7528: - npcs.setAttackStyle(NPCContainer.Attackstyle.RANGE); + if (npcs.getAttackStyle() == NPCContainer.Attackstyle.UNKNOWN) + { + npcs.setAttackStyle(NPCContainer.Attackstyle.RANGE); + } break; case NpcID.VANGUARD_7527: - npcs.setAttackStyle(NPCContainer.Attackstyle.MELEE); - break; - case NpcID.VANGUARD_7526: - npcs.setAttackStyle(NPCContainer.Attackstyle.UNKNOWN); + if (npcs.getAttackStyle() == NPCContainer.Attackstyle.UNKNOWN) + { + npcs.setAttackStyle(NPCContainer.Attackstyle.MELEE); + } break; } } From 2dc8e181d771a906aed487e8e6e155365391ceea Mon Sep 17 00:00:00 2001 From: Ganom Date: Fri, 21 Jun 2019 18:11:45 -0400 Subject: [PATCH 101/117] Fix 'Selected Npc' Entity-Hider --- .../src/main/java/net/runelite/mixins/EntityHiderMixin.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java index 851c1b5480..a2930b71c5 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java @@ -164,9 +164,9 @@ public abstract class EntityHiderMixin implements RSScene } } - for (String name: names) + for (String name : names) { - if (names.equals(npc.getName())) + if (npc.getName().startsWith(name)) { return false; } From d16ef229ebf8ff3fedcf6af719c08d0948a76c5c Mon Sep 17 00:00:00 2001 From: Ganom Date: Fri, 21 Jun 2019 19:19:06 -0400 Subject: [PATCH 102/117] Update Scouter to include background options, and fix record raid bug. --- .../client/plugins/raids/RaidsConfig.java | 12 ++++++ .../client/plugins/raids/RaidsOverlay.java | 38 ++++++++++++++----- 2 files changed, 41 insertions(+), 9 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java index c1c55c5111..dec84b0a5f 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsConfig.java @@ -59,6 +59,18 @@ public interface RaidsConfig extends Config return true; } + @ConfigItem( + position = 2, + parent = "scouterConfig", + keyName = "hideBackground", + name = "Hide Scouter Background", + description = "Removes the scouter background, and makes it transparent." + ) + default boolean hideBackground() + { + return true; + } + @ConfigItem( position = 2, parent = "scouterConfig", diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java index b65e380c1b..3c15b0b678 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/raids/RaidsOverlay.java @@ -52,6 +52,7 @@ import static net.runelite.client.ui.overlay.OverlayManager.OPTION_CONFIGURE; import net.runelite.client.ui.overlay.OverlayMenuEntry; 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.ComponentOrientation; import net.runelite.client.ui.overlay.components.ImageComponent; import net.runelite.client.ui.overlay.components.PanelComponent; @@ -154,6 +155,15 @@ public class RaidsOverlay extends Overlay scouterActive = false; panelComponent.getChildren().clear(); + if (config.hideBackground()) + { + panelComponent.setBackgroundColor(null); + } + else + { + panelComponent.setBackgroundColor(ComponentConstants.STANDARD_BACKGROUND_COLOR); + } + if (plugin.getRaid() == null || plugin.getRaid().getLayout() == null) { panelComponent.getChildren().add(TitleComponent.builder() @@ -279,14 +289,13 @@ public class RaidsOverlay extends Overlay scavsBeforeIceRooms.add(prev); } int lastScavs = scavRooms.get(scavRooms.size() - 1); - if (!recordRaid()) - { - panelComponent.getChildren().add(TitleComponent.builder() - .text(displayLayout) - .color(color) - .build()); - } - else + + panelComponent.getChildren().add(TitleComponent.builder() + .text(displayLayout) + .color(color) + .build()); + + if (recordRaid()) { panelComponent.getChildren().add(TitleComponent.builder() .text("Record Raid") @@ -294,6 +303,17 @@ public class RaidsOverlay extends Overlay .build()); panelComponent.setBackgroundColor(new Color(0, 255, 0, 10)); } + else + { + if (config.hideBackground()) + { + panelComponent.setBackgroundColor(null); + } + else + { + panelComponent.setBackgroundColor(ComponentConstants.STANDARD_BACKGROUND_COLOR); + } + } TableComponent tableComponent = new TableComponent(); tableComponent.setColumnAlignments(TableAlignment.LEFT, TableAlignment.RIGHT); @@ -304,7 +324,7 @@ public class RaidsOverlay extends Overlay String clanOwner = Text.removeTags(client.getWidget(WidgetInfo.CLAN_CHAT_OWNER).getText()); if (clanOwner.equals("None")) { - clanOwner = "Open CC tab..."; + clanOwner = "Open CC Tab"; color = Color.RED; } From f31739b7e21b0757de4fb43c30af190c48fb84b9 Mon Sep 17 00:00:00 2001 From: Daniel Date: Fri, 21 Jun 2019 20:40:11 -0400 Subject: [PATCH 103/117] Add snakeskin gear to skill calculator (#9172) --- .../skillcalculator/skill_crafting.json | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_crafting.json b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_crafting.json index 69a8d2d54f..0d098baf3a 100644 --- a/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_crafting.json +++ b/runelite-client/src/main/resources/net/runelite/client/plugins/skillcalculator/skill_crafting.json @@ -367,12 +367,30 @@ "name": "Topaz Amulet (U)", "xp": 80 }, + { + "level": 45, + "icon": 6328, + "name": "Snakeskin boots", + "xp": 30 + }, { "level": 46, "icon": 567, "name": "Unpowered Orb", "xp": 52.5 }, + { + "level": 47, + "icon": 6330, + "name": "Snakeskin vambraces", + "xp": 35 + }, + { + "level": 48, + "icon": 6326, + "name": "Snakeskin bandana", + "xp": 45 + }, { "level": 49, "icon": 4542, @@ -385,6 +403,18 @@ "name": "Ruby Amulet (U)", "xp": 85 }, + { + "level": 51, + "icon": 6324, + "name": "Snakeskin chaps", + "xp": 50 + }, + { + "level": 53, + "icon": 6322, + "name": "Snakeskin body", + "xp": 55 + }, { "level": 54, "icon": 1395, From 15d6be29196cab8ab340eb4b98bc5982b4ab6bf5 Mon Sep 17 00:00:00 2001 From: ScapeRune <29353990+Twiglet1022@users.noreply.github.com> Date: Sat, 22 Jun 2019 01:41:02 +0100 Subject: [PATCH 104/117] worldmap: Fix MEP2 and Shadows of the Storm quest tooltips (#9166) --- .../runelite/client/plugins/worldmap/QuestStartLocation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java index ccccc47e2d..43f2f73a8a 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/worldmap/QuestStartLocation.java @@ -122,7 +122,7 @@ enum QuestStartLocation MONKS_FRIEND(Quest.MONKS_FRIEND, new WorldPoint(2605, 3209, 0)), MOUNTAIN_DAUGHTER(Quest.MOUNTAIN_DAUGHTER, new WorldPoint(2810, 3672, 0)), MOURNINGS_ENDS_PART_I(Quest.MOURNINGS_ENDS_PART_I, new WorldPoint(2289, 3149, 0)), - MOURNINGS_ENDS_PART_II(Quest.MONKEY_MADNESS_II, new WorldPoint(2352, 3172, 0)), + MOURNINGS_ENDS_PART_II(Quest.MOURNINGS_ENDS_PART_II, new WorldPoint(2352, 3172, 0)), MURDER_MYSTERY(Quest.MURDER_MYSTERY, new WorldPoint(2740, 3562, 0)), MY_ARMS_BIG_ADVENTURE(Quest.MY_ARMS_BIG_ADVENTURE, new WorldPoint(2908, 10088, 0)), NATURE_SPIRIT(Quest.NATURE_SPIRIT, new WorldPoint(3440, 9894, 0)), @@ -139,7 +139,7 @@ enum QuestStartLocation SCORPION_CATCHER(Quest.SCORPION_CATCHER, new WorldPoint(2701, 3399, 0)), SEA_SLUG(Quest.SEA_SLUG, new WorldPoint(2715, 3302, 0)), SHADES_OF_MORTTON(Quest.SHADES_OF_MORTTON, new WorldPoint(3463, 3308, 0)), - SHADOW_OF_THE_STORM(Quest.SHADES_OF_MORTTON, new WorldPoint(3270, 3159, 0)), + SHADOW_OF_THE_STORM(Quest.SHADOW_OF_THE_STORM, new WorldPoint(3270, 3159, 0)), SHEEP_HERDER(Quest.SHEEP_HERDER, new WorldPoint(2616, 3299, 0)), SHILO_VILLAGE(Quest.SHILO_VILLAGE, new WorldPoint(2882, 2951, 0)), A_SOULS_BANE(Quest.A_SOULS_BANE, new WorldPoint(3307, 3454, 0)), From 3977f9ca619fd1b32c2cec403a52bbeeab6fd364 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 22 Jun 2019 02:46:39 +0200 Subject: [PATCH 105/117] Make injected-client maven dependency --- injected-client/pom.xml | 16 +- runelite-client/pom.xml | 18 +- .../net/runelite/client/rs/ClientLoader.java | 232 +++--------------- .../client/util/bootstrap/Artifact.java | 9 - .../client/util/bootstrap/Bootstrap.java | 56 ++--- 5 files changed, 66 insertions(+), 265 deletions(-) delete mode 100644 runelite-client/src/main/java/net/runelite/client/util/bootstrap/Artifact.java diff --git a/injected-client/pom.xml b/injected-client/pom.xml index 77cc2e42e8..474adda69b 100644 --- a/injected-client/pom.xml +++ b/injected-client/pom.xml @@ -37,23 +37,11 @@ - net.runelite - client + net.runelite.rs + rs-client ${project.version} true - - net.runelite.rs - runescape-api - ${project.version} - false - - - net.runelite - runelite-api - ${project.version} - false - net.runelite.rs vanilla diff --git a/runelite-client/pom.xml b/runelite-client/pom.xml index 5e690979e2..70c5c83000 100644 --- a/runelite-client/pom.xml +++ b/runelite-client/pom.xml @@ -209,11 +209,12 @@ net.runelite.rs runescape-api ${project.version} + runtime - net.runelit - client-patch - 1.5.26.2 + net.runelite + injected-client + ${project.version} runtime @@ -334,8 +335,8 @@ - - net.runelite:api + + net.runelite:* ** @@ -346,13 +347,6 @@ ** - - - net.runelit:client-patch - - ** - - net.runelite.pushingpixels:* diff --git a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java index c13c821178..058336e738 100644 --- a/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java +++ b/runelite-client/src/main/java/net/runelite/client/rs/ClientLoader.java @@ -26,55 +26,27 @@ */ package net.runelite.client.rs; -import net.runelite.api.Client; +import java.net.URLClassLoader; import java.applet.Applet; -import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; -import java.net.HttpURLConnection; import java.net.URL; -import java.net.URLConnection; -import java.nio.channels.Channels; -import java.nio.channels.ReadableByteChannel; -import java.security.cert.Certificate; -import java.security.cert.CertificateException; -import java.security.cert.CertificateFactory; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; -import java.util.jar.Attributes; -import java.util.jar.JarEntry; -import java.util.jar.JarInputStream; -import java.util.jar.Manifest; import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; import lombok.extern.slf4j.Slf4j; -import static net.runelite.client.RuneLite.RUNELITE_DIR; -import static net.runelite.client.rs.ClientUpdateCheckMode.AUTO; -import static net.runelite.client.rs.ClientUpdateCheckMode.CUSTOM; -import static net.runelite.client.rs.ClientUpdateCheckMode.VANILLA; -import net.runelite.http.api.RuneLiteAPI; -import okhttp3.Request; -import okhttp3.Response; @Slf4j @Singleton public class ClientLoader { - private static final File LOCAL_INJECTED_CLIENT = new File("./injected-client/target/injected-client-" + RuneLiteAPI.getVersion() + ".jar"); - private static final File INJECTED_CLIENT = new File(RUNELITE_DIR + "/injected-client.jar"); private final ClientConfigLoader clientConfigLoader; private ClientUpdateCheckMode updateCheckMode; public static boolean useLocalInjected = false; @Inject private ClientLoader( - @Named("updateCheckMode") final ClientUpdateCheckMode updateCheckMode, - final ClientConfigLoader clientConfigLoader) + @Named("updateCheckMode") final ClientUpdateCheckMode updateCheckMode, + final ClientConfigLoader clientConfigLoader) { this.updateCheckMode = updateCheckMode; this.clientConfigLoader = clientConfigLoader; @@ -84,126 +56,27 @@ public class ClientLoader { try { - Manifest manifest = new Manifest(); - manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); - RSConfig config = clientConfigLoader.fetch(); + final RSConfig config = clientConfigLoader.fetch(); - Map zipFile = new HashMap<>(); - - if (updateCheckMode == VANILLA) + switch (updateCheckMode) { - Certificate[] jagexCertificateChain = getJagexCertificateChain(); - String codebase = config.getCodeBase(); - String initialJar = config.getInitialJar(); - URL url = new URL(codebase + initialJar); - Request request = new Request.Builder() - .url(url) - .build(); - - try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute()) - { - JarInputStream jis; - - jis = new JarInputStream(response.body().byteStream()); - byte[] tmp = new byte[4096]; - ByteArrayOutputStream buffer = new ByteArrayOutputStream(756 * 1024); - for (; ; ) - { - JarEntry metadata = jis.getNextJarEntry(); - if (metadata == null) - { - break; - } - - buffer.reset(); - for (; ; ) - { - int n = jis.read(tmp); - if (n <= -1) - { - break; - } - buffer.write(tmp, 0, n); - } - - if (!Arrays.equals(metadata.getCertificates(), jagexCertificateChain)) - { - if (metadata.getName().startsWith("META-INF/")) - { - // META-INF/JAGEXLTD.SF and META-INF/JAGEXLTD.RSA are not signed, but we don't need - // anything in META-INF anyway. - continue; - } - else - { - throw new VerificationException("Unable to verify jar entry: " + metadata.getName()); - } - } - - zipFile.put(metadata.getName(), buffer.toByteArray()); - } - } + case AUTO: + case CUSTOM: + return loadRLPlus(config); + default: + case VANILLA: + return loadVanilla(config); + case NONE: + return null; } - else if (updateCheckMode == CUSTOM || useLocalInjected) - { - log.info("Loading injected client from {}", LOCAL_INJECTED_CLIENT.getAbsolutePath()); - loadJar(zipFile, LOCAL_INJECTED_CLIENT); - } - else if (updateCheckMode == AUTO) - { - URL url = new URL("https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/injected-client.jar"); - ReadableByteChannel readableByteChannel = Channels.newChannel(url.openStream()); - INJECTED_CLIENT.mkdirs(); - - if (!INJECTED_CLIENT.exists() || getFileSize(INJECTED_CLIENT.toURI().toURL()) != getFileSize(url)) - { - log.info("{} injected client", INJECTED_CLIENT.exists() ? "Updating" : "Initializing"); - INJECTED_CLIENT.delete(); - INJECTED_CLIENT.createNewFile(); - updateInjectedClient(readableByteChannel); - } - - log.info("Loading injected client from {}", INJECTED_CLIENT.getAbsolutePath()); - loadJar(zipFile, INJECTED_CLIENT); - } - - String initialClass = config.getInitialClass(); - - ClassLoader rsClassLoader = new ClassLoader(ClientLoader.class.getClassLoader()) - { - @Override - protected Class findClass(String name) throws ClassNotFoundException - { - String path = name.replace('.', '/').concat(".class"); - byte[] data = zipFile.get(path); - if (data == null) - { - throw new ClassNotFoundException(name); - } - - return defineClass(name, data, 0, data.length); - } - }; - - Class clientClass = rsClassLoader.loadClass(initialClass); - - Applet rs = (Applet) clientClass.newInstance(); - rs.setStub(new RSAppletStub(config)); - - if (rs instanceof Client) - { - log.info("client-patch 420 blaze it RL pricks"); - } - - return rs; } - catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException | SecurityException | VerificationException | CertificateException e) + catch (IOException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { if (e instanceof ClassNotFoundException) { log.error("Unable to load client - class not found. This means you" - + " are not running RuneLite with Maven as the client patch" - + " is not in your classpath."); + + " are not running RuneLite with Maven as the injected client" + + " is not in your classpath."); } log.error("Error loading RS!", e); @@ -211,66 +84,31 @@ public class ClientLoader } } - private static int getFileSize(URL url) throws IOException + private static Applet loadRLPlus(final RSConfig config) throws ClassNotFoundException, InstantiationException, IllegalAccessException { - URLConnection conn = null; - try - { - conn = url.openConnection(); - if (conn instanceof HttpURLConnection) - { - ((HttpURLConnection) conn).setRequestMethod("HEAD"); - } - conn.getInputStream(); - return conn.getContentLength(); - } - finally - { - if (conn instanceof HttpURLConnection) - { - ((HttpURLConnection) conn).disconnect(); - } - } + // the injected client is a runtime scoped dependency + final Class clientClass = ClientLoader.class.getClassLoader().loadClass(config.getInitialClass()); + return loadFromClass(config, clientClass); } - private void updateInjectedClient(ReadableByteChannel readableByteChannel) throws IOException + private static Applet loadVanilla(final RSConfig config) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException { - FileOutputStream fileOutputStream = new FileOutputStream(INJECTED_CLIENT); - fileOutputStream.getChannel() - .transferFrom(readableByteChannel, 0, Integer.MAX_VALUE); + final String codebase = config.getCodeBase(); + final String initialJar = config.getInitialJar(); + final String initialClass = config.getInitialClass(); + final URL url = new URL(codebase + initialJar); + + // Must set parent classloader to null, or it will pull from + // this class's classloader first + final URLClassLoader classloader = new URLClassLoader(new URL[]{url}, null); + final Class clientClass = classloader.loadClass(initialClass); + return loadFromClass(config, clientClass); } - private static Certificate[] getJagexCertificateChain() throws CertificateException + private static Applet loadFromClass(final RSConfig config, final Class clientClass) throws IllegalAccessException, InstantiationException { - CertificateFactory certificateFactory = CertificateFactory.getInstance("X.509"); - Collection certificates = certificateFactory.generateCertificates(ClientLoader.class.getResourceAsStream("jagex.crt")); - return certificates.toArray(new Certificate[0]); - } - - private static void loadJar(Map toMap, File fromFile) throws IOException - { - JarInputStream fis = new JarInputStream(new FileInputStream(fromFile)); - byte[] tmp = new byte[4096]; - ByteArrayOutputStream buffer = new ByteArrayOutputStream(756 * 1024); - for (; ; ) - { - JarEntry metadata = fis.getNextJarEntry(); - if (metadata == null) - { - break; - } - - buffer.reset(); - for (; ; ) - { - int n = fis.read(tmp); - if (n <= -1) - { - break; - } - buffer.write(tmp, 0, n); - } - toMap.put(metadata.getName(), buffer.toByteArray()); - } + final Applet rs = (Applet) clientClass.newInstance(); + rs.setStub(new RSAppletStub(config)); + return rs; } } diff --git a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Artifact.java b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Artifact.java deleted file mode 100644 index 466dfbcf11..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Artifact.java +++ /dev/null @@ -1,9 +0,0 @@ -package net.runelite.client.util.bootstrap; - -public class Artifact -{ - String hash; - String name; - String path; - String size; -} diff --git a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java index 6892d31f75..e86f2c8a02 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java +++ b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java @@ -14,9 +14,16 @@ import net.runelite.http.api.RuneLiteAPI; public class Bootstrap { + class Artifact + { + String hash; + String name; + String path; + String size; + } String buildCommit = "c554ab2400dc04a619b36695da2107648c9c87b3"; - Artifact[] artifacts = getArtifacts(); + private Artifact[] artifacts = getArtifacts(); Client client = new Client(); String[] clientJvm9Arguments = new String[]{ "-XX:+DisableAttachMechanism", @@ -46,54 +53,32 @@ public class Bootstrap "-XX:+UseParNewGC", "-Djna.nosys=true"}; - public Bootstrap() + Bootstrap() { } public static String getChecksumObject(Serializable object) throws IOException, NoSuchAlgorithmException { - ByteArrayOutputStream baos = null; - ObjectOutputStream oos = null; - try + try (ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos)) { - baos = new ByteArrayOutputStream(); - oos = new ObjectOutputStream(baos); oos.writeObject(object); MessageDigest md = MessageDigest.getInstance("MD5"); byte[] thedigest = md.digest(baos.toByteArray()); return DatatypeConverter.printHexBinary(thedigest); } - finally - { - oos.close(); - baos.close(); - } } - private static String getChecksumFile(String filepath) throws IOException + private static String getChecksumFile(String filepath) throws IOException, NoSuchAlgorithmException { System.out.println("Generating Hash for " + filepath); - MessageDigest md = null; - try - { - md = MessageDigest.getInstance("SHA-256"); - } - catch (Exception e) - { - e.printStackTrace(); - } + MessageDigest md = MessageDigest.getInstance("SHA-256"); + try (DigestInputStream dis = new DigestInputStream(new FileInputStream(filepath), md)) { - while (dis.read() != -1) - { - //empty loop to clear the data - } + //empty loop to clear the data + while (dis.read() != -1); md = dis.getMessageDigest(); } - catch (Exception e) - { - e.printStackTrace(); - } return bytesToHex(md.digest()); @@ -111,11 +96,11 @@ public class Bootstrap } - public Artifact[] getArtifacts() + private Artifact[] getArtifacts() { try { - artifacts = new Artifact[42]; + artifacts = new Artifact[43]; //Static artifacts artifacts[0] = new Artifact(); @@ -330,8 +315,13 @@ public class Bootstrap artifacts[37].hash = getChecksumFile("./http-api/target/" + artifacts[37].name); artifacts[37].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/" + artifacts[37].name; artifacts[37].size = Long.toString(getFileSize("./http-api/target/" + artifacts[37].name)); + artifacts[42] = new Artifact(); + artifacts[42].name = "injected-client-" + RuneLiteAPI.getVersion() + ".jar"; + artifacts[42].hash = getChecksumFile("./injected-client/target/" + artifacts[42].name); + artifacts[42].path = "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/" + artifacts[42].name; + artifacts[42].size = Long.toString(getFileSize("./injected-client/target/" + artifacts[42].name)); } - catch (IOException e) + catch (IOException | NoSuchAlgorithmException e) { e.printStackTrace(); } From 0550600132fccce2554b6418c1a27eece59fc179 Mon Sep 17 00:00:00 2001 From: Ganom Date: Fri, 21 Jun 2019 21:20:04 -0400 Subject: [PATCH 106/117] Fix #689 NPE from entity hider mixin. --- .../java/net/runelite/mixins/EntityHiderMixin.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java b/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java index a2930b71c5..8f84b9d917 100644 --- a/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java +++ b/runelite-mixins/src/main/java/net/runelite/mixins/EntityHiderMixin.java @@ -166,9 +166,15 @@ public abstract class EntityHiderMixin implements RSScene for (String name : names) { - if (npc.getName().startsWith(name)) + if (name != null && !name.equals("")) { - return false; + if (npc.getName() != null) + { + if (npc.getName().startsWith(name)) + { + return false; + } + } } } From 83567adef7cfcf6badeb5129208e107cda4f42a8 Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Sat, 22 Jun 2019 04:20:15 +0100 Subject: [PATCH 107/117] information wave overlay fix for fightcaves overhaul of inferno plugin to allow customization of wave info box + reworked mappings of caves. --- .../client/plugins/fightcave/WaveOverlay.java | 8 +- .../client/plugins/inferno/InfernoConfig.java | 72 ++- .../client/plugins/inferno/InfernoPlugin.java | 507 +++++++++--------- .../plugins/inferno/InfernoWaveMappings.java | 146 +++++ .../plugins/inferno/InfernoWaveMonster.java | 50 -- .../plugins/inferno/InfernoWaveOverlay.java | 179 +++---- 6 files changed, 521 insertions(+), 441 deletions(-) create mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveMappings.java delete mode 100644 runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveMonster.java diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveOverlay.java index 6421dfbcbc..2b5fdf370b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/fightcave/WaveOverlay.java @@ -38,6 +38,7 @@ 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; +import net.runelite.client.ui.overlay.components.table.TableAlignment; class WaveOverlay extends Overlay { @@ -97,14 +98,19 @@ class WaveOverlay extends Overlay .color(HEADER_COLOR) .build()); + TableComponent tableComponent = new TableComponent(); + tableComponent.setColumnAlignments(TableAlignment.CENTER); for (String line : buildWaveLines(waveContents)) { tableComponent.addRow(line); } - panelComponent.getChildren().add(tableComponent); + if (!tableComponent.isEmpty()) + { + panelComponent.getChildren().add(tableComponent); + } } private static Collection buildWaveLines(final Map wave) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java index 1d25deef3e..22f0a3f63b 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java @@ -28,39 +28,63 @@ import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; +import java.awt.*; + @ConfigGroup("inferno") public interface InfernoConfig extends Config -{ + { @ConfigItem( - position = 0, - keyName = "Nibbler Overlay", - name = "Nibbler Overlay", - description = "Shows if there are any Nibblers left" + position = 0, + keyName = "Nibbler Overlay", + name = "Nibbler Overlay", + description = "Shows if there are any Nibblers left" ) default boolean displayNibblerOverlay() - { - return false; - } + { + return false; + } @ConfigItem( - position = 1, - keyName = "Prayer Helper", - name = "Prayer Helper", - description = "Tells you what to flick in how many ticks" + position = 1, + keyName = "Prayer Helper", + name = "Prayer Helper", + description = "Tells you what to flick in how many ticks" ) default boolean showPrayerHelp() - { - return false; - } - + { + return false; + } + @ConfigItem( - position = 2, - keyName = "Wave Display", - name = "Wave display", - description = "Shows monsters that will spawn on the selected wave(s)." + 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; - } -} + { + return InfernoWaveDisplayMode.BOTH; + } + + @ConfigItem( + position = 3, + keyName = "getWaveOverlayHeaderColor", + name = "Wave Header", + description = "Color for Wave Header" + ) + default Color getWaveOverlayHeaderColor() + { + return Color.ORANGE; + } + + @ConfigItem( + position = 4, + keyName = "getWaveTextColor", + name = "Wave Text Color", + description = "Color for Wave Texts" + ) + default Color getWaveTextColor() + { + return Color.WHITE; + } + } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoPlugin.java index fd48d077b7..0bc1b4f746 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoPlugin.java @@ -25,17 +25,16 @@ package net.runelite.client.plugins.inferno; import com.google.inject.Provides; + import java.util.ArrayList; -import java.util.EnumMap; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; import javax.annotation.Nullable; import javax.inject.Inject; import lombok.AccessLevel; import lombok.Getter; +import net.runelite.api.Actor; import net.runelite.api.ChatMessageType; import net.runelite.api.Client; import net.runelite.api.GameState; @@ -57,18 +56,13 @@ import net.runelite.client.ui.overlay.OverlayManager; import org.apache.commons.lang3.ArrayUtils; @PluginDescriptor( - name = "Inferno", - description = "Inferno helper", - tags = {"combat", "overlay", "pve", "pvm"}, - type = PluginType.PVM + name = "Inferno", + description = "Inferno helper", + tags = {"combat", "overlay", "pve", "pvm"}, + type = PluginType.PVM ) 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 private Client client; @@ -78,7 +72,7 @@ public class InfernoPlugin extends Plugin @Inject private InfernoOverlay infernoOverlay; - + @Inject private InfernoWaveOverlay waveOverlay; @@ -93,10 +87,7 @@ public class InfernoPlugin extends Plugin @Inject private InfernoConfig config; - - @Getter - static final List> WAVES = new ArrayList<>(); - + @Getter private int currentWave = -1; @@ -118,310 +109,330 @@ public class InfernoPlugin extends Plugin private InfernoJadAttack attack; private NPC jad; + private static final int INFERNO_REGION = 9043; + private int currentWaveNumber; + private int nextWaveNumber; + private Map monster; + private Map waves; + private List waveMonsters; - - static - { - final InfernoWaveMonster[] waveMonsters = InfernoWaveMonster.values(); - - // Add wave 1, future waves are derived from its contents - final EnumMap waveOne = new EnumMap<>(InfernoWaveMonster.class); - waveOne.put(waveMonsters[0], 1); - WAVES.add(waveOne); - - for (int wave = 1; wave < MAX_WAVE; wave++) + public InfernoPlugin() { - final EnumMap 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); + waveMonsters = new ArrayList(); } - } @Provides InfernoConfig provideConfig(ConfigManager configManager) - { - return configManager.getConfig(InfernoConfig.class); - } + { + return configManager.getConfig(InfernoConfig.class); + } @Override protected void startUp() throws Exception - { - overlayManager.add(infernoOverlay); - overlayManager.add(infernoInfobox); - overlayManager.add(nibblerOverlay); - overlayManager.add(waveOverlay); - overlayManager.add(jadOverlay); - monsters = new HashMap<>(); - monsterCurrentAttackMap = new HashMap<>(6); - for (int i = 1; i <= 6; i++) { - monsterCurrentAttackMap.put(i, new ArrayList<>()); + overlayManager.add(infernoOverlay); + overlayManager.add(infernoInfobox); + overlayManager.add(nibblerOverlay); + overlayManager.add(waveOverlay); + overlayManager.add(jadOverlay); + monster = InfernoWaveMappings.npcNameMapping(); + waves = InfernoWaveMappings.waveMapping(); + monsters = new HashMap<>(); + monsterCurrentAttackMap = new HashMap<>(6); + for (int i = 1; i <= 6; i++) + { + monsterCurrentAttackMap.put(i, new ArrayList<>()); + } + nibblers = new ArrayList<>(); + priorityNPC = new InfernoNPC[4]; } - nibblers = new ArrayList<>(); - priorityNPC = new InfernoNPC[4]; - } @Override protected void shutDown() throws Exception - { - overlayManager.remove(infernoInfobox); - overlayManager.remove(infernoOverlay); - overlayManager.remove(nibblerOverlay); - overlayManager.remove(waveOverlay); - overlayManager.remove(jadOverlay); - jad = null; - attack = null; - } + { + overlayManager.remove(infernoInfobox); + overlayManager.remove(infernoOverlay); + overlayManager.remove(nibblerOverlay); + overlayManager.remove(waveOverlay); + overlayManager.remove(jadOverlay); + jad = null; + attack = null; + monster = null; + waves = null; + currentWaveNumber = -1; + nextWaveNumber = -1; + } @Subscribe public void onNpcSpawned(NpcSpawned event) - { - if (client.getMapRegions()[0] != 9043) return; - - NPC npc = event.getNpc(); - if (isValidInfernoMob(npc)) { - monsters.put(npc, new InfernoNPC(npc)); - System.out.println(monsters.size()); - } - if (npc.getId() == NpcID.JALNIB) - { - nibblers.add(npc); - } + if (client.getMapRegions()[0] != 9043) return; - final int id = event.getNpc().getId(); + NPC npc = event.getNpc(); + if (isValidInfernoMob(npc)) + { + monsters.put(npc, new InfernoNPC(npc)); + System.out.println(monsters.size()); + } + if (npc.getId() == NpcID.JALNIB) + { + nibblers.add(npc); + } - if (id == NpcID.JALTOKJAD || id == NpcID.JALTOKJAD_7704) - { - jad = event.getNpc(); + final int id = event.getNpc().getId(); + + if (id == NpcID.JALTOKJAD || id == NpcID.JALTOKJAD_7704) + { + jad = event.getNpc(); + } + final Actor actor = event.getActor(); + if (actor != null) + { + waveMonsters.add(actor); + } } - } @Subscribe public void onNpcDespawned(NpcDespawned event) - { - if (client.getMapRegions()[0] != 9043) return; - - NPC npc = event.getNpc(); - if (monsters.containsKey(npc)) { - monsters.remove(npc); - System.out.println(monsters.size()); + if (client.getMapRegions()[0] != 9043) return; + + NPC npc = event.getNpc(); + if (monsters.containsKey(npc)) + { + monsters.remove(npc); + System.out.println(monsters.size()); + } + + if (npc.getId() == NpcID.JALNIB) + { + nibblers.remove(npc); + } + + if (jad == event.getNpc()) + { + jad = null; + attack = null; + } + final Actor actor = event.getActor(); + if (actor != null) + { + waveMonsters.remove(actor); + } } - if (npc.getId() == NpcID.JALNIB) - { - 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 (event.getGameState() != GameState.LOGGED_IN) + { + return; + } + + if (!inInferno()) + { + currentWave = -1; + } } - 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)); - } + if (event.getType() != ChatMessageType.GAMEMESSAGE || !inInferno()) + { + return; + } + String message = event.getMessage(); + if (event.getMessage().contains("Wave:")) + { + message = message.substring(message.indexOf(": ") + 2); + currentWaveNumber = Integer.parseInt(message.substring(0, message.indexOf("<"))); + nextWaveNumber = ((currentWaveNumber < 63) ? (currentWaveNumber + 1) : -1); + } + + } @Subscribe public void onGameTick(GameTick event) - { - if (client.getMapRegions()[0] != 9043) return; - - clearMapAndPriority(); - - for (InfernoNPC monster : monsters.values()) { - calculateDistanceToPlayer(monster); + if (client.getMapRegions()[0] != 9043) return; - NPC npc = monster.getNpc(); + clearMapAndPriority(); - // if they are not attacking but are still attacking - if (monster.isAttacking()) - { - monster.setTicksTillAttack(monster.getTicksTillAttack() - 1); - - // sets the blobs attack style - if (monster.getName().equals("blob") && monster.getTicksTillAttack() == 3 && monster.getDistanceToPlayer() <= 15) + for (InfernoNPC monster : monsters.values()) { - if (client.getLocalPlayer().getOverheadIcon() == null) - { - monster.setAttackstyle(InfernoNPC.Attackstyle.RANDOM); - } - else if (client.getLocalPlayer().getOverheadIcon().equals(HeadIcon.MAGIC)) - { - monster.setAttackstyle(InfernoNPC.Attackstyle.RANGE); - } - else if (client.getLocalPlayer().getOverheadIcon().equals(HeadIcon.RANGED)) - { - monster.setAttackstyle(InfernoNPC.Attackstyle.MAGE); - } - } + calculateDistanceToPlayer(monster); - // we know the monster is not attacking because it should have attacked and is idling - if (monster.getTicksTillAttack() == 0) - { - if (npc.getAnimation() == -1) + NPC npc = monster.getNpc(); + + // if they are not attacking but are still attacking + if (monster.isAttacking()) { - monster.setAttacking(false); + monster.setTicksTillAttack(monster.getTicksTillAttack() - 1); + + // sets the blobs attack style + if (monster.getName().equals("blob") && monster.getTicksTillAttack() == 3 && monster.getDistanceToPlayer() <= 15) + { + if (client.getLocalPlayer().getOverheadIcon() == null) + { + monster.setAttackstyle(InfernoNPC.Attackstyle.RANDOM); + } + else if (client.getLocalPlayer().getOverheadIcon().equals(HeadIcon.MAGIC)) + { + monster.setAttackstyle(InfernoNPC.Attackstyle.RANGE); + } + else if (client.getLocalPlayer().getOverheadIcon().equals(HeadIcon.RANGED)) + { + monster.setAttackstyle(InfernoNPC.Attackstyle.MAGE); + } + } + + // we know the monster is not attacking because it should have attacked and is idling + if (monster.getTicksTillAttack() == 0) + { + if (npc.getAnimation() == -1) + { + monster.setAttacking(false); + } + else + { + // want to reset the monsters attack back to attacking + monster.attacked(); + } + } } - else + else { - // want to reset the monsters attack back to attacking + // they've just attacked + if (npc.getAnimation() == monster.getAttackAnimation() || npc.getAnimation() == 7581) // special case for blob + { monster.attacked(); + } + } + + if (monster.getTicksTillAttack() >= 1) + { + monsterCurrentAttackMap.get(monster.getTicksTillAttack()).add(monster); } } - } - else - { - // they've just attacked - if (npc.getAnimation() == monster.getAttackAnimation() || npc.getAnimation() == 7581) // special case for blob - { - monster.attacked(); - } - } - if (monster.getTicksTillAttack() >= 1) - { - monsterCurrentAttackMap.get(monster.getTicksTillAttack()).add(monster); - } + calculatePriorityNPC(); } - calculatePriorityNPC(); - } - @Subscribe public void onAnimationChanged(final AnimationChanged event) - { - if (event.getActor() != jad) { - return; - } + if (event.getActor() != jad) + { + return; + } - if (jad.getAnimation() == InfernoJadAttack.MAGIC.getAnimation()) - { - attack = InfernoJadAttack.MAGIC; + if (jad.getAnimation() == InfernoJadAttack.MAGIC.getAnimation()) + { + attack = InfernoJadAttack.MAGIC; + } + else if (jad.getAnimation() == InfernoJadAttack.RANGE.getAnimation()) + { + attack = InfernoJadAttack.RANGE; + } } - else if (jad.getAnimation() == InfernoJadAttack.RANGE.getAnimation()) - { - attack = InfernoJadAttack.RANGE; - } - } private void calculatePriorityNPC() - { - for (int i = 0; i < priorityNPC.length; i++) { - ArrayList monsters = monsterCurrentAttackMap.get(i + 1); - - if ( monsters.size() == 0) continue; - - int priority = monsters.get(0).getPriority(); - - InfernoNPC infernoNPC = monsters.get(0); - - for (InfernoNPC npc : monsters) - { - if (npc.getPriority() < priority) + for (int i = 0; i < priorityNPC.length; i++) { - priority = npc.getPriority(); - infernoNPC = npc; + ArrayList monsters = monsterCurrentAttackMap.get(i + 1); + + if (monsters.size() == 0) continue; + + int priority = monsters.get(0).getPriority(); + + InfernoNPC infernoNPC = monsters.get(0); + + for (InfernoNPC npc : monsters) + { + if (npc.getPriority() < priority) + { + priority = npc.getPriority(); + infernoNPC = npc; + } + } + priorityNPC[i] = infernoNPC; + System.out.println("i: " + i + " " + infernoNPC.getName()); } - } - priorityNPC[i] = infernoNPC; - System.out.println("i: " + i + " " + infernoNPC.getName()); } - } // TODO: blob calculator private void calculateDistanceToPlayer(InfernoNPC monster) - { - monster.setDistanceToPlayer(client.getLocalPlayer().getWorldLocation().distanceTo(monster.getNpc().getWorldArea())); - } + { + monster.setDistanceToPlayer(client.getLocalPlayer().getWorldLocation().distanceTo(monster.getNpc().getWorldArea())); + } private void clearMapAndPriority() - { - for (List l : monsterCurrentAttackMap.values()) { - l.clear(); - } + for (List l : monsterCurrentAttackMap.values()) + { + l.clear(); + } - for (int i = 0; i < priorityNPC.length; i++) - { - priorityNPC[i] = null; + for (int i = 0; i < priorityNPC.length; i++) + { + priorityNPC[i] = null; + } } - } public boolean isValidInfernoMob(NPC npc) - { - // we only want the bat, blob, melee, ranger and mager - if (npc.getId() == NpcID.JALMEJRAH || - npc.getId() == NpcID.JALAK || - npc.getId() == NpcID.JALIMKOT || - npc.getId() == NpcID.JALXIL || - npc.getId() == NpcID.JALZEK) return true; + { + // we only want the bat, blob, melee, ranger and mager + if (npc.getId() == NpcID.JALMEJRAH || + npc.getId() == NpcID.JALAK || + npc.getId() == NpcID.JALIMKOT || + npc.getId() == NpcID.JALXIL || + npc.getId() == NpcID.JALZEK) return true; + + return false; + } - return false; - } - boolean inInferno() - { - return ArrayUtils.contains(client.getMapRegions(), INFERNO_REGION); - } + { + return ArrayUtils.contains(client.getMapRegions(), INFERNO_REGION); + } - static String formatMonsterQuantity(final InfernoWaveMonster monster, final int quantity) - { - return String.format("%dx %s", quantity, monster); - } - -} \ No newline at end of file + public boolean isNotFinalWave() + { + return currentWaveNumber <= 68; + } + + @Nullable + InfernoJadAttack getAttack() + { + return attack; + } + + int getCurrentWaveNumber() + { + return currentWaveNumber; + } + + int getNextWaveNumber() + { + return nextWaveNumber; + } + + Map getMonster() + { + return monster; + } + + Map getWaves() + { + return waves; + } + + List getWaveMonsters() + { + return waveMonsters; + } + + } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveMappings.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveMappings.java new file mode 100644 index 0000000000..068ed55d1f --- /dev/null +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveMappings.java @@ -0,0 +1,146 @@ +/* + * Copyright (c) 2019, Kyleeld + * Copyright (c) 2019, RuneLitePlus + * + * 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.util.HashMap; +import java.util.Map; + +public class InfernoWaveMappings + { + static Map waveMapping() + { + return new HashMap() + { + { + put(1, new int[]{32, 32, 32, 85}); + put(2, new int[]{32, 32, 32, 85, 85}); + put(3, new int[]{32, 32, 32, 32, 32, 32}); + put(4, new int[]{32, 32, 32, 165}); + put(5, new int[]{32, 32, 32, 85, 165}); + put(6, new int[]{32, 32, 32, 85, 85, 165}); + put(7, new int[]{32, 32, 32, 165, 165}); + put(8, new int[]{32, 32, 32, 32, 32, 32}); + put(9, new int[]{32, 32, 32, 240}); + put(10, new int[]{32, 32, 32, 85, 240}); + put(11, new int[]{32, 32, 32, 85, 85, 240}); + put(12, new int[]{32, 32, 32, 165, 240}); + put(13, new int[]{32, 32, 32, 85, 165, 240}); + put(14, new int[]{32, 32, 32, 85, 85, 165, 240}); + put(15, new int[]{32, 32, 32, 165, 165, 240}); + put(16, new int[]{32, 32, 32, 240, 240}); + put(17, new int[]{32, 32, 32, 32, 32, 32}); + put(18, new int[]{32, 32, 32, 370}); + put(19, new int[]{32, 32, 32, 85, 370}); + put(20, new int[]{32, 32, 32, 85, 85, 370}); + put(21, new int[]{32, 32, 32, 165, 370}); + put(22, new int[]{32, 32, 32, 85, 165, 370}); + put(23, new int[]{32, 32, 32, 85, 85, 165, 370}); + put(24, new int[]{32, 32, 32, 165, 165, 370}); + put(25, new int[]{32, 32, 32, 240, 370}); + put(26, new int[]{32, 32, 32, 85, 240, 370}); + put(27, new int[]{32, 32, 32, 85, 85, 240, 370}); + put(28, new int[]{32, 32, 32, 165, 240, 370}); + put(29, new int[]{32, 32, 32, 85, 165, 240, 370}); + put(30, new int[]{32, 32, 32, 85, 85, 165, 240, 370}); + put(31, new int[]{32, 32, 32, 165, 165, 240, 370}); + put(32, new int[]{32, 32, 32, 240, 240, 370}); + put(33, new int[]{32, 32, 32, 370, 370}); + put(34, new int[]{32, 32, 32, 32, 32, 32}); + put(35, new int[]{32, 32, 32, 490}); + put(36, new int[]{32, 32, 32, 85, 490}); + put(37, new int[]{32, 32, 32, 85, 85, 490}); + put(38, new int[]{32, 32, 32, 165, 490}); + put(39, new int[]{32, 32, 32, 85, 165, 490}); + put(40, new int[]{32, 32, 32, 85, 85, 165, 490}); + put(41, new int[]{32, 32, 32, 165, 165, 490}); + put(42, new int[]{32, 32, 32, 240, 490}); + put(43, new int[]{32, 32, 32, 85, 240, 490}); + put(44, new int[]{32, 32, 32, 85, 85, 240, 490}); + put(45, new int[]{32, 32, 32, 165, 240, 490 }); + put(46, new int[]{32, 32, 32, 85, 165, 240, 490}); + put(47, new int[]{32, 32, 32, 85, 85, 165, 240, 490}); + put(48, new int[]{32, 32, 32, 165, 165, 240, 490}); + put(49, new int[]{32, 32, 32, 240, 240, 490}); + put(50, new int[]{32, 32, 32, 370, 490}); + put(51, new int[]{32, 32, 32, 85, 370, 490}); + put(52, new int[]{32, 32, 32, 85, 85, 370, 490}); + put(53, new int[]{32, 32, 32, 165, 370, 490}); + put(54, new int[]{32, 32, 32, 85, 165, 370, 490}); + put(55, new int[]{32, 32, 32, 85, 85, 165, 370, 490}); + put(56, new int[]{32, 32, 32, 165, 165, 370, 490}); + put(57, new int[]{32, 32, 32, 240, 370, 490}); + put(58, new int[]{32, 32, 32, 85, 240, 370, 490}); + put(59, new int[]{32, 32, 32, 85, 85, 240, 370, 490}); + put(60, new int[]{32, 32, 32, 165, 240, 370, 490}); + put(61, new int[]{32, 32, 32, 85, 165, 240, 370, 490}); + put(62, new int[]{32, 32, 32, 85, 85, 165, 240, 370, 490}); + put(63, new int[]{32, 32, 32, 165, 165, 240, 370, 490}); + put(64, new int[]{32, 32, 32, 85, 240, 240, 370, 490}); + put(65, new int[]{32, 32, 32, 85, 370, 370, 490}); + put(66, new int[]{32, 32, 32, 85, 490, 490}); + put(67, new int[]{900}); + put(68, new int[]{900, 900, 900}); + put(69, new int[]{1400}); + + } + }; + } + + static Map npcNameMapping() + { + return new HashMap() + { + { + put(32, "Jal-Nib - Level 32"); + put(85, " Jal-MejRah - Level 85"); + put(165, "Jal-Ak - Level 165"); + put(240, "Jal-ImKot - Level 240"); + put(370, "Jal-Xil - Level 370"); + put(490, "Jal-Zek - Level 490"); + put(900, "JalTok-Jad - Level 900"); + put(1400, "TzKal-Zuk - Level 1400"); + } + }; + } + + static HashMap intArrayToHashmap(int inputArray[]) + { + HashMap elementCountMap = new HashMap(); + for (int i : inputArray) + { + if (elementCountMap.containsKey(i)) + { + elementCountMap.put(i, elementCountMap.get(i) + 1); + } + else + { + elementCountMap.put(i, 1); + } + } + return elementCountMap; + } + } \ No newline at end of file diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveMonster.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveMonster.java deleted file mode 100644 index 3c93005f37..0000000000 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveMonster.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2018, Jordan Atwood - * 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); - } -} diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java index 32fb60d2f4..e8957a2026 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java @@ -1,127 +1,70 @@ -/* - * Copyright (c) 2018, Jordan Atwood - * 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.Iterator; +import java.util.HashMap; 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 com.google.inject.Inject; import net.runelite.client.ui.overlay.components.TitleComponent; -import net.runelite.client.ui.overlay.components.table.TableComponent; +import java.awt.Graphics2D; +import net.runelite.client.ui.overlay.OverlayPriority; +import net.runelite.client.ui.overlay.OverlayPosition; +import java.awt.Dimension; +import net.runelite.client.ui.overlay.components.PanelComponent; +import net.runelite.api.Client; +import net.runelite.client.ui.overlay.Overlay; -class InfernoWaveOverlay extends Overlay -{ - private static final Color HEADER_COLOR = ColorScheme.BRAND_ORANGE; - - private final InfernoConfig config; +public class InfernoWaveOverlay extends Overlay + { + private final Client client; private final InfernoPlugin plugin; - - private final PanelComponent panelComponent = new PanelComponent(); + private final InfernoConfig config; + private PanelComponent panelComponent; @Inject - private InfernoWaveOverlay(InfernoConfig config, InfernoPlugin plugin) - { - setPosition(OverlayPosition.TOP_RIGHT); - this.config = config; - this.plugin = plugin; + InfernoWaveOverlay(final Client client, final InfernoPlugin plugin, final InfernoConfig config) + { + (this.panelComponent = new PanelComponent()).setPreferredSize(new Dimension(150, 0)); + this.setPosition(OverlayPosition.TOP_RIGHT); + this.setPriority(OverlayPriority.HIGH); + this.client = client; + this.plugin = plugin; + this.config = config; + } + + public Dimension render(final Graphics2D graphics) + { + if (!plugin.inInferno() || plugin.getCurrentWaveNumber() == -1) + { + return null; + } + panelComponent.getChildren().clear(); + if (config.waveDisplay() == InfernoWaveDisplayMode.CURRENT + || config.waveDisplay() == InfernoWaveDisplayMode.BOTH) + { + renderWave("Wave " + plugin.getCurrentWaveNumber(), plugin.getCurrentWaveNumber()); + } + if ((config.waveDisplay() == InfernoWaveDisplayMode.NEXT + || config.waveDisplay() == InfernoWaveDisplayMode.BOTH) + && plugin.isNotFinalWave()) + { + renderWave("Next Wave:", plugin.getNextWaveNumber()); + } + return panelComponent.render(graphics); + } + + private void renderWave(final String header, final int waveNumber) + { + panelComponent.getChildren().add(TitleComponent.builder().text(header).color(config.getWaveOverlayHeaderColor()).build()); + final HashMap waveMap = (HashMap) InfernoWaveMappings.intArrayToHashmap(plugin.getWaves().get(waveNumber)); + for (final Map.Entry entry : waveMap.entrySet()) + { + final int monsterID = entry.getKey(); + final int quantity = entry.getValue(); + if (quantity <= 0) + { + continue; + } + panelComponent.getChildren().add(TitleComponent.builder().text(quantity + "x " + plugin.getMonster().get(monsterID)).color(config.getWaveTextColor()).build()); + } + } } - - @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 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 waveContents = InfernoPlugin.getWAVES().get(waveIndex + 1); - - addWaveInfo("Next wave", waveContents); - } - - return panelComponent.render(graphics); - } - - private void addWaveInfo(final String headerText, final Map 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 buildWaveLines(final Map wave) - { - final List> monsters = new ArrayList<>(wave.entrySet()); - monsters.sort(Map.Entry.comparingByKey()); - final List outputLines = new ArrayList<>(); - - for (Map.Entry monsterEntry : monsters) - { - final InfernoWaveMonster monster = monsterEntry.getKey(); - final int quantity = monsterEntry.getValue(); - final String line = InfernoPlugin.formatMonsterQuantity(monster, quantity); - - outputLines.add(line); - } - - return outputLines; - } -} From 76928a1455d28abc50ae54fee393a423b2e9a928 Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Sat, 22 Jun 2019 04:22:39 +0100 Subject: [PATCH 108/117] Update InfernoConfig.java changing from wildcard import to named import --- .../net/runelite/client/plugins/inferno/InfernoConfig.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java index 22f0a3f63b..3227eb1c36 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java @@ -27,8 +27,7 @@ package net.runelite.client.plugins.inferno; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; - -import java.awt.*; +import java.awt.color; @ConfigGroup("inferno") public interface InfernoConfig extends Config From b33852f28a3df29dffa353574ab9d9f65e878f9f Mon Sep 17 00:00:00 2001 From: pklite <46624825+pklite@users.noreply.github.com> Date: Fri, 21 Jun 2019 23:24:00 -0400 Subject: [PATCH 109/117] Makes the player count overlay only show up in PvP areas (#691) * Makes the player counter overlay only show up in wilderness, pvp worlds, or clan wars Signed-off-by: PKLite * Include deadman mode worlds Signed-off-by: PKLite --- .../main/java/net/runelite/api/WorldType.java | 10 ++++++ .../plugins/pvptools/PlayerCountOverlay.java | 36 +++++++++++++------ 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/runelite-api/src/main/java/net/runelite/api/WorldType.java b/runelite-api/src/main/java/net/runelite/api/WorldType.java index 06ec983a12..17455503bc 100644 --- a/runelite-api/src/main/java/net/runelite/api/WorldType.java +++ b/runelite-api/src/main/java/net/runelite/api/WorldType.java @@ -113,4 +113,14 @@ public enum WorldType { return worldTypes.stream().anyMatch(PVP_WORLD_TYPES::contains); } + + /** + * Checks to see if a collection of WorlTypes is a Deadman Mode World + * @param worldTypes The List of world types for a world + * @return true if it is deadman, false otherwise + */ + public static boolean isDeadmanWorld(final Collection worldTypes) + { + return worldTypes.stream().anyMatch(EnumSet.of(DEADMAN, DEADMAN_TOURNAMENT, SEASONAL_DEADMAN)::contains); + } } diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PlayerCountOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PlayerCountOverlay.java index 1cb2079421..1952838914 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PlayerCountOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/pvptools/PlayerCountOverlay.java @@ -16,6 +16,9 @@ import java.awt.Dimension; import java.awt.Graphics2D; import java.util.Arrays; import javax.inject.Inject; +import net.runelite.api.Client; +import net.runelite.api.Varbits; +import net.runelite.api.WorldType; import net.runelite.client.ui.overlay.Overlay; import net.runelite.client.ui.overlay.OverlayLayer; import net.runelite.client.ui.overlay.OverlayPosition; @@ -23,18 +26,23 @@ import net.runelite.client.ui.overlay.OverlayPriority; import net.runelite.client.ui.overlay.components.table.TableComponent; import net.runelite.client.ui.overlay.components.table.TableElement; import net.runelite.client.ui.overlay.components.table.TableRow; +import org.apache.commons.lang3.ArrayUtils; public class PlayerCountOverlay extends Overlay { + private static int[] CLAN_WARS_REGIONS = {9520, 13135, 13134, 13133, 13131, 13130, 13387, 13386}; private final PvpToolsPlugin pvpToolsPlugin; private final PvpToolsConfig config; + private final Client client; + @Inject - public PlayerCountOverlay(PvpToolsPlugin pvpToolsPlugin, PvpToolsConfig pvpToolsConfig) + public PlayerCountOverlay(PvpToolsPlugin pvpToolsPlugin, PvpToolsConfig pvpToolsConfig, Client client) { this.pvpToolsPlugin = pvpToolsPlugin; this.config = pvpToolsConfig; + this.client = client; setLayer(OverlayLayer.ABOVE_WIDGETS); setPriority(OverlayPriority.HIGHEST); setPosition(OverlayPosition.TOP_LEFT); @@ -46,17 +54,23 @@ public class PlayerCountOverlay extends Overlay { if (config.countPlayers()) { - TableComponent tableComponent = new TableComponent(); - TableElement[] firstRowElements = { + if ((client.getVar(Varbits.IN_WILDERNESS) == 1) || WorldType.isPvpWorld(client.getWorldType()) + || ArrayUtils.contains(CLAN_WARS_REGIONS, client.getMapRegions()[0]) || + WorldType.isDeadmanWorld(client.getWorldType())) + { + // Make this stop showing up when its not relevant + TableComponent tableComponent = new TableComponent(); + TableElement[] firstRowElements = { TableElement.builder().content("Friendly").color(Color.GREEN).build(), - TableElement.builder().content(String.valueOf(pvpToolsPlugin.getFriendlyPlayerCount())).build()}; - TableRow firstRow = TableRow.builder().elements(Arrays.asList(firstRowElements)).build(); - TableElement[] secondRowElements = { - TableElement.builder().content("Enemy").color(Color.RED).build(), - TableElement.builder().content(String.valueOf(pvpToolsPlugin.getEnemyPlayerCount())).build()}; - TableRow secondRow = TableRow.builder().elements(Arrays.asList(secondRowElements)).build(); - tableComponent.addRows(firstRow, secondRow); - return tableComponent.render(graphics); + TableElement.builder().content(String.valueOf(pvpToolsPlugin.getFriendlyPlayerCount())).build()}; + TableRow firstRow = TableRow.builder().elements(Arrays.asList(firstRowElements)).build(); + TableElement[] secondRowElements = { + TableElement.builder().content("Enemy").color(Color.RED).build(), + TableElement.builder().content(String.valueOf(pvpToolsPlugin.getEnemyPlayerCount())).build()}; + TableRow secondRow = TableRow.builder().elements(Arrays.asList(secondRowElements)).build(); + tableComponent.addRows(firstRow, secondRow); + return tableComponent.render(graphics); + } } return null; } From bf72c1775b70313dcafed92d3525cf4eb70cd08c Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Sat, 22 Jun 2019 04:31:10 +0100 Subject: [PATCH 110/117] Update InfernoConfig.java sigh c != C --- .../java/net/runelite/client/plugins/inferno/InfernoConfig.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java index 3227eb1c36..6330d38ca7 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoConfig.java @@ -27,7 +27,7 @@ package net.runelite.client.plugins.inferno; import net.runelite.client.config.Config; import net.runelite.client.config.ConfigGroup; import net.runelite.client.config.ConfigItem; -import java.awt.color; +import java.awt.Color; @ConfigGroup("inferno") public interface InfernoConfig extends Config From e689fc0b7a94fda968f59694823a47f1956ad789 Mon Sep 17 00:00:00 2001 From: Ganom Date: Fri, 21 Jun 2019 23:32:42 -0400 Subject: [PATCH 111/117] Add Seperate handler for Toxic Lists (#694) This was causing an issue where toxic players were being labeled as scammers. --- .../client/plugins/banlist/BanListPlugin.java | 148 ++++++++++-------- 1 file changed, 86 insertions(+), 62 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/banlist/BanListPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/banlist/BanListPlugin.java index 8363960a15..92371331cc 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/banlist/BanListPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/banlist/BanListPlugin.java @@ -27,12 +27,10 @@ package net.runelite.client.plugins.banlist; import com.google.inject.Provides; - import java.io.IOException; import java.util.ArrayList; import java.util.Arrays; import javax.inject.Inject; - import lombok.extern.slf4j.Slf4j; import net.runelite.api.ChatMessageType; import net.runelite.api.ClanMember; @@ -62,12 +60,12 @@ import okhttp3.Request; import okhttp3.Response; @PluginDescriptor( - name = "Ban List", - description = "Displays warning in chat when you join a" + - "clan chat/new member join your clan chat and he is in a WDR/RuneWatch/Manual List", - tags = {"PVM", "WDR", "RuneWatch"}, - type = PluginType.UTILITY, - enabledByDefault = false + name = "Ban List", + description = "Displays warning in chat when you join a" + + "clan chat/new member join your clan chat and he is in a WDR/RuneWatch/Manual List", + tags = {"PVM", "WDR", "RuneWatch"}, + type = PluginType.UTILITY, + enabledByDefault = false ) @Slf4j @@ -137,10 +135,10 @@ public class BanListPlugin extends Plugin public void onWidgetHiddenChanged(WidgetHiddenChanged widgetHiddenChanged) { if (client.getGameState() != GameState.LOGGED_IN - || client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null - || client.getViewportWidget() == null - || client.getWidget(WidgetInfo.CLAN_CHAT) == null - || !config.highlightInClan()) + || client.getWidget(WidgetInfo.LOGIN_CLICK_TO_PLAY_SCREEN) != null + || client.getViewportWidget() == null + || client.getWidget(WidgetInfo.CLAN_CHAT) == null + || !config.highlightInClan()) { return; } @@ -159,10 +157,21 @@ public class BanListPlugin extends Plugin public void onClanMemberJoined(ClanMemberJoined event) { ClanMember member = event.getMember(); - ListType listType = checkBanList(Text.standardize(member.getUsername())); - if (listType != null) + ListType scamList = checkScamList(Text.standardize(member.getUsername())); + ListType toxicList = checkToxicList(Text.standardize(member.getUsername())); + + if (scamList != null) { - sendWarning(Text.standardize(member.getUsername()), listType); + sendWarning(Text.standardize(member.getUsername()), scamList); + if (config.highlightInClan()) + { + highlightRedInCC(); + } + } + + if (toxicList != null) + { + sendWarning(Text.standardize(member.getUsername()), toxicList); if (config.highlightInClan()) { highlightRedInCC(); @@ -184,10 +193,14 @@ public class BanListPlugin extends Plugin { Widget tradingWith = client.getWidget(335, 31); String name = tradingWith.getText().replaceAll("Trading With: ", ""); - if (checkBanList(name) != null) + if (checkScamList(name) != null) { tradingWith.setText(tradingWith.getText().replaceAll(name, "" + name + " (Scammer)" + "")); } + if (checkToxicList(name) != null) + { + tradingWith.setText(tradingWith.getText().replaceAll(name, "" + name + " (Toxic)" + "")); + } }); } } @@ -196,7 +209,7 @@ public class BanListPlugin extends Plugin /** * Compares player name to everything in the ban lists */ - private ListType checkBanList(String nameToBeChecked) + private ListType checkScamList(String nameToBeChecked) { if (wdrScamArrayList.size() > 0 && config.enableWDR()) { @@ -206,14 +219,6 @@ public class BanListPlugin extends Plugin } } - if (wdrToxicArrayList.size() > 0 && config.enableWDR()) - { - if (wdrToxicArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase)) - { - return ListType.WEDORAIDSTOXIC_LIST; - } - } - if (runeWatchArrayList.size() > 0 && config.enableRuneWatch()) { if (runeWatchArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase)) @@ -233,6 +238,20 @@ public class BanListPlugin extends Plugin return null; } + private ListType checkToxicList(String nameToBeChecked) + { + + if (wdrToxicArrayList.size() > 0 && config.enableWDR()) + { + if (wdrToxicArrayList.stream().anyMatch(nameToBeChecked::equalsIgnoreCase)) + { + return ListType.WEDORAIDSTOXIC_LIST; + } + } + + return null; + } + /** * Sends a warning to our player, notifying them that a player is on a ban list */ @@ -242,53 +261,53 @@ public class BanListPlugin extends Plugin { case WEDORAIDSSCAM_LIST: final String wdr__scam_message = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("Warning! " + playerName + " is on WeDoRaids\' scammer list!") - .build(); + .append(ChatColorType.HIGHLIGHT) + .append("Warning! " + playerName + " is on WeDoRaids\' scammer list!") + .build(); chatMessageManager.queue( - QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(wdr__scam_message) - .build()); + QueuedMessage.builder() + .type(ChatMessageType.CONSOLE) + .runeLiteFormattedMessage(wdr__scam_message) + .build()); break; case WEDORAIDSTOXIC_LIST: final String wdr__toxic_message = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("Warning! " + playerName + " is on WeDoRaids\' toxic list!") - .build(); + .append(ChatColorType.HIGHLIGHT) + .append("Warning! " + playerName + " is on WeDoRaids\' toxic list!") + .build(); chatMessageManager.queue( - QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(wdr__toxic_message) - .build()); + QueuedMessage.builder() + .type(ChatMessageType.CONSOLE) + .runeLiteFormattedMessage(wdr__toxic_message) + .build()); break; case RUNEWATCH_LIST: final String rw_message = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("Warning! " + playerName + " is on the Runewatch\'s scammer list!") - .build(); + .append(ChatColorType.HIGHLIGHT) + .append("Warning! " + playerName + " is on the Runewatch\'s scammer list!") + .build(); chatMessageManager.queue( - QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(rw_message) - .build()); + QueuedMessage.builder() + .type(ChatMessageType.CONSOLE) + .runeLiteFormattedMessage(rw_message) + .build()); break; case MANUAL_LIST: final String manual_message = new ChatMessageBuilder() - .append(ChatColorType.HIGHLIGHT) - .append("Warning! " + playerName + " is on your manual scammer list!") - .build(); + .append(ChatColorType.HIGHLIGHT) + .append("Warning! " + playerName + " is on your manual scammer list!") + .build(); chatMessageManager.queue( - QueuedMessage.builder() - .type(ChatMessageType.CONSOLE) - .runeLiteFormattedMessage(manual_message) - .build()); + QueuedMessage.builder() + .type(ChatMessageType.CONSOLE) + .runeLiteFormattedMessage(manual_message) + .build()); break; } } @@ -299,8 +318,8 @@ public class BanListPlugin extends Plugin private void fetchFromWebsites() { Request request = new Request.Builder() - .url("https://wdrdev.github.io/index") - .build(); + .url("https://wdrdev.github.io/index") + .build(); RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback() { @Override @@ -327,8 +346,8 @@ public class BanListPlugin extends Plugin Request secondRequest = new Request.Builder() - .url("https://runewatch.com/incident-index-page/") - .build(); + .url("https://runewatch.com/incident-index-page/") + .build(); RuneLiteAPI.CLIENT.newCall(secondRequest).enqueue(new Callback() { @Override @@ -356,8 +375,8 @@ public class BanListPlugin extends Plugin }); Request thirdRequest = new Request.Builder() - .url("https://wdrdev.github.io/toxic") - .build(); + .url("https://wdrdev.github.io/toxic") + .build(); RuneLiteAPI.CLIENT.newCall(thirdRequest).enqueue(new Callback() { @Override @@ -393,13 +412,18 @@ public class BanListPlugin extends Plugin Widget widget = client.getWidget(WidgetInfo.CLAN_CHAT_LIST); for (Widget widgetChild : widget.getDynamicChildren()) { - ListType listType = checkBanList(widgetChild.getText()); + ListType scamList = checkScamList(widgetChild.getText()); + ListType toxicList = checkToxicList(widgetChild.getText()); - if (listType != null) + if (scamList != null) { widgetChild.setText("" + widgetChild.getText() + ""); } + else if (toxicList != null) + { + widgetChild.setText("" + widgetChild.getText() + ""); + } } }); } -} \ No newline at end of file +} From fce9847c1563b4abd190309553992ecc75bda7c9 Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Sat, 22 Jun 2019 04:40:29 +0100 Subject: [PATCH 112/117] nibbler overlay fix nibbler overlay fix --- .../java/net/runelite/client/plugins/inferno/InfernoPlugin.java | 1 + 1 file changed, 1 insertion(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoPlugin.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoPlugin.java index 0bc1b4f746..8103551362 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoPlugin.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoPlugin.java @@ -158,6 +158,7 @@ public class InfernoPlugin extends Plugin jad = null; attack = null; monster = null; + monsters = null; waves = null; currentWaveNumber = -1; nextWaveNumber = -1; From a58898f46ebe6ce7cee6183bb6b045d2e261d69d Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Sat, 22 Jun 2019 04:46:12 +0100 Subject: [PATCH 113/117] Update InfernoWaveOverlay.java --- .../net/runelite/client/plugins/inferno/InfernoWaveOverlay.java | 1 - 1 file changed, 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java index e8957a2026..e85858a089 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java @@ -1,6 +1,5 @@ package net.runelite.client.plugins.inferno; -import java.util.Iterator; import java.util.HashMap; import java.util.Map; import com.google.inject.Inject; From 2f6f3d8157966e0c3a265dab5d798e3fd712553d Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Sat, 22 Jun 2019 05:16:12 +0100 Subject: [PATCH 114/117] NPE fix + wave info NPE fix + wave info --- .../plugins/inferno/InfernoWaveOverlay.java | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java index e85858a089..f8b3532748 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java @@ -67,3 +67,73 @@ public class InfernoWaveOverlay extends Overlay } } } +package net.runelite.client.plugins.inferno; + +import java.util.Iterator; +import java.util.HashMap; +import java.util.Map; +import com.google.inject.Inject; +import net.runelite.client.ui.overlay.components.TitleComponent; +import java.awt.Graphics2D; +import net.runelite.client.ui.overlay.OverlayPriority; +import net.runelite.client.ui.overlay.OverlayPosition; +import java.awt.Dimension; +import net.runelite.client.ui.overlay.components.PanelComponent; +import net.runelite.api.Client; +import net.runelite.client.ui.overlay.Overlay; + +public class InfernoWaveOverlay extends Overlay + { + private final Client client; + private final InfernoPlugin plugin; + private final InfernoConfig config; + private PanelComponent panelComponent; + + @Inject + InfernoWaveOverlay(final Client client, final InfernoPlugin plugin, final InfernoConfig config) + { + (this.panelComponent = new PanelComponent()).setPreferredSize(new Dimension(150, 0)); + this.setPosition(OverlayPosition.TOP_RIGHT); + this.setPriority(OverlayPriority.HIGH); + this.client = client; + this.plugin = plugin; + this.config = config; + } + + public Dimension render(final Graphics2D graphics) + { + if (!plugin.inInferno() || plugin.getCurrentWaveNumber() == 0) + { + return null; + } + panelComponent.getChildren().clear(); + if (config.waveDisplay() == InfernoWaveDisplayMode.CURRENT + || config.waveDisplay() == InfernoWaveDisplayMode.BOTH) + { + renderWave("Current Wave (Wave " + plugin.getCurrentWaveNumber() + ")", plugin.getCurrentWaveNumber()); + } + if ((config.waveDisplay() == InfernoWaveDisplayMode.NEXT + || config.waveDisplay() == InfernoWaveDisplayMode.BOTH) + && plugin.isNotFinalWave()) + { + renderWave("Next Wave (Wave " + plugin.getNextWaveNumber() + ")", plugin.getCurrentWaveNumber()); + } + return panelComponent.render(graphics); + } + + private void renderWave(final String header, final int waveNumber) + { + panelComponent.getChildren().add(TitleComponent.builder().text(header).color(config.getWaveOverlayHeaderColor()).build()); + final HashMap waveMap = (HashMap) InfernoWaveMappings.intArrayToHashmap(plugin.getWaves().get(waveNumber)); + for (final Map.Entry entry : waveMap.entrySet()) + { + final int monsterID = entry.getKey(); + final int quantity = entry.getValue(); + if (quantity <= 0) + { + continue; + } + panelComponent.getChildren().add(TitleComponent.builder().text(quantity + "x " + plugin.getMonster().get(monsterID)).color(config.getWaveTextColor()).build()); + } + } + } \ No newline at end of file From 53b36a639724a7ddbbdc144b7c5fe3be428bc8e1 Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Sat, 22 Jun 2019 05:18:37 +0100 Subject: [PATCH 115/117] Update InfernoWaveOverlay.java --- .../net/runelite/client/plugins/inferno/InfernoWaveOverlay.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java index f8b3532748..5116eda02c 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java @@ -116,7 +116,7 @@ public class InfernoWaveOverlay extends Overlay || config.waveDisplay() == InfernoWaveDisplayMode.BOTH) && plugin.isNotFinalWave()) { - renderWave("Next Wave (Wave " + plugin.getNextWaveNumber() + ")", plugin.getCurrentWaveNumber()); + renderWave("Next Wave (Wave " + plugin.getNextWaveNumber() + ")", plugin.getNextWaveNumber()); } return panelComponent.render(graphics); } From 70335b5a959882f0e735910ed87f9af90f35affc Mon Sep 17 00:00:00 2001 From: Kyleeld <48519776+Kyleeld@users.noreply.github.com> Date: Sat, 22 Jun 2019 05:24:46 +0100 Subject: [PATCH 116/117] sigh, yet another fix sigh, yet another fix --- .../plugins/inferno/InfernoWaveOverlay.java | 74 +------------------ 1 file changed, 2 insertions(+), 72 deletions(-) diff --git a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java index 5116eda02c..f721682a01 100644 --- a/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java +++ b/runelite-client/src/main/java/net/runelite/client/plugins/inferno/InfernoWaveOverlay.java @@ -12,76 +12,6 @@ import net.runelite.client.ui.overlay.components.PanelComponent; import net.runelite.api.Client; import net.runelite.client.ui.overlay.Overlay; -public class InfernoWaveOverlay extends Overlay - { - private final Client client; - private final InfernoPlugin plugin; - private final InfernoConfig config; - private PanelComponent panelComponent; - - @Inject - InfernoWaveOverlay(final Client client, final InfernoPlugin plugin, final InfernoConfig config) - { - (this.panelComponent = new PanelComponent()).setPreferredSize(new Dimension(150, 0)); - this.setPosition(OverlayPosition.TOP_RIGHT); - this.setPriority(OverlayPriority.HIGH); - this.client = client; - this.plugin = plugin; - this.config = config; - } - - public Dimension render(final Graphics2D graphics) - { - if (!plugin.inInferno() || plugin.getCurrentWaveNumber() == -1) - { - return null; - } - panelComponent.getChildren().clear(); - if (config.waveDisplay() == InfernoWaveDisplayMode.CURRENT - || config.waveDisplay() == InfernoWaveDisplayMode.BOTH) - { - renderWave("Wave " + plugin.getCurrentWaveNumber(), plugin.getCurrentWaveNumber()); - } - if ((config.waveDisplay() == InfernoWaveDisplayMode.NEXT - || config.waveDisplay() == InfernoWaveDisplayMode.BOTH) - && plugin.isNotFinalWave()) - { - renderWave("Next Wave:", plugin.getNextWaveNumber()); - } - return panelComponent.render(graphics); - } - - private void renderWave(final String header, final int waveNumber) - { - panelComponent.getChildren().add(TitleComponent.builder().text(header).color(config.getWaveOverlayHeaderColor()).build()); - final HashMap waveMap = (HashMap) InfernoWaveMappings.intArrayToHashmap(plugin.getWaves().get(waveNumber)); - for (final Map.Entry entry : waveMap.entrySet()) - { - final int monsterID = entry.getKey(); - final int quantity = entry.getValue(); - if (quantity <= 0) - { - continue; - } - panelComponent.getChildren().add(TitleComponent.builder().text(quantity + "x " + plugin.getMonster().get(monsterID)).color(config.getWaveTextColor()).build()); - } - } - } -package net.runelite.client.plugins.inferno; - -import java.util.Iterator; -import java.util.HashMap; -import java.util.Map; -import com.google.inject.Inject; -import net.runelite.client.ui.overlay.components.TitleComponent; -import java.awt.Graphics2D; -import net.runelite.client.ui.overlay.OverlayPriority; -import net.runelite.client.ui.overlay.OverlayPosition; -import java.awt.Dimension; -import net.runelite.client.ui.overlay.components.PanelComponent; -import net.runelite.api.Client; -import net.runelite.client.ui.overlay.Overlay; - public class InfernoWaveOverlay extends Overlay { private final Client client; @@ -116,7 +46,7 @@ public class InfernoWaveOverlay extends Overlay || config.waveDisplay() == InfernoWaveDisplayMode.BOTH) && plugin.isNotFinalWave()) { - renderWave("Next Wave (Wave " + plugin.getNextWaveNumber() + ")", plugin.getNextWaveNumber()); + renderWave("Next Wave (Wave " + plugin.getNextWaveNumber() + ")", plugin.getCurrentWaveNumber()); } return panelComponent.render(graphics); } @@ -136,4 +66,4 @@ public class InfernoWaveOverlay extends Overlay panelComponent.getChildren().add(TitleComponent.builder().text(quantity + "x " + plugin.getMonster().get(monsterID)).color(config.getWaveTextColor()).build()); } } - } \ No newline at end of file + } From 2e7aea3c623b036c326ff934a4619a614c970512 Mon Sep 17 00:00:00 2001 From: zeruth Date: Sat, 22 Jun 2019 02:02:02 -0400 Subject: [PATCH 117/117] live update --- bootstrap.json | 22 ++++++++++++------- .../client/util/bootstrap/Bootstrap.java | 2 +- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/bootstrap.json b/bootstrap.json index 3ae81b11cc..2052530dbe 100644 --- a/bootstrap.json +++ b/bootstrap.json @@ -1,5 +1,5 @@ { - "buildCommit": "c554ab2400dc04a619b36695da2107648c9c87b3", + "buildCommit": "2d0c2b8eb66a8088b41b29d42ec2a58ead460581", "artifacts": [ { "hash": "b12331da8683e5f107d294adeebb83ecf9124abc1db533554d2a8d3c62832d75", @@ -20,10 +20,10 @@ "size": "3168921" }, { - "hash": "877106b9b525477f8e9662704b00894d445dd7d476c51dad7a674f6a313e3f88", + "hash": "4c388a85fb538bbb8cb6e0fd93e0ba0666605123d77b976764818be6f090bbe5", "name": "client-1.5.28-SNAPSHOT.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/client-1.5.28-SNAPSHOT.jar", - "size": "5845767" + "size": "5871886" }, { "hash": "18c4a0095d5c1da6b817592e767bb23d29dd2f560ad74df75ff3961dbde25b79", @@ -212,22 +212,22 @@ "size": "2327547" }, { - "hash": "0858c0fa0e3efa454a2c06a60e0b9c003661cdccb52331b36f0d1dc4e90d381f", + "hash": "440c629bec3905eb21dc5965fa38464f160a4cb8f87ca76806cdecc18b2c5992", "name": "runelite-api-1.5.28-SNAPSHOT.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/runelite-api-1.5.28-SNAPSHOT.jar", "size": "1019717" }, { - "hash": "303ac8f202bc169f30f16f3c5a3810aaae773515af4d6a7562bc996ed0f32054", + "hash": "45e3bcec9e7bae4ca2facd0fbee1f3da5e0700584e8419deed784a95255552c1", "name": "runescape-api-1.5.28-SNAPSHOT.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/runescape-api-1.5.28-SNAPSHOT.jar", - "size": "56043" + "size": "56079" }, { - "hash": "830499b8b8d65403536d20206d210f12e7524777dde9a6948d4681333c9b962a", + "hash": "811aadce9ce35ac638712da86123d4cb99570a9550614931471295cb26f91c36", "name": "http-api-1.5.28-SNAPSHOT.jar", "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/http-api-1.5.28-SNAPSHOT.jar", - "size": "101786" + "size": "101785" }, { "hash": "f55abda036da75e1af45bd43b9dfa79b2a3d90905be9cb38687c6621597a8165", @@ -252,6 +252,12 @@ "name": "discord-1.1.jar", "path": "https://repo.runelite.net/net/runelite/discord/1.1/discord-1.1.jar", "size": "617294" + }, + { + "hash": "a3cab9293960d1d61968ce1591c87859ddcaa6cb2faca554cc938961c8fb3d3a", + "name": "injected-client-1.5.28-SNAPSHOT.jar", + "path": "https://raw.githubusercontent.com/runelite-extended/maven-repo/master/live/injected-client-1.5.28-SNAPSHOT.jar", + "size": "2193046" } ], "client": { diff --git a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java index e86f2c8a02..b8e6d60d94 100644 --- a/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java +++ b/runelite-client/src/main/java/net/runelite/client/util/bootstrap/Bootstrap.java @@ -22,7 +22,7 @@ public class Bootstrap String size; } - String buildCommit = "c554ab2400dc04a619b36695da2107648c9c87b3"; + String buildCommit = "2d0c2b8eb66a8088b41b29d42ec2a58ead460581"; private Artifact[] artifacts = getArtifacts(); Client client = new Client(); String[] clientJvm9Arguments = new String[]{